From 4b5fbfe7341e6ff642bd6920ec8c6826498a7db8 Mon Sep 17 00:00:00 2001 From: Pradeep HN Date: Mon, 25 Aug 2025 12:42:10 +0530 Subject: [PATCH] Support latest toolchains - Add support for rustc 1.91.0 version - Add support for cargo 1.01.0 version - Add support fot cliipy 0.1.91 version Signed-off-by: Pradeep HN --- Cargo.toml | 6 ++---- tests/compile-fail/Rule_10_5.rs | 2 +- tests/compile-fail/Rule_10_7.rs | 4 ++-- tests/compile-fail/Rule_11_2.rs | 3 +-- tests/compile-fail/Rule_11_3.rs | 3 +-- tests/compile-fail/Rule_11_8.rs | 3 +-- tests/compile-fail/Rule_12_2.rs | 5 ++--- tests/compile-fail/Rule_12_4.rs | 3 +-- tests/compile-fail/Rule_15_6.rs | 3 +-- tests/compile-fail/Rule_16_4.rs | 3 +-- tests/compile-fail/Rule_17_4.rs | 3 +-- tests/compile-fail/Rule_17_5.rs | 1 + tests/compile-fail/Rule_17_6.rs | 3 +-- tests/compile-fail/Rule_18_2.rs | 3 +-- tests/compile-fail/Rule_18_4.rs | 3 +-- tests/compile-fail/Rule_18_6.rs | 3 +-- tests/compile-fail/Rule_18_7.rs | 3 +-- tests/compile-fail/Rule_20_4.rs | 3 +-- tests/compile-fail/Rule_20_6.rs | 3 +-- tests/compile-fail/Rule_2_1.rs | 5 +++-- tests/compile-fail/Rule_2_2.rs | 2 +- tests/compile-fail/Rule_2_3.rs | 2 +- tests/compile-fail/Rule_2_4.rs | 4 ++-- tests/compile-fail/Rule_4_1.rs | 2 +- tests/compile-fail/Rule_5_4.rs | 6 +++--- tests/compile-fail/Rule_5_5.rs | 4 ++-- tests/compile-fail/Rule_5_8.rs | 8 +++++--- tests/compile-fail/Rule_5_9.rs | 2 +- tests/compile-fail/Rule_8_11.rs | 2 +- tests/compile-fail/Rule_8_12.rs | 10 +++++----- tests/compile-fail/Rule_8_5.rs | 4 ++++ tests/compile-fail/Rule_8_7.rs | 4 ++++ tests/compile-fail/Rule_9_1.rs | 3 +-- tests/compile-fail/Rule_9_5.rs | 5 +++-- 34 files changed, 59 insertions(+), 64 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 788029e..e35eb6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,9 @@ [package] name = "misra_rust" +edition = "2024" version = "0.1.0" authors = ["Shea Newton "] -[dependencies.clippy] -version = "=0.0.210" - [dev-dependencies.compiletest_rs] -version = "=0.3.11" +version = "0.11.2" diff --git a/tests/compile-fail/Rule_10_5.rs b/tests/compile-fail/Rule_10_5.rs index e8069ef..8f61735 100644 --- a/tests/compile-fail/Rule_10_5.rs +++ b/tests/compile-fail/Rule_10_5.rs @@ -1,3 +1,3 @@ fn main() { - let x: bool = 3 as bool; //~ ERROR cannot cast as `bool` + let x: bool = 3 as bool; //~ cannot cast `i32` as `bool` [E0054] } diff --git a/tests/compile-fail/Rule_10_7.rs b/tests/compile-fail/Rule_10_7.rs index 2c7a957..19cc775 100644 --- a/tests/compile-fail/Rule_10_7.rs +++ b/tests/compile-fail/Rule_10_7.rs @@ -2,6 +2,6 @@ fn main() { let u16_a: u16 = 1; let u16_b: u16 = 2; let u32_c: u32 = 3; - let _ = u32_c * (u16_a + u16_b); //~ ERROR mismatched types - //~^ ERROR cannot multiply `u16` to `u32` + let _ = u32_c * //~ ERROR cannot multiply `u32` by `u16` [E0277] + (u16_a + u16_b); //~ ERROR mismatched types [E0308] } diff --git a/tests/compile-fail/Rule_11_2.rs b/tests/compile-fail/Rule_11_2.rs index d72b614..83dae16 100644 --- a/tests/compile-fail/Rule_11_2.rs +++ b/tests/compile-fail/Rule_11_2.rs @@ -7,6 +7,5 @@ fn main() { let t = Type { f: 3.14 }; let r1: &Type = t as &Type; //~^ ERROR non-primitive cast: `Type` as `&Type` - let r2: &Type = From::from(t); - //~^ ERROR the trait bound `&Type: std::convert::From` is not satisfied + let r2: &Type = From::from(t); //~ ERROR the trait bound `&Type: From` is not satisfied [E0277] } diff --git a/tests/compile-fail/Rule_11_3.rs b/tests/compile-fail/Rule_11_3.rs index 1272550..fb3f9de 100644 --- a/tests/compile-fail/Rule_11_3.rs +++ b/tests/compile-fail/Rule_11_3.rs @@ -12,6 +12,5 @@ fn main() { let ta = TypeA { f: 3.14 }; let tb1: TypeB = ta as TypeB; //~^ ERROR non-primitive cast: `TypeA` as `TypeB` - let tb2: TypeB = From::from(ta); - //~^ ERROR the trait bound `TypeB: std::convert::From` is not satisfied + let tb2: TypeB = From::from(ta); //~ ERROR the trait bound `TypeB: From` is not satisfied [E0277] } diff --git a/tests/compile-fail/Rule_11_8.rs b/tests/compile-fail/Rule_11_8.rs index ecbd910..948800a 100644 --- a/tests/compile-fail/Rule_11_8.rs +++ b/tests/compile-fail/Rule_11_8.rs @@ -1,5 +1,4 @@ fn main() { let a = 1; - *(&mut a) = 2; - //~^ ERROR cannot borrow immutable local variable `a` as mutable + *(&mut a) = 2; //~ ERROR cannot borrow `a` as mutable, as it is not declared as mutable [E0596] } diff --git a/tests/compile-fail/Rule_12_2.rs b/tests/compile-fail/Rule_12_2.rs index fcca715..79fc30d 100644 --- a/tests/compile-fail/Rule_12_2.rs +++ b/tests/compile-fail/Rule_12_2.rs @@ -1,5 +1,4 @@ fn main() { let u8a: u8 = 1; - let _: u8 = u8a << 8; - //~^ ERROR attempt to shift left with overflow -} + let _: u8 = u8a << 8; //~ ERROR this arithmetic operation will overflow [arithmetic_overflow] +} \ No newline at end of file diff --git a/tests/compile-fail/Rule_12_4.rs b/tests/compile-fail/Rule_12_4.rs index 0b0fb6b..30aefdd 100644 --- a/tests/compile-fail/Rule_12_4.rs +++ b/tests/compile-fail/Rule_12_4.rs @@ -1,5 +1,4 @@ fn main() { let u8a: u8 = 0; - let _x = u8a - 10; - //~^ERROR Non-compliant - attempt to subtract with overflow + let _x = u8a - 10; //~ERROR this arithmetic operation will overflow [arithmetic_overflow] } diff --git a/tests/compile-fail/Rule_15_6.rs b/tests/compile-fail/Rule_15_6.rs index a7d295b..1f60d88 100644 --- a/tests/compile-fail/Rule_15_6.rs +++ b/tests/compile-fail/Rule_15_6.rs @@ -1,5 +1,4 @@ fn main() { loop - let _ = 1; - //~^ ERROR expected `{`, found `let` + let _ = 1; //~ expected `{`, found keyword `let` } diff --git a/tests/compile-fail/Rule_16_4.rs b/tests/compile-fail/Rule_16_4.rs index 370f8cf..9de7ea6 100644 --- a/tests/compile-fail/Rule_16_4.rs +++ b/tests/compile-fail/Rule_16_4.rs @@ -1,7 +1,6 @@ fn main() { let i = 1; - match i { - //~^ ERROR non-exhaustive patterns: `_` not covered + match i { //~ ERROR non-exhaustive patterns: `i32::MIN..=-1_i32` and `1_i32..=i32::MAX` not covered [E0004] 0 => {} } } diff --git a/tests/compile-fail/Rule_17_4.rs b/tests/compile-fail/Rule_17_4.rs index 62669b2..0ef6009 100644 --- a/tests/compile-fail/Rule_17_4.rs +++ b/tests/compile-fail/Rule_17_4.rs @@ -1,6 +1,5 @@ fn return_v1(depth: u64) -> u64 { - if depth == 2 { - //~^ ERROR if may be missing an else clause + if depth == 2 { //~ ERROR `if` may be missing an `else` clause [E0317] return depth; } } diff --git a/tests/compile-fail/Rule_17_5.rs b/tests/compile-fail/Rule_17_5.rs index 9601c28..dfb8d7f 100644 --- a/tests/compile-fail/Rule_17_5.rs +++ b/tests/compile-fail/Rule_17_5.rs @@ -1,3 +1,4 @@ +#[allow(unused_variables)] fn fn1(data: [u32; 3]) { // } diff --git a/tests/compile-fail/Rule_17_6.rs b/tests/compile-fail/Rule_17_6.rs index 8871b9f..5fe04f2 100644 --- a/tests/compile-fail/Rule_17_6.rs +++ b/tests/compile-fail/Rule_17_6.rs @@ -1,4 +1,3 @@ fn main() { - let data: [u32; static 4]; - //~^ ERROR expected one of `move`, `|`, or `||`, found `4` + let data: [u32; static 4]; //~ ERROR expected one of `move`, `use`, `|`, or `||`, found `4` } diff --git a/tests/compile-fail/Rule_18_2.rs b/tests/compile-fail/Rule_18_2.rs index 5ad1ad9..7fceed8 100644 --- a/tests/compile-fail/Rule_18_2.rs +++ b/tests/compile-fail/Rule_18_2.rs @@ -2,6 +2,5 @@ fn main() { let a1: [i32; 10] = [0; 10]; let a2: [i32; 10] = [0; 10]; - let _ = &a1 - &a2; - //~^ ERROR binary operation `-` cannot be applied to type `&[i32; 10]` + let _ = &a1 - &a2; //~ ERROR cannot subtract `&[i32; 10]` from `&[i32; 10]` [E0369] } diff --git a/tests/compile-fail/Rule_18_4.rs b/tests/compile-fail/Rule_18_4.rs index 2344f97..7a9ee26 100644 --- a/tests/compile-fail/Rule_18_4.rs +++ b/tests/compile-fail/Rule_18_4.rs @@ -2,6 +2,5 @@ fn main() { let a: [u8; 10] = [0; 10]; let ptr = &a[5]; - (ptr + 5) = 0; - //~^ ERROR invalid left-hand side expression + (ptr + 5) = 0; //~ ERROR invalid left-hand side of assignment [E0070] } diff --git a/tests/compile-fail/Rule_18_6.rs b/tests/compile-fail/Rule_18_6.rs index 18fbe73..69ab383 100644 --- a/tests/compile-fail/Rule_18_6.rs +++ b/tests/compile-fail/Rule_18_6.rs @@ -1,7 +1,6 @@ fn func() -> &'static i8 { let local_auto: i8 = 0; - &local_auto - //~^ ERROR `local_auto` does not live long enough + &local_auto //~ ERROR cannot return reference to local variable `local_auto` [E0515] } fn main() { diff --git a/tests/compile-fail/Rule_18_7.rs b/tests/compile-fail/Rule_18_7.rs index ba34e90..f5636a6 100644 --- a/tests/compile-fail/Rule_18_7.rs +++ b/tests/compile-fail/Rule_18_7.rs @@ -1,4 +1,3 @@ fn main() { - let a: [u32]; - //~^ ERROR the size for value values of type `[u32]` cannot be known at compilation time + let a: [u32]; //~ ERROR the size for values of type `[u32]` cannot be known at compilation time [E0277] } diff --git a/tests/compile-fail/Rule_20_4.rs b/tests/compile-fail/Rule_20_4.rs index f0060db..974a29e 100644 --- a/tests/compile-fail/Rule_20_4.rs +++ b/tests/compile-fail/Rule_20_4.rs @@ -4,6 +4,5 @@ macro_rules! while { //~ ERROR expected identifier, found keyword `while` } fn main() { - let _ = while!(); - //~^ ERROR expected one of `.`, `?`, `{`, or an operator, found `;` + let _ = while!(); //~ ERROR expected `{`, found `;` } diff --git a/tests/compile-fail/Rule_20_6.rs b/tests/compile-fail/Rule_20_6.rs index ccec396..e30cae2 100644 --- a/tests/compile-fail/Rule_20_6.rs +++ b/tests/compile-fail/Rule_20_6.rs @@ -8,8 +8,7 @@ fn main() { let _ = double_it!( #[cfg(feature = 10)] 10 - #[cfg(feature = 100)] - //~^ ERROR no rules expected the token `#` + #[cfg(feature = 100)] //~ ERROR no rules expected `#` 100 ); } diff --git a/tests/compile-fail/Rule_2_1.rs b/tests/compile-fail/Rule_2_1.rs index c0f09cf..f94b637 100644 --- a/tests/compile-fail/Rule_2_1.rs +++ b/tests/compile-fail/Rule_2_1.rs @@ -1,7 +1,8 @@ -#[deny(unreachable_code)] +#[allow(unused_assignments, unused_variables)] fn main() { let x: u16; return; - x = 3; //~ ERROR unreachable statement + x = 3; //~ ERROR unreachable statement [unreachable_code] } + \ No newline at end of file diff --git a/tests/compile-fail/Rule_2_2.rs b/tests/compile-fail/Rule_2_2.rs index beed91d..930d681 100644 --- a/tests/compile-fail/Rule_2_2.rs +++ b/tests/compile-fail/Rule_2_2.rs @@ -1,6 +1,6 @@ #[deny(dead_code)] const DEAD_CODE: i32 = 0; -//~^ ERROR constant item is never used: `DEAD_CODE` +//~^ ERROR 3:7: 3:16: constant `DEAD_CODE` is never used [dead_code] fn main() {} diff --git a/tests/compile-fail/Rule_2_3.rs b/tests/compile-fail/Rule_2_3.rs index 172ec33..876bec9 100644 --- a/tests/compile-fail/Rule_2_3.rs +++ b/tests/compile-fail/Rule_2_3.rs @@ -1,5 +1,5 @@ #[deny(dead_code)] fn main() { - type LocalType = i16; //~ ERROR type alias is never used: `LocalType` + type LocalType = i16; //~ ERROR type alias `LocalType` is never used [dead_code] } diff --git a/tests/compile-fail/Rule_2_4.rs b/tests/compile-fail/Rule_2_4.rs index fa985c4..49edb42 100644 --- a/tests/compile-fail/Rule_2_4.rs +++ b/tests/compile-fail/Rule_2_4.rs @@ -2,8 +2,8 @@ fn main() { enum State { - //~^ ERROR enum is never used: `State` + //~^ ERROR enum `State` is never used [dead_code] SInit, SRun, SSleep, - };} + }} diff --git a/tests/compile-fail/Rule_4_1.rs b/tests/compile-fail/Rule_4_1.rs index 539d25c..cceeddb 100644 --- a/tests/compile-fail/Rule_4_1.rs +++ b/tests/compile-fail/Rule_4_1.rs @@ -1,4 +1,4 @@ fn main() { let x = "\x41\x4g"; - //~^ ERROR invalid character in numeric character escape: g + //~^ ERROR invalid character in numeric character escape: `g` } diff --git a/tests/compile-fail/Rule_5_4.rs b/tests/compile-fail/Rule_5_4.rs index 329f0d9..6e73ac5 100644 --- a/tests/compile-fail/Rule_5_4.rs +++ b/tests/compile-fail/Rule_5_4.rs @@ -1,17 +1,17 @@ macro_rules! engine_exhaust_gas_temperature_raw { () => { - 3; + 3 }; } macro_rules! engine_exhaust_gas_temperature_scaled { //~^ ERROR Non-compliant - variable name shadows engine_exhaust_gas_temperature_raw () => { - 4; + 4 }; } fn main() { let _ = engine_exhaust_gas_temperature_raw!(); let _ = engine_exhaust_gas_temperature_scaled!(); -} +} \ No newline at end of file diff --git a/tests/compile-fail/Rule_5_5.rs b/tests/compile-fail/Rule_5_5.rs index 3b78fcb..fe1ec1b 100644 --- a/tests/compile-fail/Rule_5_5.rs +++ b/tests/compile-fail/Rule_5_5.rs @@ -2,10 +2,10 @@ macro_rules! val { () => { - 3; + 3 }; } fn main() { - let val!: i16 = 1; //~ ERROR expected open delimiter + let val!: i16 = 1; //~ ERROR expected one of `(`, `[`, or `{`, found `:` } diff --git a/tests/compile-fail/Rule_5_8.rs b/tests/compile-fail/Rule_5_8.rs index 801ae0e..122125f 100644 --- a/tests/compile-fail/Rule_5_8.rs +++ b/tests/compile-fail/Rule_5_8.rs @@ -1,6 +1,8 @@ +#![allow(unused_variables)] +#[allow(dead_code)] + pub static count: i32 = 1; fn main() { - let count: i32 = 1; - //~^ ERROR let bindings cannot shadow statics -} + let count: i32 = 1; //~ ERROR let bindings cannot shadow statics [E0530] +} \ No newline at end of file diff --git a/tests/compile-fail/Rule_5_9.rs b/tests/compile-fail/Rule_5_9.rs index 58c1653..3596f63 100644 --- a/tests/compile-fail/Rule_5_9.rs +++ b/tests/compile-fail/Rule_5_9.rs @@ -2,5 +2,5 @@ const count: i32 = 0; fn main() { let count: i32 = 1; - //~^ ERROR refutable pattern in local binding: `_` not covered + //~^ ERROR refutable pattern in local binding } diff --git a/tests/compile-fail/Rule_8_11.rs b/tests/compile-fail/Rule_8_11.rs index 6528c9b..a296757 100644 --- a/tests/compile-fail/Rule_8_11.rs +++ b/tests/compile-fail/Rule_8_11.rs @@ -1,4 +1,4 @@ -pub const arr: [i32] = []; //~ ERROR the size for value values of type `[i32]` cannot be known at compilation time +pub const arr: [i32] = []; //~ ERROR the size for values of type `[i32]` cannot be known at compilation time [E0277] //~^ ERROR mismatched types fn main() {} diff --git a/tests/compile-fail/Rule_8_12.rs b/tests/compile-fail/Rule_8_12.rs index 8b6942b..da48c0b 100644 --- a/tests/compile-fail/Rule_8_12.rs +++ b/tests/compile-fail/Rule_8_12.rs @@ -1,8 +1,8 @@ -enum Uniqueness { - red = 3, - blue, - green, - yellow = 5, //~ ERROR discriminant value `5` already exists +enum Uniqueness { //~ ERROR discriminant value `5` assigned more than once [E0081] + RED = 3, + BLUE, + GREEN, + YELLOW = 5, } fn main() {} diff --git a/tests/compile-fail/Rule_8_5.rs b/tests/compile-fail/Rule_8_5.rs index 758c33e..3d02bf4 100644 --- a/tests/compile-fail/Rule_8_5.rs +++ b/tests/compile-fail/Rule_8_5.rs @@ -1,3 +1,7 @@ pub const PUBLIC_ZERO: u64 = 0u64; pub const PUBLIC_ZERO: u64 = 0u64; //~^ ERROR the name `PUBLIC_ZERO` is defined multiple times + +fn main() { + +} diff --git a/tests/compile-fail/Rule_8_7.rs b/tests/compile-fail/Rule_8_7.rs index ebedb5f..8e2292b 100644 --- a/tests/compile-fail/Rule_8_7.rs +++ b/tests/compile-fail/Rule_8_7.rs @@ -1,2 +1,6 @@ pub const LIBRARY_GLOBAL: u32 = 0; //~^ ERROR Non-compliant - public but not used + +fn main() { + +} diff --git a/tests/compile-fail/Rule_9_1.rs b/tests/compile-fail/Rule_9_1.rs index 9c1b49f..3748b23 100644 --- a/tests/compile-fail/Rule_9_1.rs +++ b/tests/compile-fail/Rule_9_1.rs @@ -2,6 +2,5 @@ fn main() { let x: u16; - let y = x + 1; - //~^ ERROR use of possibly uninitialized variable: `x` + let y = x + 1; //~ ERROR used binding `x` isn't initialized [E0381] } diff --git a/tests/compile-fail/Rule_9_5.rs b/tests/compile-fail/Rule_9_5.rs index 5c091f8..c8b8707 100644 --- a/tests/compile-fail/Rule_9_5.rs +++ b/tests/compile-fail/Rule_9_5.rs @@ -1,4 +1,5 @@ fn main() { - let x: [i32] = [0, 1]; //~ ERROR mismatched types - //~^ ERROR the size for value values of type `[i32]` cannot be known at compilation time + let x: [i32] = //~ ERROR the size for values of type `[i32]` cannot be known at compilation time [E0277] + [0, 1]; //~ ERROR mismatched types + }