From c79fcfcca872ffc8261663549cd2371da4be92f7 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Fri, 3 Apr 2026 15:44:58 +1100 Subject: [PATCH] Fix some irrelevant warnings in `tests/incremental` This avoids having to add several unhelpful annotations when enabling diagnostic checks for `cpass` and `rpass` revisions. --- src/tools/compiletest/src/runtest.rs | 1 + tests/incremental/const-generics/change-const-param-gat.rs | 1 - tests/incremental/krate_reassign_34991/main.rs | 4 ++-- tests/incremental/rlib_cross_crate/b.rs | 4 ++-- tests/incremental/split_debuginfo_mode.rs | 1 + tests/incremental/static_cycle/b.rs | 4 ++-- tests/incremental/struct_add_field.rs | 6 +++--- tests/incremental/struct_change_field_name.rs | 6 +++--- tests/incremental/struct_change_field_type.rs | 6 +++--- tests/incremental/struct_change_field_type_cross_crate/b.rs | 6 +++--- tests/incremental/struct_change_nothing.rs | 6 +++--- tests/incremental/struct_remove_field.rs | 6 +++--- tests/incremental/type_alias_cross_crate/b.rs | 4 ++-- 13 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 6b5147cea662..455d7204d40e 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -995,6 +995,7 @@ impl<'test> TestCx<'test> { AllowUnused::No } } + TestMode::Incremental => AllowUnused::Yes, _ => AllowUnused::No, }; diff --git a/tests/incremental/const-generics/change-const-param-gat.rs b/tests/incremental/const-generics/change-const-param-gat.rs index 0aa628f4bd6b..7e9009e84b83 100644 --- a/tests/incremental/const-generics/change-const-param-gat.rs +++ b/tests/incremental/const-generics/change-const-param-gat.rs @@ -1,7 +1,6 @@ //@ revisions: rpass1 rpass2 rpass3 //@ compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc -#![feature(generic_associated_types)] // This test unsures that with_opt_const_param returns the // def_id of the N param in the Foo::Assoc GAT. diff --git a/tests/incremental/krate_reassign_34991/main.rs b/tests/incremental/krate_reassign_34991/main.rs index 2aa77377f5da..1c237df827bd 100644 --- a/tests/incremental/krate_reassign_34991/main.rs +++ b/tests/incremental/krate_reassign_34991/main.rs @@ -8,13 +8,13 @@ extern crate a; #[cfg(rpass1)] -pub fn use_X() -> u32 { +pub fn use_x() -> u32 { let x: a::X = 22; x as u32 } #[cfg(rpass2)] -pub fn use_X() -> u32 { +pub fn use_x() -> u32 { 22 } diff --git a/tests/incremental/rlib_cross_crate/b.rs b/tests/incremental/rlib_cross_crate/b.rs index c60e1c52f7ed..17f4a0d11500 100644 --- a/tests/incremental/rlib_cross_crate/b.rs +++ b/tests/incremental/rlib_cross_crate/b.rs @@ -15,14 +15,14 @@ extern crate a; #[rustc_clean(except="typeck_root,optimized_mir", cfg="rpass2")] #[rustc_clean(cfg="rpass3")] -pub fn use_X() -> u32 { +pub fn use_x() -> u32 { let x: a::X = 22; x as u32 } #[rustc_clean(cfg="rpass2")] #[rustc_clean(cfg="rpass3")] -pub fn use_Y() { +pub fn use_y() { let x: a::Y = 'c'; } diff --git a/tests/incremental/split_debuginfo_mode.rs b/tests/incremental/split_debuginfo_mode.rs index d994e24cd587..e3c1f03f5b76 100644 --- a/tests/incremental/split_debuginfo_mode.rs +++ b/tests/incremental/split_debuginfo_mode.rs @@ -5,6 +5,7 @@ // ignore-tidy-linelength //@ only-x86_64-unknown-linux-gnu //@ revisions:rpass1 rpass2 rpass3 rpass4 +//@ ignore-backends: gcc //@ [rpass1]compile-flags: -Zquery-dep-graph -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single -Zsplit-dwarf-inlining=on //@ [rpass2]compile-flags: -Zquery-dep-graph -Csplit-debuginfo=packed -Zsplit-dwarf-kind=single -Zsplit-dwarf-inlining=on diff --git a/tests/incremental/static_cycle/b.rs b/tests/incremental/static_cycle/b.rs index c8243cb5328c..98d640ad8f8d 100644 --- a/tests/incremental/static_cycle/b.rs +++ b/tests/incremental/static_cycle/b.rs @@ -3,8 +3,8 @@ #![cfg_attr(rpass2, warn(dead_code))] -pub static mut BAA: *const i8 = unsafe { &BOO as *const _ as *const i8 }; +pub static mut BAA: *const i8 = unsafe { &raw const BOO as *const i8 }; -pub static mut BOO: *const i8 = unsafe { &BAA as *const _ as *const i8 }; +pub static mut BOO: *const i8 = unsafe { &raw const BAA as *const i8 }; fn main() {} diff --git a/tests/incremental/struct_add_field.rs b/tests/incremental/struct_add_field.rs index e39935c0231a..8deee224b77d 100644 --- a/tests/incremental/struct_add_field.rs +++ b/tests/incremental/struct_add_field.rs @@ -23,17 +23,17 @@ pub struct Y { } #[rustc_clean(except="fn_sig,typeck_root", cfg="rpass2")] -pub fn use_X(x: X) -> u32 { +pub fn use_x(x: X) -> u32 { x.x as u32 } #[rustc_clean(except="typeck_root", cfg="rpass2")] -pub fn use_EmbedX(embed: EmbedX) -> u32 { +pub fn use_embed_x(embed: EmbedX) -> u32 { embed.x.x as u32 } #[rustc_clean(cfg="rpass2")] -pub fn use_Y() { +pub fn use_y() { let x: Y = Y { y: 'c' }; } diff --git a/tests/incremental/struct_change_field_name.rs b/tests/incremental/struct_change_field_name.rs index 76f42b68c5c8..70615a5b2a13 100644 --- a/tests/incremental/struct_change_field_name.rs +++ b/tests/incremental/struct_change_field_name.rs @@ -27,7 +27,7 @@ pub struct Y { } #[rustc_clean(except="typeck_root", cfg="cfail2")] -pub fn use_X() -> u32 { +pub fn use_x() -> u32 { let x: X = X { x: 22 }; //[cfail2]~^ ERROR struct `X` has no field named `x` x.x as u32 @@ -35,13 +35,13 @@ pub fn use_X() -> u32 { } #[rustc_clean(except="typeck_root", cfg="cfail2")] -pub fn use_EmbedX(embed: EmbedX) -> u32 { +pub fn use_embed_x(embed: EmbedX) -> u32 { embed.x.x as u32 //[cfail2]~^ ERROR no field `x` on type `X` } #[rustc_clean(cfg="cfail2")] -pub fn use_Y() { +pub fn use_y() { let x: Y = Y { y: 'c' }; } diff --git a/tests/incremental/struct_change_field_type.rs b/tests/incremental/struct_change_field_type.rs index 9414790303b3..a17550a412a5 100644 --- a/tests/incremental/struct_change_field_type.rs +++ b/tests/incremental/struct_change_field_type.rs @@ -26,19 +26,19 @@ pub struct Y { } #[rustc_clean(except="typeck_root", cfg="rpass2")] -pub fn use_X() -> u32 { +pub fn use_x() -> u32 { let x: X = X { x: 22 }; x.x as u32 } #[rustc_clean(except="typeck_root", cfg="rpass2")] -pub fn use_EmbedX(x: EmbedX) -> u32 { +pub fn use_embed_x(x: EmbedX) -> u32 { let x: X = X { x: 22 }; x.x as u32 } #[rustc_clean(cfg="rpass2")] -pub fn use_Y() { +pub fn use_y() { let x: Y = Y { y: 'c' }; } diff --git a/tests/incremental/struct_change_field_type_cross_crate/b.rs b/tests/incremental/struct_change_field_type_cross_crate/b.rs index ccd604717389..ecb2fae92639 100644 --- a/tests/incremental/struct_change_field_type_cross_crate/b.rs +++ b/tests/incremental/struct_change_field_type_cross_crate/b.rs @@ -10,18 +10,18 @@ extern crate a; use a::*; #[rustc_clean(except="typeck_root", cfg="rpass2")] -pub fn use_X() -> u32 { +pub fn use_x() -> u32 { let x: X = X { x: 22 }; x.x as u32 } #[rustc_clean(except="typeck_root", cfg="rpass2")] -pub fn use_EmbedX(embed: EmbedX) -> u32 { +pub fn use_embed_x(embed: EmbedX) -> u32 { embed.x.x as u32 } #[rustc_clean(cfg="rpass2")] -pub fn use_Y() { +pub fn use_y() { let x: Y = Y { y: 'c' }; } diff --git a/tests/incremental/struct_change_nothing.rs b/tests/incremental/struct_change_nothing.rs index fd8c4882e1b2..2c67192a9f53 100644 --- a/tests/incremental/struct_change_nothing.rs +++ b/tests/incremental/struct_change_nothing.rs @@ -26,19 +26,19 @@ pub struct Y { } #[rustc_clean(cfg="rpass2")] -pub fn use_X() -> u32 { +pub fn use_x() -> u32 { let x: X = X { x: 22 }; x.x as u32 } #[rustc_clean(cfg="rpass2")] -pub fn use_EmbedX(x: EmbedX) -> u32 { +pub fn use_embed_x(x: EmbedX) -> u32 { let x: X = X { x: 22 }; x.x as u32 } #[rustc_clean(cfg="rpass2")] -pub fn use_Y() { +pub fn use_y() { let x: Y = Y { y: 'c' }; } diff --git a/tests/incremental/struct_remove_field.rs b/tests/incremental/struct_remove_field.rs index eeb0dff8f422..5804d90ed84d 100644 --- a/tests/incremental/struct_remove_field.rs +++ b/tests/incremental/struct_remove_field.rs @@ -27,17 +27,17 @@ pub struct Y { } #[rustc_clean(except="typeck_root,fn_sig", cfg="rpass2")] -pub fn use_X(x: X) -> u32 { +pub fn use_x(x: X) -> u32 { x.x as u32 } #[rustc_clean(except="typeck_root", cfg="rpass2")] -pub fn use_EmbedX(embed: EmbedX) -> u32 { +pub fn use_embed_x(embed: EmbedX) -> u32 { embed.x.x as u32 } #[rustc_clean(cfg="rpass2")] -pub fn use_Y() { +pub fn use_y() { let x: Y = Y { y: 'c' }; } diff --git a/tests/incremental/type_alias_cross_crate/b.rs b/tests/incremental/type_alias_cross_crate/b.rs index 095312c6cfe8..25e988b0a1ea 100644 --- a/tests/incremental/type_alias_cross_crate/b.rs +++ b/tests/incremental/type_alias_cross_crate/b.rs @@ -9,14 +9,14 @@ extern crate a; #[rustc_clean(except="typeck_root", cfg="rpass2")] #[rustc_clean(cfg="rpass3")] -pub fn use_X() -> u32 { +pub fn use_x() -> u32 { let x: a::X = 22; x as u32 } #[rustc_clean(cfg="rpass2")] #[rustc_clean(cfg="rpass3")] -pub fn use_Y() { +pub fn use_y() { let x: a::Y = 'c'; }