Skip to content

Commit

Permalink
Added nightly runs for rust nightly versions update failure.
Browse files Browse the repository at this point in the history
Additional fixes to make the nightlies pass properly.
  • Loading branch information
orizi committed May 11, 2024
1 parent cd81050 commit 66c73b3
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 16 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Nightly

on:
schedule:
# Runs against the default branch every day overnight
- cron: "18 3 * * *"
- branches: [main]
workflow_dispatch:

jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: scripts/rust_fmt.sh --check

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: >
scripts/clippy.sh
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- run: >
scripts/docs.sh
11 changes: 4 additions & 7 deletions crates/cairo-lang-lowering/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ impl DiagnosticEntry for LoweringDiagnostic {
LoweringDiagnosticKind::DesnappingANonCopyableType { .. } => {
"Cannot desnap a non copyable type.".into()
}
LoweringDiagnosticKind::MatchError(
match_err
) =>
match_err.format(),
LoweringDiagnosticKind::MatchError(match_err) => match_err.format(),
LoweringDiagnosticKind::CannotInlineFunctionThatMightCallItself => {
"Cannot inline a function that might call itself.".into()
}
Expand All @@ -70,7 +67,7 @@ impl DiagnosticEntry for LoweringDiagnostic {
}
LoweringDiagnosticKind::NoPanicFunctionCycle => {
"Call cycle of `nopanic` functions is not allowed.".into()
},
}
LoweringDiagnosticKind::LiteralError(literal_error) => literal_error.format(db),
LoweringDiagnosticKind::UnsupportedPattern => {
"Inner patterns are not in this context.".into()
Expand All @@ -80,10 +77,10 @@ impl DiagnosticEntry for LoweringDiagnostic {
"Fixed size array inner type must implement the `Copy` trait when the array size \
is greater than 1."
.into()
},
}
LoweringDiagnosticKind::EmptyRepeatedElementFixedSizeArray => {
"Fixed size array repeated element size must be greater than 0.".into()
},
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/cairo-lang-lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ mod test;

pub use self::objects::*;

#[cfg(any(feature = "testing", test))]
#[cfg(test)]
pub mod test_utils;
5 changes: 1 addition & 4 deletions crates/cairo-lang-lowering/src/lower/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1170,10 +1170,7 @@ fn perform_function_call(

return Err(LoweringFlowError::Match(MatchInfo::Enum(MatchEnumInfo {
concrete_enum_id: extract_matches!(
extract_matches!(
ret_ty.lookup_intern(ctx.db),
semantic::TypeLongId::Concrete
),
extract_matches!(ret_ty.lookup_intern(ctx.db), semantic::TypeLongId::Concrete),
semantic::ConcreteTypeId::Enum
),
input: VarUsage { var_id: call_result.returns[0].var_id, location },
Expand Down
2 changes: 1 addition & 1 deletion crates/cairo-lang-parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ pub mod recovery;
pub mod utils;
mod validation;

#[cfg(any(feature = "testing", test))]
#[cfg(test)]
pub mod test_utils;
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ fn get_dep_component_generate_code_helper(
if is_mut { ("let mut", "_mut", "ref ") } else { ("let", "", "") };
builder.add_modified(RewriteNode::interpolate_patched(
&format!(
"
"
{{
{let_part} __get_dep_component_macro_temp_contract__ = \
HasComponent::get_contract{maybe_mut}({maybe_ref}$contract_path$);
$component_impl_path$::get_component{maybe_mut}({maybe_ref}\
__get_dep_component_macro_temp_contract__)
}}
"),
"
),
&[
("contract_path".to_string(), RewriteNode::new_trimmed(contract_arg.as_syntax_node())),
(
Expand Down
2 changes: 1 addition & 1 deletion scripts/rust_fmt.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

cargo +nightly-2024-04-23 fmt --all -- "$@"
cargo fmt --all -- "$@"

0 comments on commit 66c73b3

Please sign in to comment.