Skip to content

Commit

Permalink
Added nightly runs for rust nightly versions update failure. (starkwa…
Browse files Browse the repository at this point in the history
  • Loading branch information
orizi authored May 12, 2024
1 parent 0ba77c2 commit 2b8bd3d
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 16 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Nightly

on:
schedule:
# Runs the end of every day.
- cron: "0 0 * * *"

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 2b8bd3d

Please sign in to comment.