From 19273b7fcf437050c9670ee86d0bb0c8ff2b3c4f Mon Sep 17 00:00:00 2001 From: mu001999 Date: Thu, 5 Feb 2026 23:16:43 +0800 Subject: [PATCH 1/5] Report unused features --- compiler/rustc_feature/src/builtin_attrs.rs | 2 +- compiler/rustc_feature/src/lib.rs | 2 +- compiler/rustc_feature/src/unstable.rs | 8 ++- compiler/rustc_interface/src/callbacks.rs | 27 ++++++++- compiler/rustc_lint_defs/src/builtin.rs | 5 -- compiler/rustc_middle/src/dep_graph/graph.rs | 60 +++++++++++++------ compiler/rustc_middle/src/ty/context.rs | 39 +++++++++++- .../rustc_query_impl/src/dep_kind_vtables.rs | 2 +- compiler/rustc_session/src/session.rs | 3 + 9 files changed, 119 insertions(+), 29 deletions(-) diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index db8f459ef0451..db6e9298e235e 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -1330,7 +1330,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ safety: AttributeSafety::Normal, template: template!(NameValueStr: "name"), duplicates: ErrorFollowing, - gate: Gated{ + gate: Gated { feature: sym::rustc_attrs, message: "use of an internal attribute", check: Features::rustc_attrs, diff --git a/compiler/rustc_feature/src/lib.rs b/compiler/rustc_feature/src/lib.rs index 619726f0d5d8f..9d046bdef1cf3 100644 --- a/compiler/rustc_feature/src/lib.rs +++ b/compiler/rustc_feature/src/lib.rs @@ -137,5 +137,5 @@ pub use builtin_attrs::{ pub use removed::REMOVED_LANG_FEATURES; pub use unstable::{ DEPENDENT_FEATURES, EnabledLangFeature, EnabledLibFeature, Features, INCOMPATIBLE_FEATURES, - UNSTABLE_LANG_FEATURES, + TRACK_FEATURE, UNSTABLE_LANG_FEATURES, }; diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 5becbac186766..09910df3ded43 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -3,11 +3,16 @@ use std::path::PathBuf; use std::time::{SystemTime, UNIX_EPOCH}; +use rustc_data_structures::AtomicRef; use rustc_data_structures::fx::FxHashSet; use rustc_span::{Span, Symbol, sym}; use super::{Feature, to_nonzero}; +fn default_track_feature(_: Symbol) {} + +pub static TRACK_FEATURE: AtomicRef = AtomicRef::new(&(default_track_feature as _)); + #[derive(PartialEq)] enum FeatureStatus { Default, @@ -103,6 +108,7 @@ impl Features { /// Is the given feature enabled (via `#[feature(...)]`)? pub fn enabled(&self, feature: Symbol) -> bool { + TRACK_FEATURE(feature); self.enabled_features.contains(&feature) } } @@ -124,7 +130,7 @@ macro_rules! declare_features { impl Features { $( pub fn $feature(&self) -> bool { - self.enabled_features.contains(&sym::$feature) + self.enabled(sym::$feature) } )* diff --git a/compiler/rustc_interface/src/callbacks.rs b/compiler/rustc_interface/src/callbacks.rs index 4a1da0f50cc23..b5be2abb2fc11 100644 --- a/compiler/rustc_interface/src/callbacks.rs +++ b/compiler/rustc_interface/src/callbacks.rs @@ -12,8 +12,9 @@ use std::fmt; use rustc_errors::DiagInner; -use rustc_middle::dep_graph::TaskDepsRef; +use rustc_middle::dep_graph::{DepNodeIndex, QuerySideEffect, TaskDepsRef}; use rustc_middle::ty::tls; +use rustc_span::Symbol; fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) { tls::with_context_opt(|icx| { @@ -51,6 +52,29 @@ fn track_diagnostic(diagnostic: DiagInner, f: &mut dyn FnMut(DiagInner) -> R) }) } +fn track_feature(feature: Symbol) { + tls::with_context_opt(|icx| { + let Some(icx) = icx else { + return; + }; + let tcx = icx.tcx; + + if !tcx.sess.is_nightly_build() { + return; + } + + if let Some(Some(dep_node_index)) = tcx.sess.used_features.lock().get(&feature).copied() { + tcx.dep_graph.read_index(DepNodeIndex::from_u32(dep_node_index)); + } else { + let dep_node_index = tcx + .dep_graph + .encode_side_effect(tcx, QuerySideEffect::CheckFeature { symbol: feature }); + tcx.sess.used_features.lock().insert(feature, Some(dep_node_index.as_u32())); + tcx.dep_graph.read_index(dep_node_index); + } + }) +} + /// This is a callback from `rustc_hir` as it cannot access the implicit state /// in `rustc_middle` otherwise. fn def_id_debug(def_id: rustc_hir::def_id::DefId, f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -70,4 +94,5 @@ pub fn setup_callbacks() { rustc_span::SPAN_TRACK.swap(&(track_span_parent as fn(_))); rustc_hir::def_id::DEF_ID_DEBUG.swap(&(def_id_debug as fn(_, &mut fmt::Formatter<'_>) -> _)); rustc_errors::TRACK_DIAGNOSTIC.swap(&(track_diagnostic as _)); + rustc_feature::TRACK_FEATURE.swap(&(track_feature as _)); } diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 2bec9273d38f6..2318d23e65f93 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -1089,11 +1089,6 @@ declare_lint! { /// crate-level [`feature` attributes]. /// /// [`feature` attributes]: https://doc.rust-lang.org/nightly/unstable-book/ - /// - /// Note: This lint is currently not functional, see [issue #44232] for - /// more details. - /// - /// [issue #44232]: https://github.com/rust-lang/rust/issues/44232 pub UNUSED_FEATURES, Warn, "unused features found in crate-level `#[feature]` directives" diff --git a/compiler/rustc_middle/src/dep_graph/graph.rs b/compiler/rustc_middle/src/dep_graph/graph.rs index f5787716a94e0..a8bb19e6d6c1a 100644 --- a/compiler/rustc_middle/src/dep_graph/graph.rs +++ b/compiler/rustc_middle/src/dep_graph/graph.rs @@ -17,6 +17,7 @@ use rustc_index::IndexVec; use rustc_macros::{Decodable, Encodable}; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder}; use rustc_session::Session; +use rustc_span::Symbol; use tracing::{debug, instrument}; #[cfg(debug_assertions)] use {super::debug::EdgeFilter, std::env}; @@ -45,6 +46,11 @@ pub enum QuerySideEffect { /// the query as green, as that query will have the side /// effect dep node as a dependency. Diagnostic(DiagInner), + /// Records the feature used during query execution. + /// This feature will be inserted into `sess.used_features` + /// if we mark the query as green, as that query will have + /// the side effect dep node as a dependency. + CheckFeature { symbol: Symbol }, } #[derive(Clone)] pub struct DepGraph { @@ -514,29 +520,40 @@ impl DepGraph { } } - /// This encodes a diagnostic by creating a node with an unique index and associating - /// `diagnostic` with it, for use in the next session. + /// This encodes a side effect by creating a node with an unique index and associating + /// it with the node, for use in the next session. #[inline] pub fn record_diagnostic<'tcx>(&self, tcx: TyCtxt<'tcx>, diagnostic: &DiagInner) { if let Some(ref data) = self.data { read_deps(|task_deps| match task_deps { TaskDepsRef::EvalAlways | TaskDepsRef::Ignore => return, TaskDepsRef::Forbid | TaskDepsRef::Allow(..) => { - self.read_index(data.encode_diagnostic(tcx, diagnostic)); + let dep_node_index = data + .encode_side_effect(tcx, QuerySideEffect::Diagnostic(diagnostic.clone())); + self.read_index(dep_node_index); } }) } } - /// This forces a diagnostic node green by running its side effect. `prev_index` would - /// refer to a node created used `encode_diagnostic` in the previous session. + /// This forces a side effect node green by running its side effect. `prev_index` would + /// refer to a node created used `encode_side_effect` in the previous session. #[inline] - pub fn force_diagnostic_node<'tcx>( + pub fn force_side_effect<'tcx>(&self, tcx: TyCtxt<'tcx>, prev_index: SerializedDepNodeIndex) { + if let Some(ref data) = self.data { + data.force_side_effect(tcx, prev_index); + } + } + + #[inline] + pub fn encode_side_effect<'tcx>( &self, tcx: TyCtxt<'tcx>, - prev_index: SerializedDepNodeIndex, - ) { + side_effect: QuerySideEffect, + ) -> DepNodeIndex { if let Some(ref data) = self.data { - data.force_diagnostic_node(tcx, prev_index); + data.encode_side_effect(tcx, side_effect) + } else { + self.next_virtual_depnode_index() } } @@ -673,10 +690,14 @@ impl DepGraphData { self.debug_loaded_from_disk.lock().insert(dep_node); } - /// This encodes a diagnostic by creating a node with an unique index and associating - /// `diagnostic` with it, for use in the next session. + /// This encodes a side effect by creating a node with an unique index and associating + /// it with the node, for use in the next session. #[inline] - fn encode_diagnostic<'tcx>(&self, tcx: TyCtxt<'tcx>, diagnostic: &DiagInner) -> DepNodeIndex { + fn encode_side_effect<'tcx>( + &self, + tcx: TyCtxt<'tcx>, + side_effect: QuerySideEffect, + ) -> DepNodeIndex { // Use `send_new` so we get an unique index, even though the dep node is not. let dep_node_index = self.current.encoder.send_new( DepNode { @@ -684,19 +705,18 @@ impl DepGraphData { key_fingerprint: PackedFingerprint::from(Fingerprint::ZERO), }, Fingerprint::ZERO, - // We want the side effect node to always be red so it will be forced and emit the - // diagnostic. + // We want the side effect node to always be red so it will be forced and run the + // side effect. std::iter::once(DepNodeIndex::FOREVER_RED_NODE).collect(), ); - let side_effect = QuerySideEffect::Diagnostic(diagnostic.clone()); tcx.store_side_effect(dep_node_index, side_effect); dep_node_index } - /// This forces a diagnostic node green by running its side effect. `prev_index` would - /// refer to a node created used `encode_diagnostic` in the previous session. + /// This forces a side effect node green by running its side effect. `prev_index` would + /// refer to a node created used `encode_side_effect` in the previous session. #[inline] - fn force_diagnostic_node<'tcx>(&self, tcx: TyCtxt<'tcx>, prev_index: SerializedDepNodeIndex) { + fn force_side_effect<'tcx>(&self, tcx: TyCtxt<'tcx>, prev_index: SerializedDepNodeIndex) { with_deps(TaskDepsRef::Ignore, || { let side_effect = tcx.load_side_effect(prev_index).unwrap(); @@ -704,6 +724,7 @@ impl DepGraphData { QuerySideEffect::Diagnostic(diagnostic) => { tcx.dcx().emit_diagnostic(diagnostic.clone()); } + QuerySideEffect::CheckFeature { .. } => {} } // Use `send_and_color` as `promote_node_and_deps_to_current` expects all @@ -720,6 +741,9 @@ impl DepGraphData { std::iter::once(DepNodeIndex::FOREVER_RED_NODE).collect(), true, ); + if let QuerySideEffect::CheckFeature { symbol } = &side_effect { + tcx.sess.used_features.lock().insert(*symbol, Some(dep_node_index.as_u32())); + } // This will just overwrite the same value for concurrent calls. tcx.store_side_effect(dep_node_index, side_effect); }) diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 94a77ce13c14a..bd68044443adf 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -37,7 +37,7 @@ use rustc_hir::definitions::{DefPathData, Definitions, DisambiguatorState}; use rustc_hir::intravisit::VisitorExt; use rustc_hir::lang_items::LangItem; use rustc_hir::limit::Limit; -use rustc_hir::{self as hir, HirId, Node, TraitCandidate, find_attr}; +use rustc_hir::{self as hir, CRATE_HIR_ID, HirId, Node, TraitCandidate, find_attr}; use rustc_index::IndexVec; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder}; use rustc_session::Session; @@ -1683,10 +1683,47 @@ impl<'tcx> TyCtxt<'tcx> { self.save_dep_graph(); self.query_key_hash_verify_all(); + self.report_unused_features(); + if let Err((path, error)) = self.dep_graph.finish_encoding() { self.sess.dcx().emit_fatal(crate::error::FailedWritingFile { path: &path, error }); } } + + fn report_unused_features(self) { + if !self.sess.is_nightly_build() { + return; + } + + // Collect first to avoid holding the lock while linting. + let unused_features = { + let used_features = self.sess.used_features.lock(); + self.features() + .enabled_features_iter_stable_order() + .filter(|(f, _)| { + !used_features.contains_key(f) + // FIXME: `restricted_std` is used to tell a standard library built + // for a platform that it doesn't know how to support. But it + // could only gate a private mod (see `__restricted_std_workaround`) + // with `cfg(not(restricted_std))`, so it cannot be recorded as used + // in downstream crates. It should never be linted, but should we + // hack this in the linter to ignore it? + && f.as_str() != "restricted_std" + }) + .collect::>() + }; + + for (feature, span) in unused_features { + self.node_span_lint( + rustc_session::lint::builtin::UNUSED_FEATURES, + CRATE_HIR_ID, + span, + |lint| { + lint.primary_message(format!("feature `{}` is declared but not used", feature)); + }, + ); + } + } } macro_rules! nop_lift { diff --git a/compiler/rustc_query_impl/src/dep_kind_vtables.rs b/compiler/rustc_query_impl/src/dep_kind_vtables.rs index 39bd2569ef468..b9cbe2937a4d4 100644 --- a/compiler/rustc_query_impl/src/dep_kind_vtables.rs +++ b/compiler/rustc_query_impl/src/dep_kind_vtables.rs @@ -44,7 +44,7 @@ mod non_query { is_eval_always: false, key_fingerprint_style: KeyFingerprintStyle::Unit, force_from_dep_node: Some(|tcx, _, prev_index| { - tcx.dep_graph.force_diagnostic_node(tcx, prev_index); + tcx.dep_graph.force_side_effect(tcx, prev_index); true }), try_load_from_on_disk_cache: None, diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 427f3e7fa5089..278e69539b3e0 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -167,6 +167,8 @@ pub struct Session { /// Used by `-Zmir-opt-bisect-limit` to assign an index to each /// optimization-pass execution candidate during this compilation. pub mir_opt_bisect_eval_count: AtomicUsize, + + pub used_features: Lock>>, } #[derive(Clone, Copy)] @@ -1108,6 +1110,7 @@ pub fn build_session( replaced_intrinsics: FxHashSet::default(), // filled by `run_compiler` thin_lto_supported: true, // filled by `run_compiler` mir_opt_bisect_eval_count: AtomicUsize::new(0), + used_features: Lock::default(), }; validate_commandline_args_with_session_available(&sess); From 18fde19596cecce9e31864c1cfdd7bb913cca705 Mon Sep 17 00:00:00 2001 From: mu001999 Date: Thu, 5 Feb 2026 23:22:09 +0800 Subject: [PATCH 2/5] Add tests for unused-features --- .../unused-language-features.rs | 25 ++++++++++++ .../unused-language-features.stderr | 38 +++++++++++++++++++ .../unused-library-features.rs | 13 +++++++ .../unused-library-features.stderr | 34 +++++++++++++++++ .../unused-features/used-language-features.rs | 22 +++++++++++ .../unused-features/used-library-features.rs | 17 +++++++++ 6 files changed, 149 insertions(+) create mode 100644 tests/ui/lint/unused-features/unused-language-features.rs create mode 100644 tests/ui/lint/unused-features/unused-language-features.stderr create mode 100644 tests/ui/lint/unused-features/unused-library-features.rs create mode 100644 tests/ui/lint/unused-features/unused-library-features.stderr create mode 100644 tests/ui/lint/unused-features/used-language-features.rs create mode 100644 tests/ui/lint/unused-features/used-library-features.rs diff --git a/tests/ui/lint/unused-features/unused-language-features.rs b/tests/ui/lint/unused-features/unused-language-features.rs new file mode 100644 index 0000000000000..9334c1df0408a --- /dev/null +++ b/tests/ui/lint/unused-features/unused-language-features.rs @@ -0,0 +1,25 @@ +#![crate_type = "lib"] +#![deny(unused_features)] + +// Unused language features +#![feature(coroutines)] +//~^ ERROR feature `coroutines` is declared but not used +#![feature(coroutine_clone)] +//~^ ERROR feature `coroutine_clone` is declared but not used +#![feature(stmt_expr_attributes)] +//~^ ERROR feature `stmt_expr_attributes` is declared but not used +#![feature(asm_unwind)] +//~^ ERROR feature `asm_unwind` is declared but not used + +// Enabled via cfg_attr, unused +#![cfg_attr(all(), feature(negative_impls))] +//~^ ERROR feature `negative_impls` is declared but not used + +// Not enabled via cfg_attr, so should not warn even if unused +#![cfg_attr(any(), feature(never_type))] + +macro_rules! use_asm_unwind { + () => { + unsafe { std::arch::asm!("", options(may_unwind)) }; + } +} diff --git a/tests/ui/lint/unused-features/unused-language-features.stderr b/tests/ui/lint/unused-features/unused-language-features.stderr new file mode 100644 index 0000000000000..3cede1a6fe726 --- /dev/null +++ b/tests/ui/lint/unused-features/unused-language-features.stderr @@ -0,0 +1,38 @@ +error: feature `coroutines` is declared but not used + --> $DIR/unused-language-features.rs:5:12 + | +LL | #![feature(coroutines)] + | ^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/unused-language-features.rs:2:9 + | +LL | #![deny(unused_features)] + | ^^^^^^^^^^^^^^^ + +error: feature `coroutine_clone` is declared but not used + --> $DIR/unused-language-features.rs:7:12 + | +LL | #![feature(coroutine_clone)] + | ^^^^^^^^^^^^^^^ + +error: feature `stmt_expr_attributes` is declared but not used + --> $DIR/unused-language-features.rs:9:12 + | +LL | #![feature(stmt_expr_attributes)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: feature `asm_unwind` is declared but not used + --> $DIR/unused-language-features.rs:11:12 + | +LL | #![feature(asm_unwind)] + | ^^^^^^^^^^ + +error: feature `negative_impls` is declared but not used + --> $DIR/unused-language-features.rs:15:28 + | +LL | #![cfg_attr(all(), feature(negative_impls))] + | ^^^^^^^^^^^^^^ + +error: aborting due to 5 previous errors + diff --git a/tests/ui/lint/unused-features/unused-library-features.rs b/tests/ui/lint/unused-features/unused-library-features.rs new file mode 100644 index 0000000000000..75afd32e56cb3 --- /dev/null +++ b/tests/ui/lint/unused-features/unused-library-features.rs @@ -0,0 +1,13 @@ +#![crate_type = "lib"] +#![deny(unused_features)] + +// Unused library features +#![feature(step_trait)] +//~^ ERROR feature `step_trait` is declared but not used +#![feature(is_sorted)] +//~^ ERROR feature `is_sorted` is declared but not used +//~^^ WARN the feature `is_sorted` has been stable since 1.82.0 and no longer requires an attribute to enable + +// Enabled via cfg_attr, unused +#![cfg_attr(all(), feature(slice_ptr_get))] +//~^ ERROR feature `slice_ptr_get` is declared but not used diff --git a/tests/ui/lint/unused-features/unused-library-features.stderr b/tests/ui/lint/unused-features/unused-library-features.stderr new file mode 100644 index 0000000000000..e259058d6c33b --- /dev/null +++ b/tests/ui/lint/unused-features/unused-library-features.stderr @@ -0,0 +1,34 @@ +warning: the feature `is_sorted` has been stable since 1.82.0 and no longer requires an attribute to enable + --> $DIR/unused-library-features.rs:7:12 + | +LL | #![feature(is_sorted)] + | ^^^^^^^^^ + | + = note: `#[warn(stable_features)]` on by default + +error: feature `step_trait` is declared but not used + --> $DIR/unused-library-features.rs:5:12 + | +LL | #![feature(step_trait)] + | ^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/unused-library-features.rs:2:9 + | +LL | #![deny(unused_features)] + | ^^^^^^^^^^^^^^^ + +error: feature `is_sorted` is declared but not used + --> $DIR/unused-library-features.rs:7:12 + | +LL | #![feature(is_sorted)] + | ^^^^^^^^^ + +error: feature `slice_ptr_get` is declared but not used + --> $DIR/unused-library-features.rs:12:28 + | +LL | #![cfg_attr(all(), feature(slice_ptr_get))] + | ^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors; 1 warning emitted + diff --git a/tests/ui/lint/unused-features/used-language-features.rs b/tests/ui/lint/unused-features/used-language-features.rs new file mode 100644 index 0000000000000..7da4866a00d15 --- /dev/null +++ b/tests/ui/lint/unused-features/used-language-features.rs @@ -0,0 +1,22 @@ +//@ check-pass + +#![crate_type = "lib"] +#![deny(unused_features)] + +// Used language features +#![feature(box_patterns)] +#![feature(decl_macro)] +#![cfg_attr(all(), feature(rustc_attrs))] + +pub fn use_box_patterns(b: Box) -> i32 { + let box x = b; + x +} + +macro m() {} +pub fn use_decl_macro() { + m!(); +} + +#[rustc_dummy] +pub fn use_rustc_attrs() {} diff --git a/tests/ui/lint/unused-features/used-library-features.rs b/tests/ui/lint/unused-features/used-library-features.rs new file mode 100644 index 0000000000000..1747c7741880e --- /dev/null +++ b/tests/ui/lint/unused-features/used-library-features.rs @@ -0,0 +1,17 @@ +//@ check-pass + +#![crate_type = "lib"] +#![deny(unused_features)] + +// Used library features +#![feature(error_iter)] +#![cfg_attr(all(), feature(allocator_api))] + +pub fn use_error_iter(e: &(dyn std::error::Error + 'static)) { + for _ in e.sources() {} +} + +pub fn use_allocator_api() { + use std::alloc::Global; + let _ = Vec::::new_in(Global); +} From 39e5f06098ee3a9d74c0c0db34489acf58dc6e25 Mon Sep 17 00:00:00 2001 From: mu001999 Date: Thu, 12 Feb 2026 11:35:58 +0800 Subject: [PATCH 3/5] Allow unused features in tools --- src/tools/miri/src/lib.rs | 2 ++ src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs | 2 +- src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index 232a24306d65e..bce69d0392682 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -41,6 +41,8 @@ clippy::len_zero, // We are not implementing queries here so it's fine rustc::potential_query_instability, + // FIXME: Unused features should be removed in the future + unused_features, )] #![warn( rust_2018_idioms, diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs index 68b3afc3e8414..e83ddb859498b 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs +++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs @@ -10,7 +10,7 @@ feature = "sysroot-abi", feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span) )] -#![allow(internal_features)] +#![allow(internal_features, unused_features)] #![cfg_attr(feature = "in-rust-tree", feature(rustc_private))] #[cfg(feature = "in-rust-tree")] diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs index c548dc620ad13..1c3b63a113042 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs +++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs @@ -18,7 +18,8 @@ internal_features, clippy::disallowed_types, clippy::print_stderr, - unused_crate_dependencies + unused_crate_dependencies, + unused_features )] #![deny(deprecated_safe, clippy::undocumented_unsafe_blocks)] From 20334d14ec7dd79b3c085cfa709a6fbaba3b6ab6 Mon Sep 17 00:00:00 2001 From: mu001999 Date: Fri, 20 Feb 2026 13:49:53 +0800 Subject: [PATCH 4/5] Allow unused_features in tests --- .../struct_point.rs | 1 + .../change_add_field/struct_point.rs | 1 + tests/incremental/change_crate_dep_kind.rs | 1 + .../change_private_fn/struct_point.rs | 1 + .../change_private_fn_cc/struct_point.rs | 1 + .../struct_point.rs | 1 + .../struct_point.rs | 1 + .../struct_point.rs | 1 + .../struct_point.rs | 1 + tests/ui-fulldeps/rustc_public/check_abi.rs | 1 + .../rustc_public/check_assoc_items.rs | 1 + .../rustc_public/check_coroutine_body.rs | 1 + .../rustc_public/check_crate_defs.rs | 1 + .../ui-fulldeps/rustc_public/check_def_ty.rs | 1 + .../rustc_public/check_instance.rs | 1 + .../rustc_public/check_item_kind.rs | 1 + .../rustc_public/check_trait_queries.rs | 1 + .../rustc_public/check_transform.rs | 1 + .../ui-fulldeps/rustc_public/check_ty_fold.rs | 1 + .../ui-fulldeps/rustc_public/check_variant.rs | 1 + .../rustc_public/closure-generic-body.rs | 1 + .../ui-fulldeps/rustc_public/closure_body.rs | 1 + .../rustc_public/compilation-result.rs | 1 + .../ui-fulldeps/rustc_public/smir_internal.rs | 1 + tests/ui-fulldeps/rustc_public/smir_serde.rs | 1 + .../ui-fulldeps/rustc_public/smir_visitor.rs | 1 + tests/ui/allocator/xcrate-use2.rs | 1 + .../associated-types-impl-redirect.rs | 1 + ...iated-types-where-clause-impl-ambiguity.rs | 1 + .../async-drop/async-drop-initial.rs | 1 + tests/ui/backtrace/line-tables-only.rs | 1 + ...uper-let-lifetime-and-drop.borrowck.stderr | 26 ++++---- .../borrowck/super-let-lifetime-and-drop.rs | 1 + tests/ui/cfg/cfg_stmt_expr.rs | 1 + tests/ui/const-generics/transmute.rs | 1 + tests/ui/consts/const-fn-type-name.rs | 1 + tests/ui/consts/const-ptr-nonnull-rpass.rs | 1 + tests/ui/consts/try-operator.rs | 1 + .../internal_machinery/lowering/basics.rs | 1 + tests/ui/coroutine/control-flow.rs | 1 + .../missing_coroutine_attr_suggestion.fixed | 1 + .../missing_coroutine_attr_suggestion.rs | 1 + .../missing_coroutine_attr_suggestion.stderr | 2 +- tests/ui/coroutine/non-static-is-unpin.rs | 1 + tests/ui/coroutine/other-attribute-on-gen.rs | 1 + tests/ui/coroutine/pin-box-coroutine.rs | 1 + tests/ui/coroutine/xcrate.rs | 1 + tests/ui/eii/default/call_default.rs | 1 + tests/ui/eii/default/call_default_panics.rs | 1 + tests/ui/eii/default/call_impl.rs | 1 + tests/ui/eii/linking/codegen_cross_crate.rs | 1 + tests/ui/eii/privacy1.rs | 1 + tests/ui/extern/extern-prelude-core.rs | 1 + ...re-gate-explicit-extern-abis.current.fixed | 1 + ...e-gate-explicit-extern-abis.current.stderr | 6 +- ...explicit-extern-abis.current_feature.fixed | 1 + ...xplicit-extern-abis.current_feature.stderr | 6 +- ...ure-gate-explicit-extern-abis.future.fixed | 1 + ...re-gate-explicit-extern-abis.future.stderr | 6 +- ...explicit-extern-abis.future_feature.stderr | 6 +- .../feature-gate-explicit-extern-abis.rs | 1 + tests/ui/float/classify-runtime-const.rs | 1 + tests/ui/float/conv-bits-runtime-const.rs | 1 + tests/ui/fmt/format-macro-no-std.rs | 1 + .../half-open-range-pats-semantics.rs | 1 + tests/ui/hygiene/xcrate.rs | 1 + tests/ui/impl-trait/example-calendar.rs | 1 + tests/ui/intrinsics/intrinsic-alignment.rs | 1 + tests/ui/io-checks/write-macro-error.rs | 1 + .../linkage-attr/raw-dylib/elf/as_needed.rs | 1 + .../lint-expr-stmt-attrs-for-early-lints.rs | 1 + tests/ui/lint/lint-unknown-feature.rs | 1 + ...necessary-qualification-issue-121331.fixed | 1 + ...-unnecessary-qualification-issue-121331.rs | 1 + ...ecessary-qualification-issue-121331.stderr | 4 +- .../unused/unused_attributes-must_use.fixed | 1 + .../lint/unused/unused_attributes-must_use.rs | 1 + .../unused/unused_attributes-must_use.stderr | 62 +++++++++---------- tests/ui/lowering/issue-96847.rs | 1 + tests/ui/lowering/issue-96847.stderr | 2 +- .../metavar_cross_edition_recursive_macros.rs | 1 + .../all-expr-kinds.rs | 1 + .../all-not-available-cases.rs | 1 + ...errors-does-not-create-unnecessary-code.rs | 1 + ...ptures-does-not-create-unnecessary-code.rs | 1 + .../feature-gate-generic_assert.rs | 1 + tests/ui/macros/stringify.rs | 1 + tests/ui/match/match-float.rs | 1 + .../supertrait-shadowing/out-of-scope.rs | 1 + tests/ui/nll/issue-48623-coroutine.rs | 1 + tests/ui/nll/issue-48623-coroutine.stderr | 2 +- .../ui/overloaded/overloaded-calls-simple.rs | 1 + tests/ui/sanitizer/memory-passing.rs | 1 + .../monomorphize-shuffle-index.generic.stderr | 2 +- tests/ui/simd/monomorphize-shuffle-index.rs | 1 + tests/ui/simd/target-feature-mixup.rs | 1 + tests/ui/structs-enums/rec-align-u32.rs | 1 + tests/ui/structs-enums/rec-align-u64.rs | 1 + tests/ui/traits/alias/import-cross-crate.rs | 1 + .../overlap-permitted-for-marker-traits.rs | 1 + tests/ui/type/typeid-consistency.rs | 1 + .../typeck/type-name-intrinsic-usage-61894.rs | 1 + 102 files changed, 153 insertions(+), 62 deletions(-) diff --git a/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs b/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs index 0367af8d53b8d..ef02b2165576e 100644 --- a/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs +++ b/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs @@ -11,6 +11,7 @@ #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] #![allow(dead_code)] +#![allow(unused_features)] #![crate_type = "rlib"] #![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="cfail2")] diff --git a/tests/incremental/change_add_field/struct_point.rs b/tests/incremental/change_add_field/struct_point.rs index fb363c9ce496f..6c39b502df0f4 100644 --- a/tests/incremental/change_add_field/struct_point.rs +++ b/tests/incremental/change_add_field/struct_point.rs @@ -11,6 +11,7 @@ #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] #![allow(dead_code)] +#![allow(unused_features)] #![crate_type = "rlib"] // These are expected to require codegen. diff --git a/tests/incremental/change_crate_dep_kind.rs b/tests/incremental/change_crate_dep_kind.rs index 4fd0c345aad21..815fcdea6c746 100644 --- a/tests/incremental/change_crate_dep_kind.rs +++ b/tests/incremental/change_crate_dep_kind.rs @@ -8,6 +8,7 @@ //@ build-pass (FIXME(62277): could be check-pass?) //@ ignore-backends: gcc +#![allow(unused_features)] #![feature(panic_unwind)] // Turn the panic_unwind crate from an explicit into an implicit query: diff --git a/tests/incremental/change_private_fn/struct_point.rs b/tests/incremental/change_private_fn/struct_point.rs index cce26fa7a3e6e..2fcc144a9cfa6 100644 --- a/tests/incremental/change_private_fn/struct_point.rs +++ b/tests/incremental/change_private_fn/struct_point.rs @@ -9,6 +9,7 @@ #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] #![allow(dead_code)] +#![allow(unused_features)] #![crate_type = "rlib"] #![rustc_partition_codegened(module="struct_point-point", cfg="cfail2")] diff --git a/tests/incremental/change_private_fn_cc/struct_point.rs b/tests/incremental/change_private_fn_cc/struct_point.rs index 87392ca857ed7..3e4c7515ceedd 100644 --- a/tests/incremental/change_private_fn_cc/struct_point.rs +++ b/tests/incremental/change_private_fn_cc/struct_point.rs @@ -11,6 +11,7 @@ #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] #![allow(dead_code)] +#![allow(unused_features)] #![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="cfail2")] #![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="cfail2")] diff --git a/tests/incremental/change_private_impl_method/struct_point.rs b/tests/incremental/change_private_impl_method/struct_point.rs index dc0ba82c0a311..a85672b5e1029 100644 --- a/tests/incremental/change_private_impl_method/struct_point.rs +++ b/tests/incremental/change_private_impl_method/struct_point.rs @@ -9,6 +9,7 @@ #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] #![allow(dead_code)] +#![allow(unused_features)] #![crate_type = "rlib"] #![rustc_partition_codegened(module="struct_point-point", cfg="cfail2")] diff --git a/tests/incremental/change_private_impl_method_cc/struct_point.rs b/tests/incremental/change_private_impl_method_cc/struct_point.rs index eb51af7209495..00a641c17e00f 100644 --- a/tests/incremental/change_private_impl_method_cc/struct_point.rs +++ b/tests/incremental/change_private_impl_method_cc/struct_point.rs @@ -11,6 +11,7 @@ #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] #![allow(dead_code)] +#![allow(unused_features)] #![rustc_partition_reused(module="struct_point-fn_read_field", cfg="cfail2")] #![rustc_partition_reused(module="struct_point-fn_write_field", cfg="cfail2")] diff --git a/tests/incremental/change_pub_inherent_method_body/struct_point.rs b/tests/incremental/change_pub_inherent_method_body/struct_point.rs index b8e06d070a3c7..8a1358b2ebc86 100644 --- a/tests/incremental/change_pub_inherent_method_body/struct_point.rs +++ b/tests/incremental/change_pub_inherent_method_body/struct_point.rs @@ -9,6 +9,7 @@ #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] #![allow(dead_code)] +#![allow(unused_features)] #![rustc_partition_codegened(module="struct_point-point", cfg="cfail2")] diff --git a/tests/incremental/change_pub_inherent_method_sig/struct_point.rs b/tests/incremental/change_pub_inherent_method_sig/struct_point.rs index 3672ec268010e..981ce9872b7ae 100644 --- a/tests/incremental/change_pub_inherent_method_sig/struct_point.rs +++ b/tests/incremental/change_pub_inherent_method_sig/struct_point.rs @@ -9,6 +9,7 @@ #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] #![allow(dead_code)] +#![allow(unused_features)] // These are expected to require codegen. #![rustc_partition_codegened(module="struct_point-point", cfg="cfail2")] diff --git a/tests/ui-fulldeps/rustc_public/check_abi.rs b/tests/ui-fulldeps/rustc_public/check_abi.rs index 8e97b773db567..3733471fcbc97 100644 --- a/tests/ui-fulldeps/rustc_public/check_abi.rs +++ b/tests/ui-fulldeps/rustc_public/check_abi.rs @@ -5,6 +5,7 @@ //@ ignore-cross-compile //@ ignore-remote +#![allow(unused_features)] #![feature(rustc_private)] #![feature(ascii_char, ascii_char_variants)] diff --git a/tests/ui-fulldeps/rustc_public/check_assoc_items.rs b/tests/ui-fulldeps/rustc_public/check_assoc_items.rs index ee0efd083588a..a1865225308c0 100644 --- a/tests/ui-fulldeps/rustc_public/check_assoc_items.rs +++ b/tests/ui-fulldeps/rustc_public/check_assoc_items.rs @@ -7,6 +7,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui-fulldeps/rustc_public/check_coroutine_body.rs b/tests/ui-fulldeps/rustc_public/check_coroutine_body.rs index f988452fd52ba..b889858fa4e6d 100644 --- a/tests/ui-fulldeps/rustc_public/check_coroutine_body.rs +++ b/tests/ui-fulldeps/rustc_public/check_coroutine_body.rs @@ -6,6 +6,7 @@ //@ ignore-remote //@ edition: 2024 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui-fulldeps/rustc_public/check_crate_defs.rs b/tests/ui-fulldeps/rustc_public/check_crate_defs.rs index 2b6a2ff8199ce..d2215abdc9748 100644 --- a/tests/ui-fulldeps/rustc_public/check_crate_defs.rs +++ b/tests/ui-fulldeps/rustc_public/check_crate_defs.rs @@ -5,6 +5,7 @@ //@ ignore-cross-compile //@ ignore-remote +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_hir; diff --git a/tests/ui-fulldeps/rustc_public/check_def_ty.rs b/tests/ui-fulldeps/rustc_public/check_def_ty.rs index 19ea731834b70..30104a71c7dfd 100644 --- a/tests/ui-fulldeps/rustc_public/check_def_ty.rs +++ b/tests/ui-fulldeps/rustc_public/check_def_ty.rs @@ -7,6 +7,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui-fulldeps/rustc_public/check_instance.rs b/tests/ui-fulldeps/rustc_public/check_instance.rs index defea9d2f54bb..e2d11f92d4d86 100644 --- a/tests/ui-fulldeps/rustc_public/check_instance.rs +++ b/tests/ui-fulldeps/rustc_public/check_instance.rs @@ -6,6 +6,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui-fulldeps/rustc_public/check_item_kind.rs b/tests/ui-fulldeps/rustc_public/check_item_kind.rs index b75ac70d86e3c..c3f06b159b9fe 100644 --- a/tests/ui-fulldeps/rustc_public/check_item_kind.rs +++ b/tests/ui-fulldeps/rustc_public/check_item_kind.rs @@ -6,6 +6,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui-fulldeps/rustc_public/check_trait_queries.rs b/tests/ui-fulldeps/rustc_public/check_trait_queries.rs index 44b7275a3df60..82552565cfe95 100644 --- a/tests/ui-fulldeps/rustc_public/check_trait_queries.rs +++ b/tests/ui-fulldeps/rustc_public/check_trait_queries.rs @@ -6,6 +6,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui-fulldeps/rustc_public/check_transform.rs b/tests/ui-fulldeps/rustc_public/check_transform.rs index f8aa40e474468..5444429f79d24 100644 --- a/tests/ui-fulldeps/rustc_public/check_transform.rs +++ b/tests/ui-fulldeps/rustc_public/check_transform.rs @@ -5,6 +5,7 @@ //@ ignore-cross-compile //@ ignore-remote +#![allow(unused_features)] #![feature(rustc_private)] #![feature(ascii_char, ascii_char_variants)] diff --git a/tests/ui-fulldeps/rustc_public/check_ty_fold.rs b/tests/ui-fulldeps/rustc_public/check_ty_fold.rs index 9ac7f14570e57..03d0992febeb1 100644 --- a/tests/ui-fulldeps/rustc_public/check_ty_fold.rs +++ b/tests/ui-fulldeps/rustc_public/check_ty_fold.rs @@ -7,6 +7,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui-fulldeps/rustc_public/check_variant.rs b/tests/ui-fulldeps/rustc_public/check_variant.rs index 54ae8b8f83b97..6845631f79bf7 100644 --- a/tests/ui-fulldeps/rustc_public/check_variant.rs +++ b/tests/ui-fulldeps/rustc_public/check_variant.rs @@ -7,6 +7,7 @@ //@ ignore-remote //@ edition: 2024 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui-fulldeps/rustc_public/closure-generic-body.rs b/tests/ui-fulldeps/rustc_public/closure-generic-body.rs index a328bc396c544..284b9202600f6 100644 --- a/tests/ui-fulldeps/rustc_public/closure-generic-body.rs +++ b/tests/ui-fulldeps/rustc_public/closure-generic-body.rs @@ -6,6 +6,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui-fulldeps/rustc_public/closure_body.rs b/tests/ui-fulldeps/rustc_public/closure_body.rs index 880d7dde34b68..04c2d5bf79f00 100644 --- a/tests/ui-fulldeps/rustc_public/closure_body.rs +++ b/tests/ui-fulldeps/rustc_public/closure_body.rs @@ -6,6 +6,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui-fulldeps/rustc_public/compilation-result.rs b/tests/ui-fulldeps/rustc_public/compilation-result.rs index 351ca2c8295f4..758731e063e3b 100644 --- a/tests/ui-fulldeps/rustc_public/compilation-result.rs +++ b/tests/ui-fulldeps/rustc_public/compilation-result.rs @@ -6,6 +6,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui-fulldeps/rustc_public/smir_internal.rs b/tests/ui-fulldeps/rustc_public/smir_internal.rs index 98335da19dbde..12bf49ed5c8a4 100644 --- a/tests/ui-fulldeps/rustc_public/smir_internal.rs +++ b/tests/ui-fulldeps/rustc_public/smir_internal.rs @@ -7,6 +7,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_driver; diff --git a/tests/ui-fulldeps/rustc_public/smir_serde.rs b/tests/ui-fulldeps/rustc_public/smir_serde.rs index 6a345023de171..3afaf40a6026b 100644 --- a/tests/ui-fulldeps/rustc_public/smir_serde.rs +++ b/tests/ui-fulldeps/rustc_public/smir_serde.rs @@ -6,6 +6,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/rustc_public/smir_visitor.rs b/tests/ui-fulldeps/rustc_public/smir_visitor.rs index 1ea2ab6f560ff..6ee76fb9c3101 100644 --- a/tests/ui-fulldeps/rustc_public/smir_visitor.rs +++ b/tests/ui-fulldeps/rustc_public/smir_visitor.rs @@ -6,6 +6,7 @@ //@ ignore-remote //@ edition: 2021 +#![allow(unused_features)] #![feature(rustc_private)] extern crate rustc_middle; diff --git a/tests/ui/allocator/xcrate-use2.rs b/tests/ui/allocator/xcrate-use2.rs index a48b0beeb07e3..d7758a2820ef2 100644 --- a/tests/ui/allocator/xcrate-use2.rs +++ b/tests/ui/allocator/xcrate-use2.rs @@ -5,6 +5,7 @@ //@ aux-build:helper.rs //@ no-prefer-dynamic +#![allow(unused_features)] #![feature(allocator_api)] extern crate custom; diff --git a/tests/ui/associated-types/associated-types-impl-redirect.rs b/tests/ui/associated-types/associated-types-impl-redirect.rs index 64cae31e5693b..0cc2a9611b6cb 100644 --- a/tests/ui/associated-types/associated-types-impl-redirect.rs +++ b/tests/ui/associated-types/associated-types-impl-redirect.rs @@ -3,6 +3,7 @@ #![allow(dead_code)] #![allow(unused_mut)] #![allow(unused_imports)] +#![allow(unused_features)] // Test how resolving a projection interacts with inference. In this // case, we were eagerly unifying the type variable for the iterator // type with `I` from the where clause, ignoring the in-scope `impl` diff --git a/tests/ui/associated-types/associated-types-where-clause-impl-ambiguity.rs b/tests/ui/associated-types/associated-types-where-clause-impl-ambiguity.rs index 0de7617943c65..c01e85955bdd1 100644 --- a/tests/ui/associated-types/associated-types-where-clause-impl-ambiguity.rs +++ b/tests/ui/associated-types/associated-types-where-clause-impl-ambiguity.rs @@ -2,6 +2,7 @@ //@ run-pass #![allow(dead_code)] #![allow(unused_imports)] +#![allow(unused_features)] // Test how resolving a projection interacts with inference. In this // case, we were eagerly unifying the type variable for the iterator // type with `I` from the where clause, ignoring the in-scope `impl` diff --git a/tests/ui/async-await/async-drop/async-drop-initial.rs b/tests/ui/async-await/async-drop/async-drop-initial.rs index cd33c143fba01..0bab10e12fcef 100644 --- a/tests/ui/async-await/async-drop/async-drop-initial.rs +++ b/tests/ui/async-await/async-drop/async-drop-initial.rs @@ -7,6 +7,7 @@ #![feature(async_drop, impl_trait_in_assoc_type)] #![allow(incomplete_features, dead_code)] +#![allow(unused_features)] //@ edition: 2021 diff --git a/tests/ui/backtrace/line-tables-only.rs b/tests/ui/backtrace/line-tables-only.rs index 7dac41119a324..d9439f277f88a 100644 --- a/tests/ui/backtrace/line-tables-only.rs +++ b/tests/ui/backtrace/line-tables-only.rs @@ -19,6 +19,7 @@ //@ aux-build: line-tables-only-helper.rs #![feature(backtrace_frames)] +#![allow(unused_features)] extern crate line_tables_only_helper; diff --git a/tests/ui/borrowck/super-let-lifetime-and-drop.borrowck.stderr b/tests/ui/borrowck/super-let-lifetime-and-drop.borrowck.stderr index 7fe0b47ed5741..47142bac1abec 100644 --- a/tests/ui/borrowck/super-let-lifetime-and-drop.borrowck.stderr +++ b/tests/ui/borrowck/super-let-lifetime-and-drop.borrowck.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:30:28 + --> $DIR/super-let-lifetime-and-drop.rs:31:28 | LL | super let b = DropMe(&mut x); | ------ `x` is borrowed here @@ -11,7 +11,7 @@ LL | } | - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:46:28 + --> $DIR/super-let-lifetime-and-drop.rs:47:28 | LL | super let b = &DropMe(&mut x); | -------------- @@ -26,7 +26,7 @@ LL | } | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:64:32 + --> $DIR/super-let-lifetime-and-drop.rs:65:32 | LL | super let b = identity(&DropMe(&mut x)); | -------------- @@ -40,7 +40,7 @@ LL | }; | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:87:36 + --> $DIR/super-let-lifetime-and-drop.rs:88:36 | LL | super let b = identity(&DropMe(&mut x)); | -------------- @@ -55,7 +55,7 @@ LL | )); | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:107:28 + --> $DIR/super-let-lifetime-and-drop.rs:108:28 | LL | super let b = DropMe(&mut x); | ------ `x` is borrowed here @@ -67,7 +67,7 @@ LL | } | - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:125:28 + --> $DIR/super-let-lifetime-and-drop.rs:126:28 | LL | super let b = DropMe(&mut x); | ------ `x` is borrowed here @@ -79,7 +79,7 @@ LL | } | - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:143:28 + --> $DIR/super-let-lifetime-and-drop.rs:144:28 | LL | super let b = DropMe(&mut x); | ------ `x` is borrowed here @@ -91,7 +91,7 @@ LL | } | - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:159:28 + --> $DIR/super-let-lifetime-and-drop.rs:160:28 | LL | b = DropMe(&mut x); | ------ `x` is borrowed here @@ -102,7 +102,7 @@ LL | drop(a); | - borrow later used here error[E0716]: temporary value dropped while borrowed - --> $DIR/super-let-lifetime-and-drop.rs:172:33 + --> $DIR/super-let-lifetime-and-drop.rs:173:33 | LL | #[cfg(borrowck)] { a = &String::from("asdf"); }; | ^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement @@ -115,7 +115,7 @@ LL | let _ = a; = note: consider using a `let` binding to create a longer lived value error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:206:28 + --> $DIR/super-let-lifetime-and-drop.rs:207:28 | LL | super let d = &DropMe(&mut x); | -------------- @@ -130,7 +130,7 @@ LL | } | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:227:32 + --> $DIR/super-let-lifetime-and-drop.rs:228:32 | LL | super let d = identity(&DropMe(&mut x)); | -------------- @@ -145,7 +145,7 @@ LL | }; | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:246:28 + --> $DIR/super-let-lifetime-and-drop.rs:247:28 | LL | super let b = DropMe(&mut x); | ------ `x` is borrowed here @@ -157,7 +157,7 @@ LL | } | - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/super-let-lifetime-and-drop.rs:263:28 + --> $DIR/super-let-lifetime-and-drop.rs:264:28 | LL | let dropme = Some(DropMe(&mut x)); | ------ `x` is borrowed here diff --git a/tests/ui/borrowck/super-let-lifetime-and-drop.rs b/tests/ui/borrowck/super-let-lifetime-and-drop.rs index 380470f792fe1..61ef59bb6b261 100644 --- a/tests/ui/borrowck/super-let-lifetime-and-drop.rs +++ b/tests/ui/borrowck/super-let-lifetime-and-drop.rs @@ -7,6 +7,7 @@ //@ [borrowck] check-fail #![allow(dropping_references)] +#![allow(unused_features)] #![feature(super_let, stmt_expr_attributes)] use std::convert::identity; diff --git a/tests/ui/cfg/cfg_stmt_expr.rs b/tests/ui/cfg/cfg_stmt_expr.rs index 361b159a354fd..dc4968e08f645 100644 --- a/tests/ui/cfg/cfg_stmt_expr.rs +++ b/tests/ui/cfg/cfg_stmt_expr.rs @@ -2,6 +2,7 @@ #![allow(dead_code)] #![allow(unused_mut)] #![allow(unused_variables)] +#![allow(unused_features)] #![deny(non_snake_case)] #![feature(stmt_expr_attributes)] diff --git a/tests/ui/const-generics/transmute.rs b/tests/ui/const-generics/transmute.rs index e8ab8637932dd..a112fc2c51019 100644 --- a/tests/ui/const-generics/transmute.rs +++ b/tests/ui/const-generics/transmute.rs @@ -2,6 +2,7 @@ #![feature(generic_const_exprs)] #![feature(transmute_generic_consts)] #![allow(incomplete_features)] +#![allow(unused_features)] fn ident(v: [[u32; H]; W]) -> [[u32; H]; W] { unsafe { diff --git a/tests/ui/consts/const-fn-type-name.rs b/tests/ui/consts/const-fn-type-name.rs index 733ab79b7cdb8..583c077f0cebd 100644 --- a/tests/ui/consts/const-fn-type-name.rs +++ b/tests/ui/consts/const-fn-type-name.rs @@ -3,6 +3,7 @@ #![feature(core_intrinsics)] #![feature(const_type_name)] #![allow(dead_code)] +#![allow(unused_features)] const fn type_name_wrapper(_: &T) -> &'static str { const { core::intrinsics::type_name::() } diff --git a/tests/ui/consts/const-ptr-nonnull-rpass.rs b/tests/ui/consts/const-ptr-nonnull-rpass.rs index 48ad72df63091..111bd620ae01a 100644 --- a/tests/ui/consts/const-ptr-nonnull-rpass.rs +++ b/tests/ui/consts/const-ptr-nonnull-rpass.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(unused_features)] #![feature(ptr_internals, test)] diff --git a/tests/ui/consts/try-operator.rs b/tests/ui/consts/try-operator.rs index cd0bf8ea57167..455b284182f2c 100644 --- a/tests/ui/consts/try-operator.rs +++ b/tests/ui/consts/try-operator.rs @@ -1,5 +1,6 @@ //@ ignore-backends: gcc //@ run-pass +#![allow(unused_features)] #![feature(try_trait_v2)] #![feature(const_trait_impl)] diff --git a/tests/ui/contracts/internal_machinery/lowering/basics.rs b/tests/ui/contracts/internal_machinery/lowering/basics.rs index 7b3a769af8258..00d83efb4ddca 100644 --- a/tests/ui/contracts/internal_machinery/lowering/basics.rs +++ b/tests/ui/contracts/internal_machinery/lowering/basics.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(unused_features)] #![expect(incomplete_features)] #![feature(contracts, cfg_contract_checks, contracts_internals, core_intrinsics)] diff --git a/tests/ui/coroutine/control-flow.rs b/tests/ui/coroutine/control-flow.rs index f64b6f7388366..63b03cf5f0797 100644 --- a/tests/ui/coroutine/control-flow.rs +++ b/tests/ui/coroutine/control-flow.rs @@ -2,6 +2,7 @@ //@ revisions: default nomiropt //@[nomiropt]compile-flags: -Z mir-opt-level=0 +#![allow(unused_features)] #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] diff --git a/tests/ui/coroutine/missing_coroutine_attr_suggestion.fixed b/tests/ui/coroutine/missing_coroutine_attr_suggestion.fixed index 128f09a118439..72a7b141342c2 100644 --- a/tests/ui/coroutine/missing_coroutine_attr_suggestion.fixed +++ b/tests/ui/coroutine/missing_coroutine_attr_suggestion.fixed @@ -1,5 +1,6 @@ //@ run-rustfix +#![allow(unused_features)] #![feature(coroutines, gen_blocks, stmt_expr_attributes)] fn main() { diff --git a/tests/ui/coroutine/missing_coroutine_attr_suggestion.rs b/tests/ui/coroutine/missing_coroutine_attr_suggestion.rs index dc95259149609..7836afbe36830 100644 --- a/tests/ui/coroutine/missing_coroutine_attr_suggestion.rs +++ b/tests/ui/coroutine/missing_coroutine_attr_suggestion.rs @@ -1,5 +1,6 @@ //@ run-rustfix +#![allow(unused_features)] #![feature(coroutines, gen_blocks, stmt_expr_attributes)] fn main() { diff --git a/tests/ui/coroutine/missing_coroutine_attr_suggestion.stderr b/tests/ui/coroutine/missing_coroutine_attr_suggestion.stderr index 8d92471a361cd..ea346d4b4e07e 100644 --- a/tests/ui/coroutine/missing_coroutine_attr_suggestion.stderr +++ b/tests/ui/coroutine/missing_coroutine_attr_suggestion.stderr @@ -1,5 +1,5 @@ error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks - --> $DIR/missing_coroutine_attr_suggestion.rs:6:16 + --> $DIR/missing_coroutine_attr_suggestion.rs:7:16 | LL | let _ = || yield; | ^^^^^ diff --git a/tests/ui/coroutine/non-static-is-unpin.rs b/tests/ui/coroutine/non-static-is-unpin.rs index b28bf1977145b..8a89e0242e8b8 100644 --- a/tests/ui/coroutine/non-static-is-unpin.rs +++ b/tests/ui/coroutine/non-static-is-unpin.rs @@ -3,6 +3,7 @@ //@[next] compile-flags: -Znext-solver //@ run-pass +#![allow(unused_features)] #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] #![allow(dropping_copy_types)] diff --git a/tests/ui/coroutine/other-attribute-on-gen.rs b/tests/ui/coroutine/other-attribute-on-gen.rs index 5f4584ee0226e..cdbc50dc7a962 100644 --- a/tests/ui/coroutine/other-attribute-on-gen.rs +++ b/tests/ui/coroutine/other-attribute-on-gen.rs @@ -5,6 +5,7 @@ #![feature(stmt_expr_attributes)] #![feature(async_iterator)] #![allow(dead_code)] +#![allow(unused_features)] // make sure that other attributes e.g. `optimize` can be applied to gen blocks and functions diff --git a/tests/ui/coroutine/pin-box-coroutine.rs b/tests/ui/coroutine/pin-box-coroutine.rs index d030f3ef214d1..58a3dff8f0c1c 100644 --- a/tests/ui/coroutine/pin-box-coroutine.rs +++ b/tests/ui/coroutine/pin-box-coroutine.rs @@ -1,5 +1,6 @@ //@ run-pass +#![allow(unused_features)] #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::ops::Coroutine; diff --git a/tests/ui/coroutine/xcrate.rs b/tests/ui/coroutine/xcrate.rs index 406152a0bf10c..573ccc088f477 100644 --- a/tests/ui/coroutine/xcrate.rs +++ b/tests/ui/coroutine/xcrate.rs @@ -3,6 +3,7 @@ //@ aux-build:xcrate.rs #![feature(coroutines, coroutine_trait)] +#![allow(unused_features)] extern crate xcrate; diff --git a/tests/ui/eii/default/call_default.rs b/tests/ui/eii/default/call_default.rs index c13df48e99217..dccf95707b9bd 100644 --- a/tests/ui/eii/default/call_default.rs +++ b/tests/ui/eii/default/call_default.rs @@ -7,6 +7,7 @@ //@ ignore-windows // Tests EIIs with default implementations. // When there's no explicit declaration, the default should be called from the declaring crate. +#![allow(unused_features)] #![feature(extern_item_impls)] extern crate decl_with_default; diff --git a/tests/ui/eii/default/call_default_panics.rs b/tests/ui/eii/default/call_default_panics.rs index f71fddb71ba26..627f5bfca7be3 100644 --- a/tests/ui/eii/default/call_default_panics.rs +++ b/tests/ui/eii/default/call_default_panics.rs @@ -24,6 +24,7 @@ // This is a simple test to make sure that we can unwind through these, // and that this wrapper function effectively doesn't show up in the trace. #![feature(extern_item_impls)] +#![allow(unused_features)] extern crate decl_with_default_panics; diff --git a/tests/ui/eii/default/call_impl.rs b/tests/ui/eii/default/call_impl.rs index 94b2aa552a1e1..2787ffabef083 100644 --- a/tests/ui/eii/default/call_impl.rs +++ b/tests/ui/eii/default/call_impl.rs @@ -9,6 +9,7 @@ // Tests EIIs with default implementations. // When an explicit implementation is given in one dependency, and the declaration is in another, // the explicit implementation is preferred. +#![allow(unused_features)] #![feature(extern_item_impls)] extern crate decl_with_default; diff --git a/tests/ui/eii/linking/codegen_cross_crate.rs b/tests/ui/eii/linking/codegen_cross_crate.rs index 4016712e7504a..d444908487c23 100644 --- a/tests/ui/eii/linking/codegen_cross_crate.rs +++ b/tests/ui/eii/linking/codegen_cross_crate.rs @@ -6,6 +6,7 @@ // FIXME: linking on windows (speciifcally mingw) not yet supported, see tracking issue #125418 //@ ignore-windows // Tests whether calling EIIs works with the declaration in another crate. +#![allow(unused_features)] #![feature(extern_item_impls)] extern crate codegen_cross_crate_other_crate as codegen; diff --git a/tests/ui/eii/privacy1.rs b/tests/ui/eii/privacy1.rs index 72aec83d2cee0..e9f3ebb3ee283 100644 --- a/tests/ui/eii/privacy1.rs +++ b/tests/ui/eii/privacy1.rs @@ -5,6 +5,7 @@ // FIXME: linking on windows (specifically mingw) not yet supported, see tracking issue #125418 //@ ignore-windows // Tests whether re-exports work. +#![allow(unused_features)] #![feature(extern_item_impls)] extern crate other_crate_privacy1 as codegen; diff --git a/tests/ui/extern/extern-prelude-core.rs b/tests/ui/extern/extern-prelude-core.rs index 5108c02517c3d..c5e557206de41 100644 --- a/tests/ui/extern/extern-prelude-core.rs +++ b/tests/ui/extern/extern-prelude-core.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(unused_features)] #![feature(lang_items)] #![no_std] diff --git a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current.fixed b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current.fixed index 525f78d162fc0..e2304b875978e 100644 --- a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current.fixed +++ b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current.fixed @@ -20,6 +20,7 @@ //@ [future_feature] edition: future //@ [future_feature] compile-flags: -Z unstable-options +#![allow(unused_features)] #![cfg_attr(future_feature, feature(explicit_extern_abis))] #![cfg_attr(current_feature, feature(explicit_extern_abis))] diff --git a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current.stderr b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current.stderr index cf927807c7c3c..1a51bd0a07c70 100644 --- a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current.stderr +++ b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current.stderr @@ -1,5 +1,5 @@ warning: `extern` declarations without an explicit ABI are deprecated - --> $DIR/feature-gate-explicit-extern-abis.rs:27:1 + --> $DIR/feature-gate-explicit-extern-abis.rs:28:1 | LL | extern fn _foo() {} | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` @@ -7,13 +7,13 @@ LL | extern fn _foo() {} = note: `#[warn(missing_abi)]` on by default warning: `extern` declarations without an explicit ABI are deprecated - --> $DIR/feature-gate-explicit-extern-abis.rs:33:8 + --> $DIR/feature-gate-explicit-extern-abis.rs:34:8 | LL | unsafe extern fn _bar() {} | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` warning: `extern` declarations without an explicit ABI are deprecated - --> $DIR/feature-gate-explicit-extern-abis.rs:39:8 + --> $DIR/feature-gate-explicit-extern-abis.rs:40:8 | LL | unsafe extern {} | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` diff --git a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current_feature.fixed b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current_feature.fixed index 525f78d162fc0..e2304b875978e 100644 --- a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current_feature.fixed +++ b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current_feature.fixed @@ -20,6 +20,7 @@ //@ [future_feature] edition: future //@ [future_feature] compile-flags: -Z unstable-options +#![allow(unused_features)] #![cfg_attr(future_feature, feature(explicit_extern_abis))] #![cfg_attr(current_feature, feature(explicit_extern_abis))] diff --git a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current_feature.stderr b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current_feature.stderr index cf927807c7c3c..1a51bd0a07c70 100644 --- a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current_feature.stderr +++ b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.current_feature.stderr @@ -1,5 +1,5 @@ warning: `extern` declarations without an explicit ABI are deprecated - --> $DIR/feature-gate-explicit-extern-abis.rs:27:1 + --> $DIR/feature-gate-explicit-extern-abis.rs:28:1 | LL | extern fn _foo() {} | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` @@ -7,13 +7,13 @@ LL | extern fn _foo() {} = note: `#[warn(missing_abi)]` on by default warning: `extern` declarations without an explicit ABI are deprecated - --> $DIR/feature-gate-explicit-extern-abis.rs:33:8 + --> $DIR/feature-gate-explicit-extern-abis.rs:34:8 | LL | unsafe extern fn _bar() {} | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` warning: `extern` declarations without an explicit ABI are deprecated - --> $DIR/feature-gate-explicit-extern-abis.rs:39:8 + --> $DIR/feature-gate-explicit-extern-abis.rs:40:8 | LL | unsafe extern {} | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` diff --git a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future.fixed b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future.fixed index 525f78d162fc0..e2304b875978e 100644 --- a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future.fixed +++ b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future.fixed @@ -20,6 +20,7 @@ //@ [future_feature] edition: future //@ [future_feature] compile-flags: -Z unstable-options +#![allow(unused_features)] #![cfg_attr(future_feature, feature(explicit_extern_abis))] #![cfg_attr(current_feature, feature(explicit_extern_abis))] diff --git a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future.stderr b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future.stderr index cf927807c7c3c..1a51bd0a07c70 100644 --- a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future.stderr +++ b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future.stderr @@ -1,5 +1,5 @@ warning: `extern` declarations without an explicit ABI are deprecated - --> $DIR/feature-gate-explicit-extern-abis.rs:27:1 + --> $DIR/feature-gate-explicit-extern-abis.rs:28:1 | LL | extern fn _foo() {} | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` @@ -7,13 +7,13 @@ LL | extern fn _foo() {} = note: `#[warn(missing_abi)]` on by default warning: `extern` declarations without an explicit ABI are deprecated - --> $DIR/feature-gate-explicit-extern-abis.rs:33:8 + --> $DIR/feature-gate-explicit-extern-abis.rs:34:8 | LL | unsafe extern fn _bar() {} | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` warning: `extern` declarations without an explicit ABI are deprecated - --> $DIR/feature-gate-explicit-extern-abis.rs:39:8 + --> $DIR/feature-gate-explicit-extern-abis.rs:40:8 | LL | unsafe extern {} | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` diff --git a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future_feature.stderr b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future_feature.stderr index 096a6f4341699..8804c4a459bff 100644 --- a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future_feature.stderr +++ b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.future_feature.stderr @@ -1,5 +1,5 @@ error: `extern` declarations without an explicit ABI are disallowed - --> $DIR/feature-gate-explicit-extern-abis.rs:27:1 + --> $DIR/feature-gate-explicit-extern-abis.rs:28:1 | LL | extern fn _foo() {} | ^^^^^^ help: specify an ABI: `extern ""` @@ -7,7 +7,7 @@ LL | extern fn _foo() {} = help: prior to Rust 2024, a default ABI was inferred error: `extern` declarations without an explicit ABI are disallowed - --> $DIR/feature-gate-explicit-extern-abis.rs:33:8 + --> $DIR/feature-gate-explicit-extern-abis.rs:34:8 | LL | unsafe extern fn _bar() {} | ^^^^^^ help: specify an ABI: `extern ""` @@ -15,7 +15,7 @@ LL | unsafe extern fn _bar() {} = help: prior to Rust 2024, a default ABI was inferred error: `extern` declarations without an explicit ABI are disallowed - --> $DIR/feature-gate-explicit-extern-abis.rs:39:8 + --> $DIR/feature-gate-explicit-extern-abis.rs:40:8 | LL | unsafe extern {} | ^^^^^^ help: specify an ABI: `extern ""` diff --git a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.rs b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.rs index 379c45f589907..0eb5d1ce71aee 100644 --- a/tests/ui/feature-gates/feature-gate-explicit-extern-abis.rs +++ b/tests/ui/feature-gates/feature-gate-explicit-extern-abis.rs @@ -20,6 +20,7 @@ //@ [future_feature] edition: future //@ [future_feature] compile-flags: -Z unstable-options +#![allow(unused_features)] #![cfg_attr(future_feature, feature(explicit_extern_abis))] #![cfg_attr(current_feature, feature(explicit_extern_abis))] diff --git a/tests/ui/float/classify-runtime-const.rs b/tests/ui/float/classify-runtime-const.rs index ca852ea2468bc..5ddb4c060a47f 100644 --- a/tests/ui/float/classify-runtime-const.rs +++ b/tests/ui/float/classify-runtime-const.rs @@ -6,6 +6,7 @@ // This tests the float classification functions, for regular runtime code and for const evaluation. +#![allow(unused_features)] #![feature(f16)] #![feature(f128)] diff --git a/tests/ui/float/conv-bits-runtime-const.rs b/tests/ui/float/conv-bits-runtime-const.rs index 1373001b74dab..be03322a7c7ce 100644 --- a/tests/ui/float/conv-bits-runtime-const.rs +++ b/tests/ui/float/conv-bits-runtime-const.rs @@ -7,6 +7,7 @@ #![feature(f128)] #![feature(cfg_target_has_reliable_f16_f128)] #![allow(unused_macro_rules)] +#![allow(unused_features)] // expect the unexpected (`target_has_reliable_*` are not "known" configs since they are unstable) #![expect(unexpected_cfgs)] diff --git a/tests/ui/fmt/format-macro-no-std.rs b/tests/ui/fmt/format-macro-no-std.rs index d096b4de01390..f06f8c6558791 100644 --- a/tests/ui/fmt/format-macro-no-std.rs +++ b/tests/ui/fmt/format-macro-no-std.rs @@ -4,6 +4,7 @@ //@ ignore-emscripten no no_std executables //@ ignore-wasm different `main` convention +#![allow(unused_features)] #![feature(lang_items)] #![no_std] #![no_main] diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs index df1b9e164c768..d264d7c2f4370 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs @@ -5,6 +5,7 @@ // via `.contains(...)` and make sure the dynamic semantics match. #![allow(unreachable_patterns)] +#![allow(unused_features)] #![feature(cfg_target_has_reliable_f16_f128)] #![feature(f128)] #![feature(f16)] diff --git a/tests/ui/hygiene/xcrate.rs b/tests/ui/hygiene/xcrate.rs index 0dd9136e4d562..b10c61b78d36f 100644 --- a/tests/ui/hygiene/xcrate.rs +++ b/tests/ui/hygiene/xcrate.rs @@ -3,6 +3,7 @@ //@ aux-build:xcrate.rs +#![allow(unused_features)] #![feature(decl_macro)] extern crate xcrate; diff --git a/tests/ui/impl-trait/example-calendar.rs b/tests/ui/impl-trait/example-calendar.rs index c3c01f0103669..dd1ab7fcf4deb 100644 --- a/tests/ui/impl-trait/example-calendar.rs +++ b/tests/ui/impl-trait/example-calendar.rs @@ -1,5 +1,6 @@ //@ run-pass +#![allow(unused_features)] #![feature(fn_traits, step_trait, unboxed_closures, diff --git a/tests/ui/intrinsics/intrinsic-alignment.rs b/tests/ui/intrinsics/intrinsic-alignment.rs index 5fee6b0b39783..30dc144c704cf 100644 --- a/tests/ui/intrinsics/intrinsic-alignment.rs +++ b/tests/ui/intrinsics/intrinsic-alignment.rs @@ -1,5 +1,6 @@ //@ run-pass +#![allow(unused_features)] #![feature(core_intrinsics, rustc_attrs)] #[cfg(any( diff --git a/tests/ui/io-checks/write-macro-error.rs b/tests/ui/io-checks/write-macro-error.rs index 857ea0024e16c..47f3344fab46e 100644 --- a/tests/ui/io-checks/write-macro-error.rs +++ b/tests/ui/io-checks/write-macro-error.rs @@ -4,6 +4,7 @@ //@ run-pass //@ needs-unwind +#![allow(unused_features)] #![feature(io_error_uncategorized)] use std::fmt; diff --git a/tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs b/tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs index 48ca39300f41c..5149f677ff896 100644 --- a/tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs +++ b/tests/ui/linkage-attr/raw-dylib/elf/as_needed.rs @@ -14,6 +14,7 @@ //@ [merge_4] run-pass #![allow(incomplete_features)] +#![allow(unused_features)] #![feature(raw_dylib_elf)] #![feature(native_link_modifiers_as_needed)] diff --git a/tests/ui/lint/lint-expr-stmt-attrs-for-early-lints.rs b/tests/ui/lint/lint-expr-stmt-attrs-for-early-lints.rs index eb110869e44e8..2ea3aaa65bd13 100644 --- a/tests/ui/lint/lint-expr-stmt-attrs-for-early-lints.rs +++ b/tests/ui/lint/lint-expr-stmt-attrs-for-early-lints.rs @@ -1,5 +1,6 @@ //@ run-pass +#![allow(unused_features)] #![feature(stmt_expr_attributes)] #![deny(unused_parens)] diff --git a/tests/ui/lint/lint-unknown-feature.rs b/tests/ui/lint/lint-unknown-feature.rs index 188617467974e..d8a0da950f6d7 100644 --- a/tests/ui/lint/lint-unknown-feature.rs +++ b/tests/ui/lint/lint-unknown-feature.rs @@ -3,6 +3,7 @@ #![warn(unused_features)] #![allow(stable_features)] +#![allow(unused_features)] // FIXME(#44232) we should warn that this isn't used. #![feature(rust1)] diff --git a/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.fixed b/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.fixed index d554bbfcc98c9..001c880d85860 100644 --- a/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.fixed +++ b/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.fixed @@ -2,6 +2,7 @@ //@ edition:2021 #![deny(unused_qualifications)] #![deny(unused_imports)] +#![allow(unused_features)] #![feature(coroutines, coroutine_trait)] use std::ops::{ diff --git a/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.rs b/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.rs index 4d79f5ab74530..4fc575cd1c1c5 100644 --- a/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.rs +++ b/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.rs @@ -2,6 +2,7 @@ //@ edition:2021 #![deny(unused_qualifications)] #![deny(unused_imports)] +#![allow(unused_features)] #![feature(coroutines, coroutine_trait)] use std::ops::{ diff --git a/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.stderr b/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.stderr index 52ed13ea150d7..b6f8513a9b33c 100644 --- a/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.stderr +++ b/tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.stderr @@ -1,5 +1,5 @@ error: unused import: `*` - --> $DIR/lint-unnecessary-qualification-issue-121331.rs:9:28 + --> $DIR/lint-unnecessary-qualification-issue-121331.rs:10:28 | LL | CoroutineState::{self, *}, | ^ @@ -11,7 +11,7 @@ LL | #![deny(unused_imports)] | ^^^^^^^^^^^^^^ error: unnecessary qualification - --> $DIR/lint-unnecessary-qualification-issue-121331.rs:37:5 + --> $DIR/lint-unnecessary-qualification-issue-121331.rs:38:5 | LL | foo::bar(); | ^^^^^^^^ diff --git a/tests/ui/lint/unused/unused_attributes-must_use.fixed b/tests/ui/lint/unused/unused_attributes-must_use.fixed index fa596da95ccd1..8bfe3e044cb06 100644 --- a/tests/ui/lint/unused/unused_attributes-must_use.fixed +++ b/tests/ui/lint/unused/unused_attributes-must_use.fixed @@ -1,6 +1,7 @@ //@ run-rustfix #![allow(dead_code, path_statements)] +#![allow(unused_features)] #![deny(unused_attributes, unused_must_use)] #![feature(asm_experimental_arch, stmt_expr_attributes, trait_alias)] diff --git a/tests/ui/lint/unused/unused_attributes-must_use.rs b/tests/ui/lint/unused/unused_attributes-must_use.rs index 3e72dd1e43833..c4e39ebdb01ec 100644 --- a/tests/ui/lint/unused/unused_attributes-must_use.rs +++ b/tests/ui/lint/unused/unused_attributes-must_use.rs @@ -1,6 +1,7 @@ //@ run-rustfix #![allow(dead_code, path_statements)] +#![allow(unused_features)] #![deny(unused_attributes, unused_must_use)] #![feature(asm_experimental_arch, stmt_expr_attributes, trait_alias)] diff --git a/tests/ui/lint/unused/unused_attributes-must_use.stderr b/tests/ui/lint/unused/unused_attributes-must_use.stderr index 3fc340b5188f7..0ba8f42327832 100644 --- a/tests/ui/lint/unused/unused_attributes-must_use.stderr +++ b/tests/ui/lint/unused/unused_attributes-must_use.stderr @@ -1,5 +1,5 @@ error: `#[must_use]` attribute cannot be used on macro calls - --> $DIR/unused_attributes-must_use.rs:68:1 + --> $DIR/unused_attributes-must_use.rs:69:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -7,13 +7,13 @@ LL | #[must_use] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[must_use]` can be applied to data types, functions, and traits note: the lint level is defined here - --> $DIR/unused_attributes-must_use.rs:4:9 + --> $DIR/unused_attributes-must_use.rs:5:9 | LL | #![deny(unused_attributes, unused_must_use)] | ^^^^^^^^^^^^^^^^^ error: `#[must_use]` attribute cannot be used on extern crates - --> $DIR/unused_attributes-must_use.rs:7:1 + --> $DIR/unused_attributes-must_use.rs:8:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -22,7 +22,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on modules - --> $DIR/unused_attributes-must_use.rs:11:1 + --> $DIR/unused_attributes-must_use.rs:12:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on use statements - --> $DIR/unused_attributes-must_use.rs:15:1 + --> $DIR/unused_attributes-must_use.rs:16:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -40,7 +40,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on constants - --> $DIR/unused_attributes-must_use.rs:19:1 + --> $DIR/unused_attributes-must_use.rs:20:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on statics - --> $DIR/unused_attributes-must_use.rs:22:1 + --> $DIR/unused_attributes-must_use.rs:23:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -58,7 +58,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on inherent impl blocks - --> $DIR/unused_attributes-must_use.rs:40:1 + --> $DIR/unused_attributes-must_use.rs:41:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -67,7 +67,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on foreign modules - --> $DIR/unused_attributes-must_use.rs:55:1 + --> $DIR/unused_attributes-must_use.rs:56:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -76,7 +76,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on foreign statics - --> $DIR/unused_attributes-must_use.rs:59:5 + --> $DIR/unused_attributes-must_use.rs:60:5 | LL | #[must_use] | ^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on type aliases - --> $DIR/unused_attributes-must_use.rs:73:1 + --> $DIR/unused_attributes-must_use.rs:74:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -94,7 +94,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on type parameters - --> $DIR/unused_attributes-must_use.rs:77:8 + --> $DIR/unused_attributes-must_use.rs:78:8 | LL | fn qux<#[must_use] T>(_: T) {} | ^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | fn qux<#[must_use] T>(_: T) {} = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on associated consts - --> $DIR/unused_attributes-must_use.rs:82:5 + --> $DIR/unused_attributes-must_use.rs:83:5 | LL | #[must_use] | ^^^^^^^^^^^ @@ -112,7 +112,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on associated types - --> $DIR/unused_attributes-must_use.rs:85:5 + --> $DIR/unused_attributes-must_use.rs:86:5 | LL | #[must_use] | ^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on trait impl blocks - --> $DIR/unused_attributes-must_use.rs:95:1 + --> $DIR/unused_attributes-must_use.rs:96:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -130,7 +130,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on trait methods in impl blocks - --> $DIR/unused_attributes-must_use.rs:100:5 + --> $DIR/unused_attributes-must_use.rs:101:5 | LL | #[must_use] | ^^^^^^^^^^^ @@ -139,7 +139,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, foreign functions, functions, inherent methods, provided trait methods, required trait methods, and traits error: `#[must_use]` attribute cannot be used on trait aliases - --> $DIR/unused_attributes-must_use.rs:107:1 + --> $DIR/unused_attributes-must_use.rs:108:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -148,7 +148,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on macro defs - --> $DIR/unused_attributes-must_use.rs:111:1 + --> $DIR/unused_attributes-must_use.rs:112:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on statements - --> $DIR/unused_attributes-must_use.rs:120:5 + --> $DIR/unused_attributes-must_use.rs:121:5 | LL | #[must_use] | ^^^^^^^^^^^ @@ -166,7 +166,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on closures - --> $DIR/unused_attributes-must_use.rs:125:13 + --> $DIR/unused_attributes-must_use.rs:126:13 | LL | let x = #[must_use] | ^^^^^^^^^^^ @@ -175,7 +175,7 @@ LL | let x = #[must_use] = help: `#[must_use]` can be applied to data types, foreign functions, functions, methods, and traits error: `#[must_use]` attribute cannot be used on match arms - --> $DIR/unused_attributes-must_use.rs:148:9 + --> $DIR/unused_attributes-must_use.rs:149:9 | LL | #[must_use] | ^^^^^^^^^^^ @@ -184,7 +184,7 @@ LL | #[must_use] = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on struct fields - --> $DIR/unused_attributes-must_use.rs:157:28 + --> $DIR/unused_attributes-must_use.rs:158:28 | LL | let s = PatternField { #[must_use] foo: 123 }; | ^^^^^^^^^^^ @@ -193,7 +193,7 @@ LL | let s = PatternField { #[must_use] foo: 123 }; = help: `#[must_use]` can be applied to data types, functions, and traits error: `#[must_use]` attribute cannot be used on pattern fields - --> $DIR/unused_attributes-must_use.rs:159:24 + --> $DIR/unused_attributes-must_use.rs:160:24 | LL | let PatternField { #[must_use] foo } = s; | ^^^^^^^^^^^ @@ -202,13 +202,13 @@ LL | let PatternField { #[must_use] foo } = s; = help: `#[must_use]` can be applied to data types, functions, and traits error: unused `X` that must be used - --> $DIR/unused_attributes-must_use.rs:130:5 + --> $DIR/unused_attributes-must_use.rs:131:5 | LL | X; | ^ | note: the lint level is defined here - --> $DIR/unused_attributes-must_use.rs:4:28 + --> $DIR/unused_attributes-must_use.rs:5:28 | LL | #![deny(unused_attributes, unused_must_use)] | ^^^^^^^^^^^^^^^ @@ -218,7 +218,7 @@ LL | let _ = X; | +++++++ error: unused `Y` that must be used - --> $DIR/unused_attributes-must_use.rs:131:5 + --> $DIR/unused_attributes-must_use.rs:132:5 | LL | Y::Z; | ^^^^ @@ -229,7 +229,7 @@ LL | let _ = Y::Z; | +++++++ error: unused `U` that must be used - --> $DIR/unused_attributes-must_use.rs:132:5 + --> $DIR/unused_attributes-must_use.rs:133:5 | LL | U { unit: () }; | ^^^^^^^^^^^^^^ @@ -240,7 +240,7 @@ LL | let _ = U { unit: () }; | +++++++ error: unused return value of `U::method` that must be used - --> $DIR/unused_attributes-must_use.rs:133:5 + --> $DIR/unused_attributes-must_use.rs:134:5 | LL | U::method(); | ^^^^^^^^^^^ @@ -251,7 +251,7 @@ LL | let _ = U::method(); | +++++++ error: unused return value of `foo` that must be used - --> $DIR/unused_attributes-must_use.rs:134:5 + --> $DIR/unused_attributes-must_use.rs:135:5 | LL | foo(); | ^^^^^ @@ -262,7 +262,7 @@ LL | let _ = foo(); | +++++++ error: unused return value of `foreign_foo` that must be used - --> $DIR/unused_attributes-must_use.rs:137:9 + --> $DIR/unused_attributes-must_use.rs:138:9 | LL | foreign_foo(); | ^^^^^^^^^^^^^ @@ -273,7 +273,7 @@ LL | let _ = foreign_foo(); | +++++++ error: unused return value of `Use::get_four` that must be used - --> $DIR/unused_attributes-must_use.rs:145:5 + --> $DIR/unused_attributes-must_use.rs:146:5 | LL | ().get_four(); | ^^^^^^^^^^^^^ diff --git a/tests/ui/lowering/issue-96847.rs b/tests/ui/lowering/issue-96847.rs index a1fd105d9dd4a..35d11dc64b5b6 100644 --- a/tests/ui/lowering/issue-96847.rs +++ b/tests/ui/lowering/issue-96847.rs @@ -3,6 +3,7 @@ // Test that this doesn't abort during AST lowering. In #96847 it did abort // because the attribute was being lowered twice. +#![allow(unused_features)] #![feature(stmt_expr_attributes)] #![feature(lang_items)] diff --git a/tests/ui/lowering/issue-96847.stderr b/tests/ui/lowering/issue-96847.stderr index 2cded32f9fb86..2fa5ef05621e1 100644 --- a/tests/ui/lowering/issue-96847.stderr +++ b/tests/ui/lowering/issue-96847.stderr @@ -1,5 +1,5 @@ error[E0522]: definition of an unknown lang item: `foo` - --> $DIR/issue-96847.rs:11:9 + --> $DIR/issue-96847.rs:12:9 | LL | #![lang="foo"] | ^^^^^^^^^^^^^^ definition of unknown lang item `foo` diff --git a/tests/ui/macros/metavar_cross_edition_recursive_macros.rs b/tests/ui/macros/metavar_cross_edition_recursive_macros.rs index ae1bc00236f0f..26bb29465bf49 100644 --- a/tests/ui/macros/metavar_cross_edition_recursive_macros.rs +++ b/tests/ui/macros/metavar_cross_edition_recursive_macros.rs @@ -8,6 +8,7 @@ #![feature(macro_metavar_expr)] #![allow(incomplete_features)] +#![allow(unused_features)] extern crate metavar_2018; diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs index de7dbb9052edb..2d1272741484e 100644 --- a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs +++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs @@ -5,6 +5,7 @@ //@ needs-unwind Asserting on contents of error message #![allow(path_statements, unused_allocation)] +#![allow(unused_features)] #![feature(core_intrinsics, generic_assert)] macro_rules! test { diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs index 1600fd0af3f30..763ac9a461dd4 100644 --- a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs +++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs @@ -4,6 +4,7 @@ //@ run-pass //@ needs-unwind Asserting on contents of error message +#![allow(unused_features)] #![feature(core_intrinsics, generic_assert)] extern crate common; diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-with-custom-errors-does-not-create-unnecessary-code.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-with-custom-errors-does-not-create-unnecessary-code.rs index 2a27164f9cba2..d6dc99fde9a5b 100644 --- a/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-with-custom-errors-does-not-create-unnecessary-code.rs +++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-with-custom-errors-does-not-create-unnecessary-code.rs @@ -3,6 +3,7 @@ //@ compile-flags: --test -Zpanic_abort_tests //@ run-pass +#![allow(unused_features)] #![feature(core_intrinsics, generic_assert)] #[should_panic(expected = "Custom user message")] diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-without-captures-does-not-create-unnecessary-code.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-without-captures-does-not-create-unnecessary-code.rs index 6e5f8d6cd12d4..f5d5f1e471c78 100644 --- a/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-without-captures-does-not-create-unnecessary-code.rs +++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-without-captures-does-not-create-unnecessary-code.rs @@ -3,6 +3,7 @@ //@ run-pass //@ needs-unwind Asserting on contents of error message +#![allow(unused_features)] #![feature(core_intrinsics, generic_assert)] extern crate common; diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs index 254d59076e531..a687c6ed2c7f8 100644 --- a/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs +++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs @@ -4,6 +4,7 @@ // ignore-tidy-linelength //@ run-pass +#![allow(unused_features)] #![feature(core_intrinsics, generic_assert)] use std::fmt::{Debug, Formatter}; diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs index 890b429b4ac7d..56ee4811905c8 100644 --- a/tests/ui/macros/stringify.rs +++ b/tests/ui/macros/stringify.rs @@ -3,6 +3,7 @@ //@ compile-flags: --test #![allow(incomplete_features)] +#![allow(unused_features)] #![feature(auto_traits)] #![feature(box_patterns)] #![feature(const_block_items)] diff --git a/tests/ui/match/match-float.rs b/tests/ui/match/match-float.rs index 279bb5927ac45..ef6e78c61667b 100644 --- a/tests/ui/match/match-float.rs +++ b/tests/ui/match/match-float.rs @@ -2,6 +2,7 @@ //@ compile-flags: --check-cfg=cfg(target_has_reliable_f16,target_has_reliable_f128) // Makes sure we use `==` (not bitwise) semantics for float comparison. +#![allow(unused_features)] #![feature(cfg_target_has_reliable_f16_f128)] #![feature(f128)] #![feature(f16)] diff --git a/tests/ui/methods/supertrait-shadowing/out-of-scope.rs b/tests/ui/methods/supertrait-shadowing/out-of-scope.rs index bd263be59cc7d..395376d496061 100644 --- a/tests/ui/methods/supertrait-shadowing/out-of-scope.rs +++ b/tests/ui/methods/supertrait-shadowing/out-of-scope.rs @@ -3,6 +3,7 @@ #![feature(supertrait_item_shadowing)] #![allow(dead_code)] +#![allow(unused_features)] mod out_of_scope { pub trait Subtrait: super::Supertrait { diff --git a/tests/ui/nll/issue-48623-coroutine.rs b/tests/ui/nll/issue-48623-coroutine.rs index 63348a2047c07..f18d6469c66c2 100644 --- a/tests/ui/nll/issue-48623-coroutine.rs +++ b/tests/ui/nll/issue-48623-coroutine.rs @@ -1,6 +1,7 @@ //@ run-pass #![allow(path_statements)] #![allow(dead_code)] +#![allow(unused_features)] #![feature(coroutines, coroutine_trait)] diff --git a/tests/ui/nll/issue-48623-coroutine.stderr b/tests/ui/nll/issue-48623-coroutine.stderr index 2862d7b2a2f05..837730d7d5d12 100644 --- a/tests/ui/nll/issue-48623-coroutine.stderr +++ b/tests/ui/nll/issue-48623-coroutine.stderr @@ -1,5 +1,5 @@ warning: unused coroutine that must be used - --> $DIR/issue-48623-coroutine.rs:15:18 + --> $DIR/issue-48623-coroutine.rs:16:18 | LL | #[coroutine] move || { d; yield; &mut *r }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/overloaded/overloaded-calls-simple.rs b/tests/ui/overloaded/overloaded-calls-simple.rs index 34b674357d89c..955aba7fef653 100644 --- a/tests/ui/overloaded/overloaded-calls-simple.rs +++ b/tests/ui/overloaded/overloaded-calls-simple.rs @@ -1,5 +1,6 @@ //@ run-pass +#![allow(unused_features)] #![feature(lang_items, unboxed_closures, fn_traits)] struct S1 { diff --git a/tests/ui/sanitizer/memory-passing.rs b/tests/ui/sanitizer/memory-passing.rs index 6ac41b178fe7f..28aa0ce28f593 100644 --- a/tests/ui/sanitizer/memory-passing.rs +++ b/tests/ui/sanitizer/memory-passing.rs @@ -15,6 +15,7 @@ #![feature(core_intrinsics)] #![allow(invalid_value)] +#![allow(unused_features)] #![no_main] use std::hint::black_box; diff --git a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr index c82adbf8d4c58..45c95c5c7c3bc 100644 --- a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr +++ b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr @@ -1,5 +1,5 @@ error: overly complex generic constant - --> $DIR/monomorphize-shuffle-index.rs:37:51 + --> $DIR/monomorphize-shuffle-index.rs:38:51 | LL | return simd_shuffle_const_generic::<_, _, { &Self::I.0 }>(a, b); | ^^----------^^ diff --git a/tests/ui/simd/monomorphize-shuffle-index.rs b/tests/ui/simd/monomorphize-shuffle-index.rs index ba952cdb0dc60..31700c54f2e32 100644 --- a/tests/ui/simd/monomorphize-shuffle-index.rs +++ b/tests/ui/simd/monomorphize-shuffle-index.rs @@ -11,6 +11,7 @@ generic_const_exprs )] #![allow(incomplete_features)] +#![allow(unused_features)] #[path = "../../auxiliary/minisimd.rs"] mod minisimd; diff --git a/tests/ui/simd/target-feature-mixup.rs b/tests/ui/simd/target-feature-mixup.rs index 5f599f38fb92f..e1abf94ecc311 100644 --- a/tests/ui/simd/target-feature-mixup.rs +++ b/tests/ui/simd/target-feature-mixup.rs @@ -1,6 +1,7 @@ //@ run-pass #![allow(unused_variables)] #![allow(overflowing_literals)] +#![allow(unused_features)] //@ needs-subprocess //@ ignore-fuchsia must translate zircon signal to SIGILL, FIXME (#58590) diff --git a/tests/ui/structs-enums/rec-align-u32.rs b/tests/ui/structs-enums/rec-align-u32.rs index 058f06732b927..0045cfac07f3f 100644 --- a/tests/ui/structs-enums/rec-align-u32.rs +++ b/tests/ui/structs-enums/rec-align-u32.rs @@ -1,6 +1,7 @@ //@ run-pass #![allow(dead_code)] #![allow(unused_unsafe)] +#![allow(unused_features)] // Issue #2303 #![feature(core_intrinsics, rustc_attrs)] diff --git a/tests/ui/structs-enums/rec-align-u64.rs b/tests/ui/structs-enums/rec-align-u64.rs index 41b196dc5c222..9e3ab05fa87e1 100644 --- a/tests/ui/structs-enums/rec-align-u64.rs +++ b/tests/ui/structs-enums/rec-align-u64.rs @@ -1,6 +1,7 @@ //@ run-pass #![allow(dead_code)] #![allow(unused_unsafe)] +#![allow(unused_features)] // Issue #2303 diff --git a/tests/ui/traits/alias/import-cross-crate.rs b/tests/ui/traits/alias/import-cross-crate.rs index 65e7c90965b85..b8d7e471dce9e 100644 --- a/tests/ui/traits/alias/import-cross-crate.rs +++ b/tests/ui/traits/alias/import-cross-crate.rs @@ -1,6 +1,7 @@ //@ run-pass //@ aux-build:greeter.rs +#![allow(unused_features)] #![feature(trait_alias)] extern crate greeter; diff --git a/tests/ui/traits/overlap-permitted-for-marker-traits.rs b/tests/ui/traits/overlap-permitted-for-marker-traits.rs index c05e5fddae635..ad249059e877b 100644 --- a/tests/ui/traits/overlap-permitted-for-marker-traits.rs +++ b/tests/ui/traits/overlap-permitted-for-marker-traits.rs @@ -3,6 +3,7 @@ // that is, traits without items. In this case, a type `T` is // `MyMarker` if it is either `Debug` or `Display`. +#![allow(unused_features)] #![feature(marker_trait_attr)] #![feature(negative_impls)] diff --git a/tests/ui/type/typeid-consistency.rs b/tests/ui/type/typeid-consistency.rs index 67ee1b6d839ab..50efea0a01786 100644 --- a/tests/ui/type/typeid-consistency.rs +++ b/tests/ui/type/typeid-consistency.rs @@ -3,6 +3,7 @@ //@ run-pass #![allow(deprecated)] +#![allow(unused_features)] #![feature(core_intrinsics)] //@ aux-build:typeid-consistency-aux1.rs diff --git a/tests/ui/typeck/type-name-intrinsic-usage-61894.rs b/tests/ui/typeck/type-name-intrinsic-usage-61894.rs index 8131bb273909d..b1a7206f20669 100644 --- a/tests/ui/typeck/type-name-intrinsic-usage-61894.rs +++ b/tests/ui/typeck/type-name-intrinsic-usage-61894.rs @@ -1,6 +1,7 @@ // https://github.com/rust-lang/rust/issues/61894 //@ run-pass +#![allow(unused_features)] #![feature(core_intrinsics)] use std::any::type_name; From a283871719787cb86d37103991e5997a201086d9 Mon Sep 17 00:00:00 2001 From: mu001999 Date: Fri, 20 Feb 2026 14:34:01 +0800 Subject: [PATCH 5/5] Remove unused features in library tests --- library/coretests/tests/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs index 85ee7cff68266..a092b6f15273c 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -52,7 +52,6 @@ #![feature(f16)] #![feature(f128)] #![feature(float_algebraic)] -#![feature(float_bits_const)] #![feature(float_exact_integer_constants)] #![feature(float_gamma)] #![feature(float_minimum_maximum)]