From 9e638455220c0c67393cfb1ed14cc3f0c23bf8f0 Mon Sep 17 00:00:00 2001 From: Shoyu Vanilla Date: Fri, 12 Dec 2025 18:26:16 +0900 Subject: [PATCH 01/11] `-Znext-solver` Remove the forced ambiguity hack from search graph --- .../rustc_type_ir/src/search_graph/mod.rs | 31 ++----------- .../global-where-bound-normalization.rs | 45 +++++++++++++++++++ 2 files changed, 48 insertions(+), 28 deletions(-) create mode 100644 tests/ui/traits/next-solver/global-where-bound-normalization.rs diff --git a/compiler/rustc_type_ir/src/search_graph/mod.rs b/compiler/rustc_type_ir/src/search_graph/mod.rs index 8e6376b22ce61..7c58cd7303ebc 100644 --- a/compiler/rustc_type_ir/src/search_graph/mod.rs +++ b/compiler/rustc_type_ir/src/search_graph/mod.rs @@ -916,10 +916,9 @@ impl, X: Cx> SearchGraph { /// heads from the stack. This may not necessarily mean that we've actually /// reached a fixpoint for that cycle head, which impacts the way we rebase /// provisional cache entries. -#[derive_where(Debug; X: Cx)] -enum RebaseReason { +#[derive(Debug)] +enum RebaseReason { NoCycleUsages, - Ambiguity(X::AmbiguityInfo), Overflow, /// We've actually reached a fixpoint. /// @@ -956,7 +955,7 @@ impl, X: Cx> SearchGraph { &mut self, cx: X, stack_entry: &StackEntry, - rebase_reason: RebaseReason, + rebase_reason: RebaseReason, ) { let popped_head_index = self.stack.next_index(); #[allow(rustc::potential_query_instability)] @@ -1035,9 +1034,6 @@ impl, X: Cx> SearchGraph { // is not actually equal to the final provisional result. We // need to discard the provisional cache entry in this case. RebaseReason::NoCycleUsages => return false, - RebaseReason::Ambiguity(info) => { - *result = D::propagate_ambiguity(cx, input, info); - } RebaseReason::Overflow => *result = D::fixpoint_overflow_result(cx, input), RebaseReason::ReachedFixpoint(None) => {} RebaseReason::ReachedFixpoint(Some(path_kind)) => { @@ -1352,27 +1348,6 @@ impl, X: Cx> SearchGraph { return EvaluationResult::finalize(stack_entry, encountered_overflow, result); } - // If computing this goal results in ambiguity with no constraints, - // we do not rerun it. It's incredibly difficult to get a different - // response in the next iteration in this case. These changes would - // likely either be caused by incompleteness or can change the maybe - // cause from ambiguity to overflow. Returning ambiguity always - // preserves soundness and completeness even if the goal is be known - // to succeed or fail. - // - // This prevents exponential blowup affecting multiple major crates. - // As we only get to this branch if we haven't yet reached a fixpoint, - // we also taint all provisional cache entries which depend on the - // current goal. - if let Some(info) = D::is_ambiguous_result(result) { - self.rebase_provisional_cache_entries( - cx, - &stack_entry, - RebaseReason::Ambiguity(info), - ); - return EvaluationResult::finalize(stack_entry, encountered_overflow, result); - }; - // If we've reached the fixpoint step limit, we bail with overflow and taint all // provisional cache entries which depend on the current goal. i += 1; diff --git a/tests/ui/traits/next-solver/global-where-bound-normalization.rs b/tests/ui/traits/next-solver/global-where-bound-normalization.rs new file mode 100644 index 0000000000000..e57fbf378a0d2 --- /dev/null +++ b/tests/ui/traits/next-solver/global-where-bound-normalization.rs @@ -0,0 +1,45 @@ +//@ check-pass +//@ compile-flags: -Znext-solver + +// Regression test for https://github.com/rust-lang/trait-system-refactor-initiative/issues/257. + +#![feature(rustc_attrs)] +#![expect(internal_features)] +#![rustc_no_implicit_bounds] + +pub trait Bound {} +impl Bound for u8 {} + +pub trait Proj { + type Assoc; +} +impl Proj for U { + type Assoc = U; +} +impl Proj for MyField { + type Assoc = u8; +} + +// While wf-checking the global bounds of `fn foo`, elaborating this outlives predicate triggered a +// cycle in the search graph along a particular probe path, which was not an actual solution. +// That cycle then resulted in a forced false-positive ambiguity due to a performance hack in the +// search graph and then ended up floundering the root goal evaluation. +pub trait Field: Proj {} + +struct MyField; +impl Field for MyField {} + +trait IdReqField { + type This; +} +impl IdReqField for F { + type This = F; +} + +fn foo() +where + ::This: Field, +{ +} + +fn main() {} From b022e16e2a7c3a3098d890b045a1a63077107b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Wed, 11 Feb 2026 21:30:33 +0100 Subject: [PATCH 02/11] Install LLVM DLL in the right place on Windows Unlike other systems, Windows requires runtime libraries to be present in `PATH` or right next to the binary. So, we copy the library next to the binary as the easier solution. --- src/bootstrap/src/core/build_steps/dist.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index eee960027a9f9..75deb695a4823 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -2557,7 +2557,7 @@ pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection, ), )] pub fn maybe_install_llvm_runtime(builder: &Builder<'_>, target: TargetSelection, sysroot: &Path) { - let dst_libdir = sysroot.join(builder.sysroot_libdir_relative(Compiler::new(1, target))); + let dst_libdir = sysroot.join(builder.libdir_relative(Compiler::new(1, target))); // We do not need to copy LLVM files into the sysroot if it is not // dynamically linked; it is already included into librustc_llvm // statically. From 8e9a79091f6f62a232bca3e86fb58eac0611d18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Sun, 15 Feb 2026 17:37:15 +0100 Subject: [PATCH 03/11] Add LLVM lib location to the linker search paths --- compiler/rustc_metadata/src/native_libs.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index b160b3fe9bb3c..182ed433bb4f3 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -61,6 +61,8 @@ pub fn walk_native_lib_search_dirs( // library directory instead of the self-contained directories. // Sanitizer libraries have the same issue and are also linked by name on Apple targets. // The targets here should be in sync with `copy_third_party_objects` in bootstrap. + // Finally there is shared LLVM library, which unlike compiler libraries, is linked by the name, + // therefore requiring the search path for the linker. // FIXME: implement `-Clink-self-contained=+/-unwind,+/-sanitizers`, move the shipped libunwind // and sanitizers to self-contained directory, and stop adding this search path. // FIXME: On AIX this also has the side-effect of making the list of library search paths @@ -71,6 +73,9 @@ pub fn walk_native_lib_search_dirs( || sess.target.os == Os::Fuchsia || sess.target.is_like_aix || sess.target.is_like_darwin && !sess.sanitizers().is_empty() + || sess.target.os == Os::Windows + && sess.target.env == Env::Gnu + && sess.target.abi == Abi::Llvm { f(&sess.target_tlib_path.dir, false)?; } From 1d1280aae1e31b9ae9325fddc0c57ffc5074f434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Wed, 28 Jan 2026 21:10:05 +0100 Subject: [PATCH 04/11] Build shared LLVM lib for windows-gnullvm --- src/ci/github-actions/jobs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 6e07ffc43bc21..9fa9577189f11 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -691,6 +691,7 @@ auto: --target=aarch64-pc-windows-gnullvm,i686-pc-windows-gnullvm --enable-full-tools --enable-profiler + --enable-llvm-link-shared DIST_REQUIRE_ALL_TOOLS: 1 CODEGEN_BACKENDS: llvm,cranelift CC_i686_pc_windows_gnullvm: i686-w64-mingw32-clang @@ -703,6 +704,7 @@ auto: --build=x86_64-pc-windows-gnullvm --enable-full-tools --enable-profiler + --enable-llvm-link-shared DIST_REQUIRE_ALL_TOOLS: 1 CODEGEN_BACKENDS: llvm,cranelift <<: *job-windows From 3b5874e570e78d74b43d2b9a849b7d3d03c24ef0 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sat, 14 Feb 2026 00:45:59 +0100 Subject: [PATCH 05/11] Improve `VaList` stdlib docs --- library/core/src/ffi/va_list.rs | 52 +++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/library/core/src/ffi/va_list.rs b/library/core/src/ffi/va_list.rs index d0f155316a109..10e8aee89d251 100644 --- a/library/core/src/ffi/va_list.rs +++ b/library/core/src/ffi/va_list.rs @@ -183,7 +183,44 @@ crate::cfg_select! { } } -/// A variable argument list, equivalent to `va_list` in C. +/// A variable argument list, ABI-compatible with `va_list` in C. +/// +/// This type is created in c-variadic functions when `...` is desugared. A `VaList` +/// is automatically initialized (equivalent to calling `va_start` in C). +/// +/// ``` +/// #![feature(c_variadic)] +/// +/// use std::ffi::VaList; +/// +/// /// # Safety +/// /// Must be passed at least `count` arguments of type `i32`. +/// unsafe extern "C" fn my_func(count: u32, ap: ...) -> i32 { +/// unsafe { vmy_func(count, ap) } +/// } +/// +/// /// # Safety +/// /// Must be passed at least `count` arguments of type `i32`. +/// unsafe fn vmy_func(count: u32, mut ap: VaList<'_>) -> i32 { +/// let mut sum = 0; +/// for _ in 0..count { +/// sum += unsafe { ap.arg::() }; +/// } +/// sum +/// } +/// +/// assert_eq!(unsafe { my_func(1, 42i32) }, 42); +/// assert_eq!(unsafe { my_func(3, 42i32, -7i32, 20i32) }, 55); +/// ``` +/// +/// The [`VaList::arg`] method can be used to read an argument from the list. This method +/// automatically advances the `VaList` to the next argument. The C equivalent is `va_arg`. +/// +/// Cloning a `VaList` performs the equivalent of C `va_copy`, producing an independent cursor +/// that arguments can be read from without affecting the original. Dropping a `VaList` performs +/// the equivalent of C `va_end`. +/// +/// This can be used across an FFI boundary, and fully matches the platform's `va_list`. #[repr(transparent)] #[lang = "va_list"] pub struct VaList<'a> { @@ -276,20 +313,17 @@ unsafe impl VaArgSafe for *mut T {} unsafe impl VaArgSafe for *const T {} impl<'f> VaList<'f> { - /// Advance to and read the next variable argument. + /// Read an argument from the variable argument list, and advance to the next argument. /// - /// # Safety + /// Only types that implement [`VaArgSafe`] can be read from a variable argument list. /// - /// This function is only sound to call when: + /// # Safety /// - /// - there is a next variable argument available. - /// - the next argument's type must be ABI-compatible with the type `T`. - /// - the next argument must have a properly initialized value of type `T`. + /// This function is only sound to call when there is another argument to read, and that + /// argument is a properly initialized value of the type `T`. /// /// Calling this function with an incompatible type, an invalid value, or when there /// are no more variable arguments, is unsound. - /// - /// [valid]: https://doc.rust-lang.org/nightly/nomicon/what-unsafe-does.html #[inline] pub unsafe fn arg(&mut self) -> T { // SAFETY: the caller must uphold the safety contract for `va_arg`. From fbb34d8c753fd10d387056b2ce0d4d58370b8191 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sun, 15 Feb 2026 18:42:52 +1100 Subject: [PATCH 06/11] Remove wrapper struct `QueryCtxt` This struct was only wrapping `TyCtxt` in order to implement traits that were removed by RUST-152636. This commit also slightly simplifies the signature of `execute_job_incr`, by having it call `tcx.dep_graph.data()` internally. --- compiler/rustc_interface/src/interface.rs | 4 +- compiler/rustc_interface/src/util.rs | 5 +- compiler/rustc_query_impl/src/execution.rs | 181 ++++++++++--------- compiler/rustc_query_impl/src/job.rs | 10 +- compiler/rustc_query_impl/src/lib.rs | 22 +-- compiler/rustc_query_impl/src/plumbing.rs | 200 +++++++++------------ 6 files changed, 201 insertions(+), 221 deletions(-) diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 34c064362168e..2c3afcc7a0360 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -16,7 +16,7 @@ use rustc_parse::lexer::StripTokens; use rustc_parse::new_parser_from_source_str; use rustc_parse::parser::Recovery; use rustc_parse::parser::attr::AllowLeadingUnsafe; -use rustc_query_impl::{QueryCtxt, print_query_stack}; +use rustc_query_impl::print_query_stack; use rustc_session::config::{self, Cfg, CheckCfg, ExpectedValues, Input, OutFileName}; use rustc_session::parse::ParseSess; use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, lint}; @@ -556,7 +556,7 @@ pub fn try_print_query_stack( let all_frames = ty::tls::with_context_opt(|icx| { if let Some(icx) = icx { ty::print::with_no_queries!(print_query_stack( - QueryCtxt::new(icx.tcx), + icx.tcx, icx.query, dcx, limit_frames, diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index 613b3c64efed2..08e40116b47c0 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -18,6 +18,7 @@ use rustc_data_structures::sync; use rustc_metadata::{DylibError, EncodedMetadata, load_symbol_from_dylib}; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; use rustc_middle::ty::{CurrentGcx, TyCtxt}; +use rustc_query_impl::collect_active_jobs_from_all_queries; use rustc_session::config::{ Cfg, CrateType, OutFileName, OutputFilenames, OutputTypes, Sysroot, host_tuple, }; @@ -184,7 +185,7 @@ pub(crate) fn run_in_thread_pool_with_globals< use rustc_data_structures::defer; use rustc_data_structures::sync::FromDyn; use rustc_middle::ty::tls; - use rustc_query_impl::{QueryCtxt, break_query_cycles}; + use rustc_query_impl::break_query_cycles; let thread_stack_size = init_stack_size(thread_builder_diag); @@ -253,7 +254,7 @@ internal compiler error: query cycle handler thread panicked, aborting process"; || { // Ensure there were no errors collecting all active jobs. // We need the complete map to ensure we find a cycle to break. - QueryCtxt::new(tcx).collect_active_jobs_from_all_queries(false).expect( + collect_active_jobs_from_all_queries(tcx, false).expect( "failed to collect active queries in deadlock handler", ) }, diff --git a/compiler/rustc_query_impl/src/execution.rs b/compiler/rustc_query_impl/src/execution.rs index 826a794bc8fa6..e9996054211b9 100644 --- a/compiler/rustc_query_impl/src/execution.rs +++ b/compiler/rustc_query_impl/src/execution.rs @@ -5,7 +5,7 @@ use rustc_data_structures::hash_table::{Entry, HashTable}; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::{outline, sharded, sync}; use rustc_errors::{Diag, FatalError, StashKey}; -use rustc_middle::dep_graph::{DepGraphData, DepNodeKey, HasDepContext}; +use rustc_middle::dep_graph::{DepGraphData, DepNodeKey}; use rustc_middle::query::{ ActiveKeyStatus, CycleError, CycleErrorHandling, QueryCache, QueryJob, QueryJobId, QueryLatch, QueryMode, QueryStackDeferred, QueryStackFrame, QueryState, @@ -16,7 +16,10 @@ use rustc_span::{DUMMY_SP, Span}; use crate::dep_graph::{DepNode, DepNodeIndex}; use crate::job::{QueryJobInfo, QueryJobMap, find_cycle_in_stack, report_cycle}; -use crate::{QueryCtxt, QueryFlags, SemiDynamicQueryDispatcher}; +use crate::plumbing::{ + collect_active_jobs_from_all_queries, current_query_job, next_job_id, start_query, +}; +use crate::{QueryFlags, SemiDynamicQueryDispatcher}; #[inline] fn equivalent_key(k: &K) -> impl Fn(&(K, V)) -> bool + '_ { @@ -101,32 +104,32 @@ where #[inline(never)] fn mk_cycle<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, cycle_error: CycleError, ) -> C::Value { - let error = report_cycle(qcx.tcx.sess, &cycle_error); - handle_cycle_error(query, qcx, &cycle_error, error) + let error = report_cycle(tcx.sess, &cycle_error); + handle_cycle_error(query, tcx, &cycle_error, error) } fn handle_cycle_error<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, cycle_error: &CycleError, error: Diag<'_>, ) -> C::Value { match query.cycle_error_handling() { CycleErrorHandling::Error => { let guar = error.emit(); - query.value_from_cycle_error(qcx.tcx, cycle_error, guar) + query.value_from_cycle_error(tcx, cycle_error, guar) } CycleErrorHandling::Fatal => { error.emit(); - qcx.tcx.dcx().abort_if_errors(); + tcx.dcx().abort_if_errors(); unreachable!() } CycleErrorHandling::DelayBug => { let guar = error.delay_as_bug(); - query.value_from_cycle_error(qcx.tcx, cycle_error, guar) + query.value_from_cycle_error(tcx, cycle_error, guar) } CycleErrorHandling::Stash => { let guar = if let Some(root) = cycle_error.cycle.first() @@ -136,7 +139,7 @@ fn handle_cycle_error<'tcx, C: QueryCache, const FLAGS: QueryFlags>( } else { error.emit() }; - query.value_from_cycle_error(qcx.tcx, cycle_error, guar) + query.value_from_cycle_error(tcx, cycle_error, guar) } } } @@ -207,25 +210,24 @@ where #[inline(never)] fn cycle_error<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, try_execute: QueryJobId, span: Span, ) -> (C::Value, Option) { // Ensure there was no errors collecting all active jobs. // We need the complete map to ensure we find a cycle to break. - let job_map = qcx - .collect_active_jobs_from_all_queries(false) + let job_map = collect_active_jobs_from_all_queries(tcx, false) .ok() .expect("failed to collect active queries"); - let error = find_cycle_in_stack(try_execute, job_map, &qcx.current_query_job(), span); - (mk_cycle(query, qcx, error.lift()), None) + let error = find_cycle_in_stack(try_execute, job_map, ¤t_query_job(tcx), span); + (mk_cycle(query, tcx, error.lift()), None) } #[inline(always)] fn wait_for_query<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, span: Span, key: C::Key, latch: QueryLatch<'tcx>, @@ -234,20 +236,20 @@ fn wait_for_query<'tcx, C: QueryCache, const FLAGS: QueryFlags>( // For parallel queries, we'll block and wait until the query running // in another thread has completed. Record how long we wait in the // self-profiler. - let query_blocked_prof_timer = qcx.tcx.prof.query_blocked(); + let query_blocked_prof_timer = tcx.prof.query_blocked(); // With parallel queries we might just have to wait on some other // thread. - let result = latch.wait_on(qcx.tcx, current, span); + let result = latch.wait_on(tcx, current, span); match result { Ok(()) => { - let Some((v, index)) = query.query_cache(qcx).lookup(&key) else { + let Some((v, index)) = query.query_cache(tcx).lookup(&key) else { outline(|| { // We didn't find the query result in the query cache. Check if it was // poisoned due to a panic instead. let key_hash = sharded::make_hash(&key); - let shard = query.query_state(qcx).active.lock_shard_by_hash(key_hash); + let shard = query.query_state(tcx).active.lock_shard_by_hash(key_hash); match shard.find(key_hash, equivalent_key(&key)) { // The query we waited on panicked. Continue unwinding here. Some((_, ActiveKeyStatus::Poisoned)) => FatalError.raise(), @@ -259,24 +261,24 @@ fn wait_for_query<'tcx, C: QueryCache, const FLAGS: QueryFlags>( }) }; - qcx.tcx.prof.query_cache_hit(index.into()); + tcx.prof.query_cache_hit(index.into()); query_blocked_prof_timer.finish_with_query_invocation_id(index.into()); (v, Some(index)) } - Err(cycle) => (mk_cycle(query, qcx, cycle.lift()), None), + Err(cycle) => (mk_cycle(query, tcx, cycle.lift()), None), } } #[inline(never)] fn try_execute_query<'tcx, C: QueryCache, const FLAGS: QueryFlags, const INCR: bool>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, span: Span, key: C::Key, dep_node: Option, ) -> (C::Value, Option) { - let state = query.query_state(qcx); + let state = query.query_state(tcx); let key_hash = sharded::make_hash(&key); let mut state_lock = state.active.lock_shard_by_hash(key_hash); @@ -286,27 +288,27 @@ fn try_execute_query<'tcx, C: QueryCache, const FLAGS: QueryFlags, const INCR: b // re-executing the query since `try_start` only checks that the query is not currently // executing, but another thread may have already completed the query and stores it result // in the query cache. - if qcx.tcx.sess.threads() > 1 { - if let Some((value, index)) = query.query_cache(qcx).lookup(&key) { - qcx.tcx.prof.query_cache_hit(index.into()); + if tcx.sess.threads() > 1 { + if let Some((value, index)) = query.query_cache(tcx).lookup(&key) { + tcx.prof.query_cache_hit(index.into()); return (value, Some(index)); } } - let current_job_id = qcx.current_query_job(); + let current_job_id = current_query_job(tcx); match state_lock.entry(key_hash, equivalent_key(&key), |(k, _)| sharded::make_hash(k)) { Entry::Vacant(entry) => { // Nothing has computed or is computing the query, so we start a new job and insert it in the // state map. - let id = qcx.next_job_id(); + let id = next_job_id(tcx); let job = QueryJob::new(id, span, current_job_id); entry.insert((key, ActiveKeyStatus::Started(job))); // Drop the lock before we start executing the query drop(state_lock); - execute_job::(query, qcx, state, key, key_hash, id, dep_node) + execute_job::(query, tcx, state, key, key_hash, id, dep_node) } Entry::Occupied(mut entry) => { match &mut entry.get_mut().1 { @@ -318,7 +320,7 @@ fn try_execute_query<'tcx, C: QueryCache, const FLAGS: QueryFlags, const INCR: b // Only call `wait_for_query` if we're using a Rayon thread pool // as it will attempt to mark the worker thread as blocked. - return wait_for_query(query, qcx, span, key, latch, current_job_id); + return wait_for_query(query, tcx, span, key, latch, current_job_id); } let id = job.id; @@ -326,7 +328,7 @@ fn try_execute_query<'tcx, C: QueryCache, const FLAGS: QueryFlags, const INCR: b // If we are single-threaded we know that we have cycle error, // so we just return the error. - cycle_error(query, qcx, id, span) + cycle_error(query, tcx, id, span) } ActiveKeyStatus::Poisoned => FatalError.raise(), } @@ -337,7 +339,7 @@ fn try_execute_query<'tcx, C: QueryCache, const FLAGS: QueryFlags, const INCR: b #[inline(always)] fn execute_job<'tcx, C: QueryCache, const FLAGS: QueryFlags, const INCR: bool>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, state: &'tcx QueryState<'tcx, C::Key>, key: C::Key, key_hash: u64, @@ -348,16 +350,16 @@ fn execute_job<'tcx, C: QueryCache, const FLAGS: QueryFlags, const INCR: bool>( // panic occurs while executing the query (or any intermediate plumbing). let job_guard = ActiveJobGuard { state, key, key_hash }; - debug_assert_eq!(qcx.tcx.dep_graph.is_fully_enabled(), INCR); + debug_assert_eq!(tcx.dep_graph.is_fully_enabled(), INCR); // Delegate to another function to actually execute the query job. let (result, dep_node_index) = if INCR { - execute_job_incr(query, qcx, qcx.tcx.dep_graph.data().unwrap(), key, dep_node, id) + execute_job_incr(query, tcx, key, dep_node, id) } else { - execute_job_non_incr(query, qcx, key, id) + execute_job_non_incr(query, tcx, key, id) }; - let cache = query.query_cache(qcx); + let cache = query.query_cache(tcx); if query.feedable() { // We should not compute queries that also got a value via feeding. // This can't happen, as query feeding adds the very dependencies to the fed query @@ -373,7 +375,7 @@ fn execute_job<'tcx, C: QueryCache, const FLAGS: QueryFlags, const INCR: bool>( ); }; - let (old_hash, new_hash) = qcx.dep_context().with_stable_hashing_context(|mut hcx| { + let (old_hash, new_hash) = tcx.with_stable_hashing_context(|mut hcx| { (hasher(&mut hcx, &cached_result), hasher(&mut hcx, &result)) }); let formatter = query.format_value(); @@ -381,7 +383,7 @@ fn execute_job<'tcx, C: QueryCache, const FLAGS: QueryFlags, const INCR: bool>( // We have an inconsistency. This can happen if one of the two // results is tainted by errors. assert!( - qcx.tcx.dcx().has_errors().is_some(), + tcx.dcx().has_errors().is_some(), "Computed query value for {:?}({:?}) is inconsistent with fed value,\n\ computed={:#?}\nfed={:#?}", query.dep_kind(), @@ -403,22 +405,22 @@ fn execute_job<'tcx, C: QueryCache, const FLAGS: QueryFlags, const INCR: bool>( #[inline(always)] fn execute_job_non_incr<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, key: C::Key, job_id: QueryJobId, ) -> (C::Value, DepNodeIndex) { - debug_assert!(!qcx.tcx.dep_graph.is_fully_enabled()); + debug_assert!(!tcx.dep_graph.is_fully_enabled()); // Fingerprint the key, just to assert that it doesn't // have anything we don't consider hashable if cfg!(debug_assertions) { - let _ = key.to_fingerprint(qcx.tcx); + let _ = key.to_fingerprint(tcx); } - let prof_timer = qcx.tcx.prof.query_provider(); + let prof_timer = tcx.prof.query_provider(); // Call the query provider. - let result = qcx.start_query(job_id, query.depth_limit(), || query.invoke_provider(qcx, key)); - let dep_node_index = qcx.tcx.dep_graph.next_virtual_depnode_index(); + let result = start_query(tcx, job_id, query.depth_limit(), || query.invoke_provider(tcx, key)); + let dep_node_index = tcx.dep_graph.next_virtual_depnode_index(); prof_timer.finish_with_query_invocation_id(dep_node_index.into()); // Similarly, fingerprint the result to assert that @@ -426,7 +428,7 @@ fn execute_job_non_incr<'tcx, C: QueryCache, const FLAGS: QueryFlags>( if cfg!(debug_assertions) && let Some(hash_result) = query.hash_result() { - qcx.dep_context().with_stable_hashing_context(|mut hcx| { + tcx.with_stable_hashing_context(|mut hcx| { hash_result(&mut hcx, &result); }); } @@ -437,44 +439,45 @@ fn execute_job_non_incr<'tcx, C: QueryCache, const FLAGS: QueryFlags>( #[inline(always)] fn execute_job_incr<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, - dep_graph_data: &DepGraphData, + tcx: TyCtxt<'tcx>, key: C::Key, mut dep_node_opt: Option, job_id: QueryJobId, ) -> (C::Value, DepNodeIndex) { + let dep_graph_data = + tcx.dep_graph.data().expect("should always be present in incremental mode"); + if !query.anon() && !query.eval_always() { // `to_dep_node` is expensive for some `DepKind`s. - let dep_node = dep_node_opt.get_or_insert_with(|| query.construct_dep_node(qcx.tcx, &key)); + let dep_node = dep_node_opt.get_or_insert_with(|| query.construct_dep_node(tcx, &key)); // The diagnostics for this query will be promoted to the current session during // `try_mark_green()`, so we can ignore them here. - if let Some(ret) = qcx.start_query(job_id, false, || { - try_load_from_disk_and_cache_in_memory(query, dep_graph_data, qcx, &key, dep_node) + if let Some(ret) = start_query(tcx, job_id, false, || { + try_load_from_disk_and_cache_in_memory(query, dep_graph_data, tcx, &key, dep_node) }) { return ret; } } - let prof_timer = qcx.tcx.prof.query_provider(); + let prof_timer = tcx.prof.query_provider(); - let (result, dep_node_index) = qcx.start_query(job_id, query.depth_limit(), || { + let (result, dep_node_index) = start_query(tcx, job_id, query.depth_limit(), || { if query.anon() { // Call the query provider inside an anon task. - return dep_graph_data.with_anon_task_inner(qcx.tcx, query.dep_kind(), || { - query.invoke_provider(qcx, key) - }); + return dep_graph_data + .with_anon_task_inner(tcx, query.dep_kind(), || query.invoke_provider(tcx, key)); } // `to_dep_node` is expensive for some `DepKind`s. - let dep_node = dep_node_opt.unwrap_or_else(|| query.construct_dep_node(qcx.tcx, &key)); + let dep_node = dep_node_opt.unwrap_or_else(|| query.construct_dep_node(tcx, &key)); // Call the query provider. dep_graph_data.with_task( dep_node, - (qcx, query), + (tcx, query), key, - |(qcx, query), key| query.invoke_provider(qcx, key), + |(tcx, query), key| query.invoke_provider(tcx, key), query.hash_result(), ) }); @@ -488,21 +491,21 @@ fn execute_job_incr<'tcx, C: QueryCache, const FLAGS: QueryFlags>( fn try_load_from_disk_and_cache_in_memory<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, dep_graph_data: &DepGraphData, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, key: &C::Key, dep_node: &DepNode, ) -> Option<(C::Value, DepNodeIndex)> { // Note this function can be called concurrently from the same query // We must ensure that this is handled correctly. - let (prev_dep_node_index, dep_node_index) = dep_graph_data.try_mark_green(qcx.tcx, dep_node)?; + let (prev_dep_node_index, dep_node_index) = dep_graph_data.try_mark_green(tcx, dep_node)?; debug_assert!(dep_graph_data.is_index_green(prev_dep_node_index)); // First we try to load the result from the on-disk cache. // Some things are never cached on disk. - if let Some(result) = query.try_load_from_disk(qcx, key, prev_dep_node_index, dep_node_index) { - if std::intrinsics::unlikely(qcx.tcx.sess.opts.unstable_opts.query_dep_graph) { + if let Some(result) = query.try_load_from_disk(tcx, key, prev_dep_node_index, dep_node_index) { + if std::intrinsics::unlikely(tcx.sess.opts.unstable_opts.query_dep_graph) { dep_graph_data.mark_debug_loaded_from_disk(*dep_node) } @@ -516,10 +519,10 @@ fn try_load_from_disk_and_cache_in_memory<'tcx, C: QueryCache, const FLAGS: Quer // give us some coverage of potential bugs though. let try_verify = prev_fingerprint.split().1.as_u64().is_multiple_of(32); if std::intrinsics::unlikely( - try_verify || qcx.tcx.sess.opts.unstable_opts.incremental_verify_ich, + try_verify || tcx.sess.opts.unstable_opts.incremental_verify_ich, ) { incremental_verify_ich( - qcx.tcx, + tcx, dep_graph_data, &result, prev_dep_node_index, @@ -534,25 +537,25 @@ fn try_load_from_disk_and_cache_in_memory<'tcx, C: QueryCache, const FLAGS: Quer // We always expect to find a cached result for things that // can be forced from `DepNode`. debug_assert!( - !query.will_cache_on_disk_for_key(qcx.tcx, key) - || !qcx.tcx.fingerprint_style(dep_node.kind).reconstructible(), + !query.will_cache_on_disk_for_key(tcx, key) + || !tcx.fingerprint_style(dep_node.kind).reconstructible(), "missing on-disk cache entry for {dep_node:?}" ); // Sanity check for the logic in `ensure`: if the node is green and the result loadable, // we should actually be able to load it. debug_assert!( - !query.is_loadable_from_disk(qcx, key, prev_dep_node_index), + !query.is_loadable_from_disk(tcx, key, prev_dep_node_index), "missing on-disk cache entry for loadable {dep_node:?}" ); // We could not load a result from the on-disk cache, so // recompute. - let prof_timer = qcx.tcx.prof.query_provider(); + let prof_timer = tcx.prof.query_provider(); // The dep-graph for this computation is already in-place. // Call the query provider. - let result = qcx.tcx.dep_graph.with_ignore(|| query.invoke_provider(qcx, *key)); + let result = tcx.dep_graph.with_ignore(|| query.invoke_provider(tcx, *key)); prof_timer.finish_with_query_invocation_id(dep_node_index.into()); @@ -566,7 +569,7 @@ fn try_load_from_disk_and_cache_in_memory<'tcx, C: QueryCache, const FLAGS: Quer // See issue #82920 for an example of a miscompilation that would get turned into // an ICE by this check incremental_verify_ich( - qcx.tcx, + tcx, dep_graph_data, &result, prev_dep_node_index, @@ -588,7 +591,7 @@ fn try_load_from_disk_and_cache_in_memory<'tcx, C: QueryCache, const FLAGS: Quer #[inline(never)] fn ensure_must_run<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, key: &C::Key, check_cache: bool, ) -> (bool, Option) { @@ -599,10 +602,10 @@ fn ensure_must_run<'tcx, C: QueryCache, const FLAGS: QueryFlags>( // Ensuring an anonymous query makes no sense assert!(!query.anon()); - let dep_node = query.construct_dep_node(qcx.tcx, key); + let dep_node = query.construct_dep_node(tcx, key); - let dep_graph = &qcx.tcx.dep_graph; - let serialized_dep_node_index = match dep_graph.try_mark_green(qcx.tcx, &dep_node) { + let dep_graph = &tcx.dep_graph; + let serialized_dep_node_index = match dep_graph.try_mark_green(tcx, &dep_node) { None => { // A None return from `try_mark_green` means that this is either // a new dep node or that the dep node has already been marked red. @@ -614,7 +617,7 @@ fn ensure_must_run<'tcx, C: QueryCache, const FLAGS: QueryFlags>( } Some((serialized_dep_node_index, dep_node_index)) => { dep_graph.read_index(dep_node_index); - qcx.tcx.prof.query_cache_hit(dep_node_index.into()); + tcx.prof.query_cache_hit(dep_node_index.into()); serialized_dep_node_index } }; @@ -624,34 +627,34 @@ fn ensure_must_run<'tcx, C: QueryCache, const FLAGS: QueryFlags>( return (false, None); } - let loadable = query.is_loadable_from_disk(qcx, key, serialized_dep_node_index); + let loadable = query.is_loadable_from_disk(tcx, key, serialized_dep_node_index); (!loadable, Some(dep_node)) } #[inline(always)] pub(super) fn get_query_non_incr<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, span: Span, key: C::Key, ) -> C::Value { - debug_assert!(!qcx.tcx.dep_graph.is_fully_enabled()); + debug_assert!(!tcx.dep_graph.is_fully_enabled()); - ensure_sufficient_stack(|| try_execute_query::(query, qcx, span, key, None).0) + ensure_sufficient_stack(|| try_execute_query::(query, tcx, span, key, None).0) } #[inline(always)] pub(super) fn get_query_incr<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, span: Span, key: C::Key, mode: QueryMode, ) -> Option { - debug_assert!(qcx.tcx.dep_graph.is_fully_enabled()); + debug_assert!(tcx.dep_graph.is_fully_enabled()); let dep_node = if let QueryMode::Ensure { check_cache } = mode { - let (must_run, dep_node) = ensure_must_run(query, qcx, &key, check_cache); + let (must_run, dep_node) = ensure_must_run(query, tcx, &key, check_cache); if !must_run { return None; } @@ -661,30 +664,30 @@ pub(super) fn get_query_incr<'tcx, C: QueryCache, const FLAGS: QueryFlags>( }; let (result, dep_node_index) = ensure_sufficient_stack(|| { - try_execute_query::(query, qcx, span, key, dep_node) + try_execute_query::(query, tcx, span, key, dep_node) }); if let Some(dep_node_index) = dep_node_index { - qcx.tcx.dep_graph.read_index(dep_node_index) + tcx.dep_graph.read_index(dep_node_index) } Some(result) } pub(crate) fn force_query<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, key: C::Key, dep_node: DepNode, ) { // We may be concurrently trying both execute and force a query. // Ensure that only one of them runs the query. - if let Some((_, index)) = query.query_cache(qcx).lookup(&key) { - qcx.tcx.prof.query_cache_hit(index.into()); + if let Some((_, index)) = query.query_cache(tcx).lookup(&key) { + tcx.prof.query_cache_hit(index.into()); return; } debug_assert!(!query.anon()); ensure_sufficient_stack(|| { - try_execute_query::(query, qcx, DUMMY_SP, key, Some(dep_node)) + try_execute_query::(query, tcx, DUMMY_SP, key, Some(dep_node)) }); } diff --git a/compiler/rustc_query_impl/src/job.rs b/compiler/rustc_query_impl/src/job.rs index dfe3278df7642..1256b514edb5c 100644 --- a/compiler/rustc_query_impl/src/job.rs +++ b/compiler/rustc_query_impl/src/job.rs @@ -10,10 +10,11 @@ use rustc_middle::query::{ CycleError, QueryInfo, QueryJob, QueryJobId, QueryLatch, QueryStackDeferred, QueryStackFrame, QueryWaiter, }; +use rustc_middle::ty::TyCtxt; use rustc_session::Session; use rustc_span::{DUMMY_SP, Span}; -use crate::QueryCtxt; +use crate::plumbing::collect_active_jobs_from_all_queries; /// Map from query job IDs to job information collected by /// `collect_active_jobs_from_all_queries`. @@ -384,7 +385,7 @@ pub fn break_query_cycles<'tcx>( } pub fn print_query_stack<'tcx>( - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, mut current_query: Option, dcx: DiagCtxtHandle<'_>, limit_frames: Option, @@ -397,8 +398,7 @@ pub fn print_query_stack<'tcx>( let mut count_total = 0; // Make use of a partial query job map if we fail to take locks collecting active queries. - let job_map: QueryJobMap<'_> = qcx - .collect_active_jobs_from_all_queries(false) + let job_map: QueryJobMap<'_> = collect_active_jobs_from_all_queries(tcx, false) .unwrap_or_else(|partial_job_map| partial_job_map); if let Some(ref mut file) = file { @@ -425,7 +425,7 @@ pub fn print_query_stack<'tcx>( file, "#{} [{}] {}", count_total, - qcx.tcx.dep_kind_vtable(query_info.frame.dep_kind).name, + tcx.dep_kind_vtable(query_info.frame.dep_kind).name, query_extra.description ); } diff --git a/compiler/rustc_query_impl/src/lib.rs b/compiler/rustc_query_impl/src/lib.rs index 6a4171afe4bc1..8731414eb04ef 100644 --- a/compiler/rustc_query_impl/src/lib.rs +++ b/compiler/rustc_query_impl/src/lib.rs @@ -26,7 +26,7 @@ use rustc_span::{ErrorGuaranteed, Span}; pub use crate::dep_kind_vtables::make_dep_kind_vtables; pub use crate::job::{QueryJobMap, break_query_cycles, print_query_stack}; -pub use crate::plumbing::{QueryCtxt, query_key_hash_verify_all}; +pub use crate::plumbing::{collect_active_jobs_from_all_queries, query_key_hash_verify_all}; use crate::plumbing::{encode_all_query_results, try_mark_green}; use crate::profiling_support::QueryKeyStringCache; pub use crate::profiling_support::alloc_self_profile_query_strings; @@ -89,11 +89,11 @@ impl<'tcx, C: QueryCache, const FLAGS: QueryFlags> SemiDynamicQueryDispatcher<'t // Don't use this method to access query results, instead use the methods on TyCtxt. #[inline(always)] - fn query_state(self, qcx: QueryCtxt<'tcx>) -> &'tcx QueryState<'tcx, C::Key> { + fn query_state(self, tcx: TyCtxt<'tcx>) -> &'tcx QueryState<'tcx, C::Key> { // Safety: // This is just manually doing the subfield referencing through pointer math. unsafe { - &*(&qcx.tcx.query_system.states as *const QueryStates<'tcx>) + &*(&tcx.query_system.states as *const QueryStates<'tcx>) .byte_add(self.vtable.query_state) .cast::>() } @@ -101,11 +101,11 @@ impl<'tcx, C: QueryCache, const FLAGS: QueryFlags> SemiDynamicQueryDispatcher<'t // Don't use this method to access query results, instead use the methods on TyCtxt. #[inline(always)] - fn query_cache(self, qcx: QueryCtxt<'tcx>) -> &'tcx C { + fn query_cache(self, tcx: TyCtxt<'tcx>) -> &'tcx C { // Safety: // This is just manually doing the subfield referencing through pointer math. unsafe { - &*(&qcx.tcx.query_system.caches as *const QueryCaches<'tcx>) + &*(&tcx.query_system.caches as *const QueryCaches<'tcx>) .byte_add(self.vtable.query_cache) .cast::() } @@ -121,30 +121,30 @@ impl<'tcx, C: QueryCache, const FLAGS: QueryFlags> SemiDynamicQueryDispatcher<'t /// Calls the actual provider function for this query. /// See [`QueryVTable::invoke_provider_fn`] for more details. #[inline(always)] - fn invoke_provider(self, qcx: QueryCtxt<'tcx>, key: C::Key) -> C::Value { - (self.vtable.invoke_provider_fn)(qcx.tcx, key) + fn invoke_provider(self, tcx: TyCtxt<'tcx>, key: C::Key) -> C::Value { + (self.vtable.invoke_provider_fn)(tcx, key) } #[inline(always)] fn try_load_from_disk( self, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, key: &C::Key, prev_index: SerializedDepNodeIndex, index: DepNodeIndex, ) -> Option { // `?` will return None immediately for queries that never cache to disk. - self.vtable.try_load_from_disk_fn?(qcx.tcx, key, prev_index, index) + self.vtable.try_load_from_disk_fn?(tcx, key, prev_index, index) } #[inline] fn is_loadable_from_disk( self, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, key: &C::Key, index: SerializedDepNodeIndex, ) -> bool { - self.vtable.is_loadable_from_disk_fn.map_or(false, |f| f(qcx.tcx, key, index)) + self.vtable.is_loadable_from_disk_fn.map_or(false, |f| f(tcx, key, index)) } /// Synthesize an error value to let compilation continue after a cycle. diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 030ea29a2a6bf..00f6a7fcf9167 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -15,7 +15,7 @@ use rustc_middle::bug; #[expect(unused_imports, reason = "used by doc comments")] use rustc_middle::dep_graph::DepKindVTable; use rustc_middle::dep_graph::{ - self, DepNode, DepNodeIndex, DepNodeKey, HasDepContext, SerializedDepNodeIndex, dep_kinds, + self, DepNode, DepNodeIndex, DepNodeKey, SerializedDepNodeIndex, dep_kinds, }; use rustc_middle::query::on_disk_cache::{ AbsoluteBytePos, CacheDecoder, CacheEncoder, EncodedDepNodeIndex, @@ -36,115 +36,91 @@ use crate::execution::{all_inactive, force_query}; use crate::job::{QueryJobMap, find_dep_kind_root}; use crate::{QueryDispatcherUnerased, QueryFlags, SemiDynamicQueryDispatcher}; -#[derive(Copy, Clone)] -pub struct QueryCtxt<'tcx> { - pub tcx: TyCtxt<'tcx>, -} - -impl<'tcx> QueryCtxt<'tcx> { - #[inline] - pub fn new(tcx: TyCtxt<'tcx>) -> Self { - QueryCtxt { tcx } - } - - fn depth_limit_error(self, job: QueryJobId) { - let job_map = self - .collect_active_jobs_from_all_queries(true) - .expect("failed to collect active queries"); - let (info, depth) = find_dep_kind_root(job, job_map); +fn depth_limit_error<'tcx>(tcx: TyCtxt<'tcx>, job: QueryJobId) { + let job_map = + collect_active_jobs_from_all_queries(tcx, true).expect("failed to collect active queries"); + let (info, depth) = find_dep_kind_root(job, job_map); - let suggested_limit = match self.tcx.recursion_limit() { - Limit(0) => Limit(2), - limit => limit * 2, - }; + let suggested_limit = match tcx.recursion_limit() { + Limit(0) => Limit(2), + limit => limit * 2, + }; - self.tcx.sess.dcx().emit_fatal(QueryOverflow { - span: info.job.span, - note: QueryOverflowNote { desc: info.frame.info.extract().description, depth }, - suggested_limit, - crate_name: self.tcx.crate_name(LOCAL_CRATE), - }); - } + tcx.sess.dcx().emit_fatal(QueryOverflow { + span: info.job.span, + note: QueryOverflowNote { desc: info.frame.info.extract().description, depth }, + suggested_limit, + crate_name: tcx.crate_name(LOCAL_CRATE), + }); +} - #[inline] - pub(crate) fn next_job_id(self) -> QueryJobId { - QueryJobId( - NonZero::new( - self.tcx.query_system.jobs.fetch_add(1, std::sync::atomic::Ordering::Relaxed), - ) +#[inline] +pub(crate) fn next_job_id<'tcx>(tcx: TyCtxt<'tcx>) -> QueryJobId { + QueryJobId( + NonZero::new(tcx.query_system.jobs.fetch_add(1, std::sync::atomic::Ordering::Relaxed)) .unwrap(), - ) - } + ) +} - #[inline] - pub(crate) fn current_query_job(self) -> Option { - tls::with_related_context(self.tcx, |icx| icx.query) - } +#[inline] +pub(crate) fn current_query_job<'tcx>(tcx: TyCtxt<'tcx>) -> Option { + tls::with_related_context(tcx, |icx| icx.query) +} - /// Executes a job by changing the `ImplicitCtxt` to point to the - /// new query job while it executes. - #[inline(always)] - pub(crate) fn start_query( - self, - token: QueryJobId, - depth_limit: bool, - compute: impl FnOnce() -> R, - ) -> R { - // The `TyCtxt` stored in TLS has the same global interner lifetime - // as `self`, so we use `with_related_context` to relate the 'tcx lifetimes - // when accessing the `ImplicitCtxt`. - tls::with_related_context(self.tcx, move |current_icx| { - if depth_limit - && !self.tcx.recursion_limit().value_within_limit(current_icx.query_depth) - { - self.depth_limit_error(token); - } +/// Executes a job by changing the `ImplicitCtxt` to point to the +/// new query job while it executes. +#[inline(always)] +pub(crate) fn start_query<'tcx, R>( + tcx: TyCtxt<'tcx>, + token: QueryJobId, + depth_limit: bool, + compute: impl FnOnce() -> R, +) -> R { + // The `TyCtxt` stored in TLS has the same global interner lifetime + // as `self`, so we use `with_related_context` to relate the 'tcx lifetimes + // when accessing the `ImplicitCtxt`. + tls::with_related_context(tcx, move |current_icx| { + if depth_limit && !tcx.recursion_limit().value_within_limit(current_icx.query_depth) { + depth_limit_error(tcx, token); + } - // Update the `ImplicitCtxt` to point to our new query job. - let new_icx = ImplicitCtxt { - tcx: self.tcx, - query: Some(token), - query_depth: current_icx.query_depth + depth_limit as usize, - task_deps: current_icx.task_deps, - }; + // Update the `ImplicitCtxt` to point to our new query job. + let new_icx = ImplicitCtxt { + tcx, + query: Some(token), + query_depth: current_icx.query_depth + depth_limit as usize, + task_deps: current_icx.task_deps, + }; - // Use the `ImplicitCtxt` while we execute the query. - tls::enter_context(&new_icx, compute) - }) - } + // Use the `ImplicitCtxt` while we execute the query. + tls::enter_context(&new_icx, compute) + }) +} - /// Returns a map of currently active query jobs, collected from all queries. - /// - /// If `require_complete` is `true`, this function locks all shards of the - /// query results to produce a complete map, which always returns `Ok`. - /// Otherwise, it may return an incomplete map as an error if any shard - /// lock cannot be acquired. - /// - /// Prefer passing `false` to `require_complete` to avoid potential deadlocks, - /// especially when called from within a deadlock handler, unless a - /// complete map is needed and no deadlock is possible at this call site. - pub fn collect_active_jobs_from_all_queries( - self, - require_complete: bool, - ) -> Result, QueryJobMap<'tcx>> { - let mut job_map_out = QueryJobMap::default(); - let mut complete = true; - - for gather_fn in crate::PER_QUERY_GATHER_ACTIVE_JOBS_FNS.iter() { - if gather_fn(self.tcx, require_complete, &mut job_map_out).is_none() { - complete = false; - } +/// Returns a map of currently active query jobs, collected from all queries. +/// +/// If `require_complete` is `true`, this function locks all shards of the +/// query results to produce a complete map, which always returns `Ok`. +/// Otherwise, it may return an incomplete map as an error if any shard +/// lock cannot be acquired. +/// +/// Prefer passing `false` to `require_complete` to avoid potential deadlocks, +/// especially when called from within a deadlock handler, unless a +/// complete map is needed and no deadlock is possible at this call site. +pub fn collect_active_jobs_from_all_queries<'tcx>( + tcx: TyCtxt<'tcx>, + require_complete: bool, +) -> Result, QueryJobMap<'tcx>> { + let mut job_map_out = QueryJobMap::default(); + let mut complete = true; + + for gather_fn in crate::PER_QUERY_GATHER_ACTIVE_JOBS_FNS.iter() { + if gather_fn(tcx, require_complete, &mut job_map_out).is_none() { + complete = false; } - - if complete { Ok(job_map_out) } else { Err(job_map_out) } } -} -impl<'tcx> HasDepContext<'tcx> for QueryCtxt<'tcx> { - #[inline] - fn dep_context(&self) -> TyCtxt<'tcx> { - self.tcx - } + if complete { Ok(job_map_out) } else { Err(job_map_out) } } pub(super) fn try_mark_green<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &dep_graph::DepNode) -> bool { @@ -361,19 +337,19 @@ where pub(crate) fn encode_query_results<'a, 'tcx, Q, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, encoder: &mut CacheEncoder<'a, 'tcx>, query_result_index: &mut EncodedDepNodeIndex, ) where Q: QueryDispatcherUnerased<'tcx, C, FLAGS>, Q::UnerasedValue: Encodable>, { - let _timer = qcx.tcx.prof.generic_activity_with_arg("encode_query_results_for", query.name()); + let _timer = tcx.prof.generic_activity_with_arg("encode_query_results_for", query.name()); - assert!(all_inactive(query.query_state(qcx))); - let cache = query.query_cache(qcx); + assert!(all_inactive(query.query_state(tcx))); + let cache = query.query_cache(tcx); cache.iter(&mut |key, value, dep_node| { - if query.will_cache_on_disk_for_key(qcx.tcx, key) { + if query.will_cache_on_disk_for_key(tcx, key) { let dep_node = SerializedDepNodeIndex::new(dep_node.index()); // Record position of the cache entry. @@ -388,14 +364,14 @@ pub(crate) fn encode_query_results<'a, 'tcx, Q, C: QueryCache, const FLAGS: Quer pub(crate) fn query_key_hash_verify<'tcx, C: QueryCache, const FLAGS: QueryFlags>( query: SemiDynamicQueryDispatcher<'tcx, C, FLAGS>, - qcx: QueryCtxt<'tcx>, + tcx: TyCtxt<'tcx>, ) { - let _timer = qcx.tcx.prof.generic_activity_with_arg("query_key_hash_verify_for", query.name()); + let _timer = tcx.prof.generic_activity_with_arg("query_key_hash_verify_for", query.name()); - let cache = query.query_cache(qcx); + let cache = query.query_cache(tcx); let mut map = UnordMap::with_capacity(cache.len()); cache.iter(&mut |key, _, _| { - let node = DepNode::construct(qcx.tcx, query.dep_kind(), key); + let node = DepNode::construct(tcx, query.dep_kind(), key); if let Some(other_key) = map.insert(node, *key) { bug!( "query key:\n\ @@ -487,7 +463,7 @@ pub(crate) fn force_from_dep_node_inner<'tcx, C: QueryCache, const FLAGS: QueryF ); if let Some(key) = C::Key::recover(tcx, &dep_node) { - force_query(query, QueryCtxt::new(tcx), key, dep_node); + force_query(query, tcx, key, dep_node); true } else { false @@ -525,7 +501,7 @@ macro_rules! define_queries { let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered(); execution::get_query_incr( QueryType::query_dispatcher(tcx), - QueryCtxt::new(tcx), + tcx, span, key, mode @@ -545,7 +521,7 @@ macro_rules! define_queries { ) -> Option>> { Some(execution::get_query_non_incr( QueryType::query_dispatcher(tcx), - QueryCtxt::new(tcx), + tcx, span, key, )) @@ -729,7 +705,7 @@ macro_rules! define_queries { _ > ( query_impl::$name::QueryType::query_dispatcher(tcx), - QueryCtxt::new(tcx), + tcx, encoder, query_result_index, ) @@ -739,7 +715,7 @@ macro_rules! define_queries { pub(crate) fn query_key_hash_verify<'tcx>(tcx: TyCtxt<'tcx>) { $crate::plumbing::query_key_hash_verify( query_impl::$name::QueryType::query_dispatcher(tcx), - QueryCtxt::new(tcx), + tcx, ) } })*} From db58395a6b79f373595ebe26d6a130583c54fce8 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Mon, 16 Feb 2026 10:54:52 +1100 Subject: [PATCH 07/11] Don't use `HasDepContext` in `DepGraph::with_task` The need for a `HasDepContext` impl on tuples can be avoided by passing the query vtable as part of an argument tuple instead. --- compiler/rustc_middle/src/dep_graph/graph.rs | 72 ++++++++------------ compiler/rustc_middle/src/dep_graph/mod.rs | 6 -- compiler/rustc_query_impl/src/execution.rs | 6 +- compiler/rustc_query_impl/src/lib.rs | 15 ++++ 4 files changed, 46 insertions(+), 53 deletions(-) diff --git a/compiler/rustc_middle/src/dep_graph/graph.rs b/compiler/rustc_middle/src/dep_graph/graph.rs index 6a19c02bb81b1..265ee76b31b0d 100644 --- a/compiler/rustc_middle/src/dep_graph/graph.rs +++ b/compiler/rustc_middle/src/dep_graph/graph.rs @@ -268,17 +268,17 @@ impl DepGraph { } #[inline(always)] - pub fn with_task<'tcx, Ctxt: HasDepContext<'tcx>, A: Debug, R>( + pub fn with_task<'tcx, A: Debug, R>( &self, - key: DepNode, - cx: Ctxt, - arg: A, - task: fn(Ctxt, A) -> R, + dep_node: DepNode, + tcx: TyCtxt<'tcx>, + task_arg: A, + task_fn: fn(tcx: TyCtxt<'tcx>, task_arg: A) -> R, hash_result: Option, &R) -> Fingerprint>, ) -> (R, DepNodeIndex) { match self.data() { - Some(data) => data.with_task(key, cx, arg, task, hash_result), - None => (task(cx, arg), self.next_virtual_depnode_index()), + Some(data) => data.with_task(dep_node, tcx, task_arg, task_fn, hash_result), + None => (task_fn(tcx, task_arg), self.next_virtual_depnode_index()), } } @@ -310,33 +310,21 @@ impl DepGraphData { /// prevent implicit 'leaks' of tracked state into the task (which /// could then be read without generating correct edges in the /// dep-graph -- see the [rustc dev guide] for more details on - /// the dep-graph). To this end, the task function gets exactly two - /// pieces of state: the context `cx` and an argument `arg`. Both - /// of these bits of state must be of some type that implements - /// `DepGraphSafe` and hence does not leak. - /// - /// The choice of two arguments is not fundamental. One argument - /// would work just as well, since multiple values can be - /// collected using tuples. However, using two arguments works out - /// to be quite convenient, since it is common to need a context - /// (`cx`) and some argument (e.g., a `DefId` identifying what - /// item to process). + /// the dep-graph). /// - /// For cases where you need some other number of arguments: - /// - /// - If you only need one argument, just use `()` for the `arg` - /// parameter. - /// - If you need 3+ arguments, use a tuple for the - /// `arg` parameter. + /// Therefore, the task function takes a `TyCtxt`, plus exactly one + /// additional argument, `task_arg`. The additional argument type can be + /// `()` if no argument is needed, or a tuple if multiple arguments are + /// needed. /// /// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/queries/incremental-compilation.html #[inline(always)] - pub fn with_task<'tcx, Ctxt: HasDepContext<'tcx>, A: Debug, R>( + pub fn with_task<'tcx, A: Debug, R>( &self, - key: DepNode, - cx: Ctxt, - arg: A, - task: fn(Ctxt, A) -> R, + dep_node: DepNode, + tcx: TyCtxt<'tcx>, + task_arg: A, + task_fn: fn(tcx: TyCtxt<'tcx>, task_arg: A) -> R, hash_result: Option, &R) -> Fingerprint>, ) -> (R, DepNodeIndex) { // If the following assertion triggers, it can have two reasons: @@ -344,32 +332,28 @@ impl DepGraphData { // in `DepGraph::try_mark_green()`. // 2. Two distinct query keys get mapped to the same `DepNode` // (see for example #48923). - self.assert_dep_node_not_yet_allocated_in_current_session( - cx.dep_context().sess, - &key, - || { - format!( - "forcing query with already existing `DepNode`\n\ - - query-key: {arg:?}\n\ - - dep-node: {key:?}" - ) - }, - ); + self.assert_dep_node_not_yet_allocated_in_current_session(tcx.sess, &dep_node, || { + format!( + "forcing query with already existing `DepNode`\n\ + - query-key: {task_arg:?}\n\ + - dep-node: {dep_node:?}" + ) + }); - let with_deps = |task_deps| with_deps(task_deps, || task(cx, arg)); - let (result, edges) = if cx.dep_context().is_eval_always(key.kind) { + let with_deps = |task_deps| with_deps(task_deps, || task_fn(tcx, task_arg)); + let (result, edges) = if tcx.is_eval_always(dep_node.kind) { (with_deps(TaskDepsRef::EvalAlways), EdgesVec::new()) } else { let task_deps = Lock::new(TaskDeps::new( #[cfg(debug_assertions)] - Some(key), + Some(dep_node), 0, )); (with_deps(TaskDepsRef::Allow(&task_deps)), task_deps.into_inner().reads) }; let dep_node_index = - self.hash_result_and_alloc_node(cx.dep_context(), key, edges, &result, hash_result); + self.hash_result_and_alloc_node(tcx, dep_node, edges, &result, hash_result); (result, dep_node_index) } diff --git a/compiler/rustc_middle/src/dep_graph/mod.rs b/compiler/rustc_middle/src/dep_graph/mod.rs index e8b2f86e5718c..3815158c66f19 100644 --- a/compiler/rustc_middle/src/dep_graph/mod.rs +++ b/compiler/rustc_middle/src/dep_graph/mod.rs @@ -35,12 +35,6 @@ impl<'tcx> HasDepContext<'tcx> for TyCtxt<'tcx> { } } -impl<'tcx, T: HasDepContext<'tcx>, Q: Copy> HasDepContext<'tcx> for (T, Q) { - fn dep_context(&self) -> TyCtxt<'tcx> { - self.0.dep_context() - } -} - /// Describes the contents of the fingerprint generated by a given query. /// /// This is mainly for determining whether and how we can reconstruct a key diff --git a/compiler/rustc_query_impl/src/execution.rs b/compiler/rustc_query_impl/src/execution.rs index e9996054211b9..80bdc5626ec80 100644 --- a/compiler/rustc_query_impl/src/execution.rs +++ b/compiler/rustc_query_impl/src/execution.rs @@ -475,9 +475,9 @@ fn execute_job_incr<'tcx, C: QueryCache, const FLAGS: QueryFlags>( // Call the query provider. dep_graph_data.with_task( dep_node, - (tcx, query), - key, - |(tcx, query), key| query.invoke_provider(tcx, key), + tcx, + (query, key), + |tcx, (query, key)| query.invoke_provider(tcx, key), query.hash_result(), ) }); diff --git a/compiler/rustc_query_impl/src/lib.rs b/compiler/rustc_query_impl/src/lib.rs index 8731414eb04ef..b4a64686728f1 100644 --- a/compiler/rustc_query_impl/src/lib.rs +++ b/compiler/rustc_query_impl/src/lib.rs @@ -9,6 +9,7 @@ #![feature(try_blocks)] // tidy-alphabetical-end +use std::fmt; use std::marker::ConstParamTy; use rustc_data_structures::sync::AtomicU64; @@ -76,6 +77,20 @@ impl<'tcx, C: QueryCache, const FLAGS: QueryFlags> Clone } } +impl<'tcx, C: QueryCache, const FLAGS: QueryFlags> fmt::Debug + for SemiDynamicQueryDispatcher<'tcx, C, FLAGS> +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + // When debug-printing a query dispatcher (e.g. for ICE or tracing), + // just print the query name to know what query we're dealing with. + // The other fields and flags are probably just unhelpful noise. + // + // If there is need for a more detailed dump of all flags and fields, + // consider writing a separate dump method and calling it explicitly. + f.write_str(self.name()) + } +} + impl<'tcx, C: QueryCache, const FLAGS: QueryFlags> SemiDynamicQueryDispatcher<'tcx, C, FLAGS> { #[inline(always)] fn name(self) -> &'static str { From 25d5cd2eb02bc2efd9386e13fd82dcf70a7b165d Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sun, 15 Feb 2026 19:35:32 +1100 Subject: [PATCH 08/11] Remove unnecessary trait `HasDepContext` --- compiler/rustc_middle/src/dep_graph/graph.rs | 9 +++------ compiler/rustc_middle/src/dep_graph/mod.rs | 10 ---------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_middle/src/dep_graph/graph.rs b/compiler/rustc_middle/src/dep_graph/graph.rs index 265ee76b31b0d..5257ec4abef21 100644 --- a/compiler/rustc_middle/src/dep_graph/graph.rs +++ b/compiler/rustc_middle/src/dep_graph/graph.rs @@ -23,7 +23,7 @@ use {super::debug::EdgeFilter, std::env}; use super::query::DepGraphQuery; use super::serialized::{GraphEncoder, SerializedDepGraph, SerializedDepNodeIndex}; -use super::{DepKind, DepNode, HasDepContext, WorkProductId, read_deps, with_deps}; +use super::{DepKind, DepNode, WorkProductId, read_deps, with_deps}; use crate::dep_graph::edges::EdgesVec; use crate::ich::StableHashingContext; use crate::ty::TyCtxt; @@ -938,7 +938,7 @@ impl DepGraphData { // We failed to mark it green, so we try to force the query. debug!("trying to force dependency {dep_dep_node:?}"); - if !tcx.dep_context().try_force_from_dep_node(*dep_dep_node, parent_dep_node_index, frame) { + if !tcx.try_force_from_dep_node(*dep_dep_node, parent_dep_node_index, frame) { // The DepNode could not be forced. debug!("dependency {dep_dep_node:?} could not be forced"); return None; @@ -985,10 +985,7 @@ impl DepGraphData { let frame = MarkFrame { index: prev_dep_node_index, parent: frame }; // We never try to mark eval_always nodes as green - debug_assert!( - !tcx.dep_context() - .is_eval_always(self.previous.index_to_node(prev_dep_node_index).kind) - ); + debug_assert!(!tcx.is_eval_always(self.previous.index_to_node(prev_dep_node_index).kind)); let prev_deps = self.previous.edge_targets_from(prev_dep_node_index); diff --git a/compiler/rustc_middle/src/dep_graph/mod.rs b/compiler/rustc_middle/src/dep_graph/mod.rs index 3815158c66f19..4b1faeb7d2090 100644 --- a/compiler/rustc_middle/src/dep_graph/mod.rs +++ b/compiler/rustc_middle/src/dep_graph/mod.rs @@ -25,16 +25,6 @@ mod graph; mod query; mod serialized; -pub trait HasDepContext<'tcx>: Copy { - fn dep_context(&self) -> TyCtxt<'tcx>; -} - -impl<'tcx> HasDepContext<'tcx> for TyCtxt<'tcx> { - fn dep_context(&self) -> TyCtxt<'tcx> { - *self - } -} - /// Describes the contents of the fingerprint generated by a given query. /// /// This is mainly for determining whether and how we can reconstruct a key From 28fc413c8fba1ef0c5e2162c2ad8d7eeb1089317 Mon Sep 17 00:00:00 2001 From: cyrgani Date: Tue, 17 Feb 2026 08:45:08 +0000 Subject: [PATCH 09/11] remove `#![allow(stable_features)]` from most tests --- library/std/tests/volatile-fat-ptr.rs | 2 -- tests/ui/array-slice-vec/array_const_index-2.rs | 3 --- tests/ui/array-slice-vec/slice-of-zero-size-elements.rs | 4 ---- tests/ui/borrowck/fsu-moves-and-copies.rs | 2 -- tests/ui/cfg/crt-static-off-works.rs | 4 ---- tests/ui/consts/const-fn.rs | 4 ---- tests/ui/consts/issue-29914.rs | 4 ---- tests/ui/dropck/cleanup-arm-conditional.rs | 4 ---- tests/ui/dst/dst-coerce-rc.rs | 3 --- tests/ui/enum-discriminant/discriminant_value.rs | 3 +-- tests/ui/functions-closures/parallel-codegen-closures.rs | 3 --- tests/ui/inference/iterator-sum-array-15673.rs | 3 --- tests/ui/issues/issue-20644.rs | 4 ---- tests/ui/issues/issue-21634.rs | 3 --- tests/ui/issues/issue-29663.rs | 2 -- tests/ui/issues/issue-34780.rs | 2 -- tests/ui/issues/issue-42956.rs | 2 -- tests/ui/iterators/iter-cloned-type-inference.rs | 4 ---- tests/ui/iterators/iterator-type-inference-sum-15673.rs | 3 --- tests/ui/macros/macro-lifetime-used-with-labels.rs | 1 - tests/ui/macros/parse-complex-macro-invoc-op.rs | 4 ---- tests/ui/methods/method-normalize-bounds-issue-20604.rs | 3 --- tests/ui/mir/mir_fat_ptr_drop.rs | 3 --- tests/ui/no_std/no-core-with-explicit-std-core.rs | 3 +-- tests/ui/overloaded/overloaded-autoderef.rs | 1 - tests/ui/overloaded/overloaded-index-autoderef.rs | 2 -- tests/ui/panics/panic-handler-chain-update-hook.rs | 3 --- tests/ui/panics/panic-handler-chain.rs | 3 --- tests/ui/panics/panic-handler-flail-wildly.rs | 3 --- tests/ui/panics/panic-handler-set-twice.rs | 3 --- tests/ui/repr/align-with-extern-c-fn.rs | 3 --- tests/ui/simd/target-feature-mixup.rs | 3 +-- tests/ui/target-feature/target-feature-detection.rs | 3 --- tests/ui/threads-sendsync/tls-init-on-init.rs | 2 -- tests/ui/threads-sendsync/tls-try-with.rs | 2 -- tests/ui/use/use.rs | 4 +--- 36 files changed, 4 insertions(+), 101 deletions(-) diff --git a/library/std/tests/volatile-fat-ptr.rs b/library/std/tests/volatile-fat-ptr.rs index b00277e7a4113..406eb7c80afb5 100644 --- a/library/std/tests/volatile-fat-ptr.rs +++ b/library/std/tests/volatile-fat-ptr.rs @@ -1,5 +1,3 @@ -#![allow(stable_features)] - use std::ptr::{read_volatile, write_volatile}; #[test] diff --git a/tests/ui/array-slice-vec/array_const_index-2.rs b/tests/ui/array-slice-vec/array_const_index-2.rs index 30338e0ab87cd..8dcfc294aae53 100644 --- a/tests/ui/array-slice-vec/array_const_index-2.rs +++ b/tests/ui/array-slice-vec/array_const_index-2.rs @@ -1,8 +1,5 @@ //@ run-pass #![allow(dead_code)] -#![allow(stable_features)] - -#![feature(const_indexing)] fn main() { const ARR: [i32; 6] = [42, 43, 44, 45, 46, 47]; diff --git a/tests/ui/array-slice-vec/slice-of-zero-size-elements.rs b/tests/ui/array-slice-vec/slice-of-zero-size-elements.rs index 7aa8a251fec5e..ea7d8f8be2bf3 100644 --- a/tests/ui/array-slice-vec/slice-of-zero-size-elements.rs +++ b/tests/ui/array-slice-vec/slice-of-zero-size-elements.rs @@ -1,10 +1,6 @@ //@ run-pass -#![allow(stable_features)] - //@ compile-flags: -C debug-assertions -#![feature(iter_to_slice)] - use std::slice; fn foo(v: &[T]) -> Option<&[T]> { diff --git a/tests/ui/borrowck/fsu-moves-and-copies.rs b/tests/ui/borrowck/fsu-moves-and-copies.rs index 397e4199bc054..6576fb51a5d2d 100644 --- a/tests/ui/borrowck/fsu-moves-and-copies.rs +++ b/tests/ui/borrowck/fsu-moves-and-copies.rs @@ -1,11 +1,9 @@ //@ run-pass #![allow(non_camel_case_types)] -#![allow(stable_features)] // Issue 4691: Ensure that functional-struct-updates operates // correctly and moves rather than copy when appropriate. -#![feature(core)] struct ncint { v: isize } fn ncint(v: isize) -> ncint { ncint { v: v } } diff --git a/tests/ui/cfg/crt-static-off-works.rs b/tests/ui/cfg/crt-static-off-works.rs index 1d77dba24b1cd..520d139915cc5 100644 --- a/tests/ui/cfg/crt-static-off-works.rs +++ b/tests/ui/cfg/crt-static-off-works.rs @@ -1,10 +1,6 @@ //@ run-pass - -#![allow(stable_features)] //@ compile-flags:-C target-feature=-crt-static -Z unstable-options //@ ignore-musl - requires changing the linker which is hard -#![feature(cfg_target_feature)] - #[cfg(not(target_feature = "crt-static"))] fn main() {} diff --git a/tests/ui/consts/const-fn.rs b/tests/ui/consts/const-fn.rs index aa9c478ea6330..34aaeac6462d5 100644 --- a/tests/ui/consts/const-fn.rs +++ b/tests/ui/consts/const-fn.rs @@ -1,10 +1,6 @@ //@ run-pass -#![allow(stable_features)] - // A very basic test of const fn functionality. -#![feature(const_indexing)] - const fn add(x: u32, y: u32) -> u32 { x + y } diff --git a/tests/ui/consts/issue-29914.rs b/tests/ui/consts/issue-29914.rs index 7897733c72389..36a82f5b95012 100644 --- a/tests/ui/consts/issue-29914.rs +++ b/tests/ui/consts/issue-29914.rs @@ -1,8 +1,4 @@ //@ run-pass -#![allow(stable_features)] - -#![feature(const_indexing)] - const ARR: [usize; 5] = [5, 4, 3, 2, 1]; fn main() { diff --git a/tests/ui/dropck/cleanup-arm-conditional.rs b/tests/ui/dropck/cleanup-arm-conditional.rs index 31331f24d6f6b..7afbf9595da5d 100644 --- a/tests/ui/dropck/cleanup-arm-conditional.rs +++ b/tests/ui/dropck/cleanup-arm-conditional.rs @@ -1,13 +1,9 @@ //@ run-pass -#![allow(stable_features)] #![allow(unused_imports)] // Test that cleanup scope for temporaries created in a match // arm is confined to the match arm itself. - -#![feature(os)] - use std::os; struct Test { x: isize } diff --git a/tests/ui/dst/dst-coerce-rc.rs b/tests/ui/dst/dst-coerce-rc.rs index 5ec7853a8e822..490cfaca7de92 100644 --- a/tests/ui/dst/dst-coerce-rc.rs +++ b/tests/ui/dst/dst-coerce-rc.rs @@ -1,10 +1,7 @@ //@ run-pass #![allow(unused_variables)] -#![allow(stable_features)] // Test a very simple custom DST coercion. -#![feature(core, rc_weak)] - use std::cell::RefCell; use std::rc::{Rc, Weak}; diff --git a/tests/ui/enum-discriminant/discriminant_value.rs b/tests/ui/enum-discriminant/discriminant_value.rs index 0d6b9166c26a3..dc3d9cb83cca1 100644 --- a/tests/ui/enum-discriminant/discriminant_value.rs +++ b/tests/ui/enum-discriminant/discriminant_value.rs @@ -1,6 +1,5 @@ //@ run-pass -#![allow(stable_features)] -#![feature(core, core_intrinsics)] +#![feature(core_intrinsics)] extern crate core; use core::intrinsics::discriminant_value; diff --git a/tests/ui/functions-closures/parallel-codegen-closures.rs b/tests/ui/functions-closures/parallel-codegen-closures.rs index 1842ac4db6060..8628376c73343 100644 --- a/tests/ui/functions-closures/parallel-codegen-closures.rs +++ b/tests/ui/functions-closures/parallel-codegen-closures.rs @@ -1,15 +1,12 @@ //@ run-pass #![allow(dead_code)] #![allow(unused_variables)] -#![allow(stable_features)] // Tests parallel codegen - this can fail if the symbol for the anonymous // closure in `sum` pollutes the second codegen unit from the first. //@ compile-flags: -C codegen_units=2 -#![feature(iter_arith)] - mod a { fn foo() { let x = ["a", "bob", "c"]; diff --git a/tests/ui/inference/iterator-sum-array-15673.rs b/tests/ui/inference/iterator-sum-array-15673.rs index c3d94415affda..b8d9fd994218e 100644 --- a/tests/ui/inference/iterator-sum-array-15673.rs +++ b/tests/ui/inference/iterator-sum-array-15673.rs @@ -1,9 +1,6 @@ //! Regression test for https://github.com/rust-lang/rust/issues/15673 //@ run-pass -#![allow(stable_features)] - -#![feature(iter_arith)] fn main() { let x: [u64; 3] = [1, 2, 3]; diff --git a/tests/ui/issues/issue-20644.rs b/tests/ui/issues/issue-20644.rs index 5f7e4054f7765..09a2ee7217c3a 100644 --- a/tests/ui/issues/issue-20644.rs +++ b/tests/ui/issues/issue-20644.rs @@ -1,14 +1,10 @@ //@ build-pass #![allow(dead_code)] #![allow(unused_imports)] -#![allow(stable_features)] // A reduced version of the rustbook ice. The problem this encountered // had to do with codegen ignoring binders. - -#![feature(os)] - use std::iter; use std::os; use std::fs::File; diff --git a/tests/ui/issues/issue-21634.rs b/tests/ui/issues/issue-21634.rs index 270a893474adf..475a33eca58ec 100644 --- a/tests/ui/issues/issue-21634.rs +++ b/tests/ui/issues/issue-21634.rs @@ -1,7 +1,4 @@ //@ run-pass -#![allow(stable_features)] - -#![feature(cfg_target_feature)] #[cfg(any(not(target_arch = "x86"), target_feature = "sse2"))] fn main() { diff --git a/tests/ui/issues/issue-29663.rs b/tests/ui/issues/issue-29663.rs index ed512f14f4ced..9f7de6b72e117 100644 --- a/tests/ui/issues/issue-29663.rs +++ b/tests/ui/issues/issue-29663.rs @@ -1,8 +1,6 @@ //@ run-pass -#![allow(stable_features)] // write_volatile causes an LLVM assert with composite types -#![feature(volatile)] use std::ptr::{read_volatile, write_volatile}; #[derive(Debug, Eq, PartialEq)] diff --git a/tests/ui/issues/issue-34780.rs b/tests/ui/issues/issue-34780.rs index ee5cc0750dceb..4470e3af682b0 100644 --- a/tests/ui/issues/issue-34780.rs +++ b/tests/ui/issues/issue-34780.rs @@ -1,6 +1,4 @@ //@ check-pass -#![allow(stable_features)] -#![feature(associated_consts)] use std::marker::PhantomData; diff --git a/tests/ui/issues/issue-42956.rs b/tests/ui/issues/issue-42956.rs index a124ca84f3c34..5d6d4249a7d88 100644 --- a/tests/ui/issues/issue-42956.rs +++ b/tests/ui/issues/issue-42956.rs @@ -1,7 +1,5 @@ //@ check-pass #![allow(dead_code)] -#![allow(stable_features)] -#![feature(associated_consts)] impl A for i32 { type Foo = u32; diff --git a/tests/ui/iterators/iter-cloned-type-inference.rs b/tests/ui/iterators/iter-cloned-type-inference.rs index 10f9558811887..3957c99cea325 100644 --- a/tests/ui/iterators/iter-cloned-type-inference.rs +++ b/tests/ui/iterators/iter-cloned-type-inference.rs @@ -1,11 +1,7 @@ //@ run-pass -#![allow(stable_features)] - // Test to see that the element type of .cloned() can be inferred // properly. Previously this would fail to deduce the type of `sum`. -#![feature(iter_arith)] - fn square_sum(v: &[i64]) -> i64 { let sum: i64 = v.iter().cloned().sum(); sum * sum diff --git a/tests/ui/iterators/iterator-type-inference-sum-15673.rs b/tests/ui/iterators/iterator-type-inference-sum-15673.rs index aee027927f2f7..4b75503df10e9 100644 --- a/tests/ui/iterators/iterator-type-inference-sum-15673.rs +++ b/tests/ui/iterators/iterator-type-inference-sum-15673.rs @@ -1,8 +1,5 @@ // https://github.com/rust-lang/rust/issues/15673 //@ run-pass -#![allow(stable_features)] - -#![feature(iter_arith)] fn main() { let x: [u64; 3] = [1, 2, 3]; diff --git a/tests/ui/macros/macro-lifetime-used-with-labels.rs b/tests/ui/macros/macro-lifetime-used-with-labels.rs index 3b51b8050b348..4489ca6b681be 100644 --- a/tests/ui/macros/macro-lifetime-used-with-labels.rs +++ b/tests/ui/macros/macro-lifetime-used-with-labels.rs @@ -1,5 +1,4 @@ //@ run-pass -#![allow(stable_features)] #![allow(unused_labels)] #![allow(unreachable_code)] diff --git a/tests/ui/macros/parse-complex-macro-invoc-op.rs b/tests/ui/macros/parse-complex-macro-invoc-op.rs index 27ead36f69d8c..2c384bdb42efe 100644 --- a/tests/ui/macros/parse-complex-macro-invoc-op.rs +++ b/tests/ui/macros/parse-complex-macro-invoc-op.rs @@ -3,14 +3,10 @@ #![allow(dead_code)] #![allow(unused_assignments)] #![allow(unused_variables)] -#![allow(stable_features)] #![allow(dropping_copy_types)] // Test parsing binary operators after macro invocations. - -#![feature(macro_rules)] - macro_rules! id { ($e: expr) => { $e } } diff --git a/tests/ui/methods/method-normalize-bounds-issue-20604.rs b/tests/ui/methods/method-normalize-bounds-issue-20604.rs index ea18fe14d157a..9f20f99b97fc4 100644 --- a/tests/ui/methods/method-normalize-bounds-issue-20604.rs +++ b/tests/ui/methods/method-normalize-bounds-issue-20604.rs @@ -1,7 +1,6 @@ //@ run-pass #![allow(dead_code)] #![allow(unused_variables)] -#![allow(stable_features)] // Test that we handle projection types which wind up important for // resolving methods. This test was reduced from a larger example; the @@ -10,8 +9,6 @@ // type projection. -#![feature(associated_types)] - trait Hasher { type Output; fn finish(&self) -> Self::Output; diff --git a/tests/ui/mir/mir_fat_ptr_drop.rs b/tests/ui/mir/mir_fat_ptr_drop.rs index ff6a0d70881f3..b832d5a4ce9fd 100644 --- a/tests/ui/mir/mir_fat_ptr_drop.rs +++ b/tests/ui/mir/mir_fat_ptr_drop.rs @@ -1,10 +1,7 @@ //@ run-pass #![allow(unused_variables)] -#![allow(stable_features)] // test that ordinary fat pointer operations work. - -#![feature(braced_empty_structs)] #![feature(rustc_attrs)] use std::sync::atomic; diff --git a/tests/ui/no_std/no-core-with-explicit-std-core.rs b/tests/ui/no_std/no-core-with-explicit-std-core.rs index 3940bcb3aa4fb..6e8e41adca07e 100644 --- a/tests/ui/no_std/no-core-with-explicit-std-core.rs +++ b/tests/ui/no_std/no-core-with-explicit-std-core.rs @@ -6,8 +6,7 @@ //@ run-pass -#![allow(stable_features)] -#![feature(no_core, core)] +#![feature(no_core)] #![no_core] extern crate core; diff --git a/tests/ui/overloaded/overloaded-autoderef.rs b/tests/ui/overloaded/overloaded-autoderef.rs index a7a07449ca890..c1a715dd2e9f5 100644 --- a/tests/ui/overloaded/overloaded-autoderef.rs +++ b/tests/ui/overloaded/overloaded-autoderef.rs @@ -1,6 +1,5 @@ //@ run-pass #![allow(unused_variables)] -#![allow(stable_features)] use std::cell::RefCell; use std::rc::Rc; diff --git a/tests/ui/overloaded/overloaded-index-autoderef.rs b/tests/ui/overloaded/overloaded-index-autoderef.rs index ab49826e9dfc9..3709bb0b5cd59 100644 --- a/tests/ui/overloaded/overloaded-index-autoderef.rs +++ b/tests/ui/overloaded/overloaded-index-autoderef.rs @@ -1,6 +1,4 @@ //@ run-pass -#![allow(stable_features)] - // Test overloaded indexing combined with autoderef. use std::ops::{Index, IndexMut}; diff --git a/tests/ui/panics/panic-handler-chain-update-hook.rs b/tests/ui/panics/panic-handler-chain-update-hook.rs index 2ae79ad236ef2..b75c21c8b3b2d 100644 --- a/tests/ui/panics/panic-handler-chain-update-hook.rs +++ b/tests/ui/panics/panic-handler-chain-update-hook.rs @@ -1,11 +1,8 @@ //@ run-pass //@ needs-unwind -#![allow(stable_features)] - //@ needs-threads //@ ignore-backends: gcc -#![feature(std_panic)] #![feature(panic_update_hook)] use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/tests/ui/panics/panic-handler-chain.rs b/tests/ui/panics/panic-handler-chain.rs index cc591c1d9992d..49b76834ffe9e 100644 --- a/tests/ui/panics/panic-handler-chain.rs +++ b/tests/ui/panics/panic-handler-chain.rs @@ -2,9 +2,6 @@ //@ needs-unwind //@ needs-threads //@ ignore-backends: gcc -#![allow(stable_features)] - -#![feature(std_panic)] use std::sync::atomic::{AtomicUsize, Ordering}; use std::panic; diff --git a/tests/ui/panics/panic-handler-flail-wildly.rs b/tests/ui/panics/panic-handler-flail-wildly.rs index d5f5195d38121..b44a388caad32 100644 --- a/tests/ui/panics/panic-handler-flail-wildly.rs +++ b/tests/ui/panics/panic-handler-flail-wildly.rs @@ -1,14 +1,11 @@ //@ run-pass //@ needs-unwind -#![allow(stable_features)] #![allow(unused_must_use)] //@ needs-threads //@ ignore-backends: gcc -#![feature(std_panic)] - use std::panic; use std::thread; diff --git a/tests/ui/panics/panic-handler-set-twice.rs b/tests/ui/panics/panic-handler-set-twice.rs index ca4ed65f5683d..aa40187f08ca2 100644 --- a/tests/ui/panics/panic-handler-set-twice.rs +++ b/tests/ui/panics/panic-handler-set-twice.rs @@ -1,9 +1,6 @@ //@ run-pass //@ needs-unwind #![allow(unused_variables)] -#![allow(stable_features)] - -#![feature(std_panic)] //@ needs-threads //@ ignore-backends: gcc diff --git a/tests/ui/repr/align-with-extern-c-fn.rs b/tests/ui/repr/align-with-extern-c-fn.rs index 4d17d1e8816f2..a695f4bffe943 100644 --- a/tests/ui/repr/align-with-extern-c-fn.rs +++ b/tests/ui/repr/align-with-extern-c-fn.rs @@ -1,12 +1,9 @@ //@ run-pass -#![allow(stable_features)] #![allow(unused_variables)] // #45662 -#![feature(repr_align)] - #[repr(align(16))] pub struct A(#[allow(dead_code)] i64); diff --git a/tests/ui/simd/target-feature-mixup.rs b/tests/ui/simd/target-feature-mixup.rs index 014a9966f5cbd..5f599f38fb92f 100644 --- a/tests/ui/simd/target-feature-mixup.rs +++ b/tests/ui/simd/target-feature-mixup.rs @@ -1,13 +1,12 @@ //@ run-pass #![allow(unused_variables)] -#![allow(stable_features)] #![allow(overflowing_literals)] //@ needs-subprocess //@ ignore-fuchsia must translate zircon signal to SIGILL, FIXME (#58590) //@ ignore-backends: gcc -#![feature(repr_simd, target_feature, cfg_target_feature)] +#![feature(repr_simd)] #[path = "../../auxiliary/minisimd.rs"] mod minisimd; diff --git a/tests/ui/target-feature/target-feature-detection.rs b/tests/ui/target-feature/target-feature-detection.rs index 41fc246913125..9a9102bf7d54d 100644 --- a/tests/ui/target-feature/target-feature-detection.rs +++ b/tests/ui/target-feature/target-feature-detection.rs @@ -4,9 +4,6 @@ //@ run-pass //@ ignore-i586 (no SSE2) -#![allow(stable_features)] -#![feature(cfg_target_feature)] - fn main() { if cfg!(any(target_arch = "x86", target_arch = "x86_64")) { assert!( diff --git a/tests/ui/threads-sendsync/tls-init-on-init.rs b/tests/ui/threads-sendsync/tls-init-on-init.rs index 1cae19aae86c7..d7c110e80e85b 100644 --- a/tests/ui/threads-sendsync/tls-init-on-init.rs +++ b/tests/ui/threads-sendsync/tls-init-on-init.rs @@ -1,7 +1,5 @@ //@ run-pass -#![allow(stable_features)] //@ needs-threads -#![feature(thread_local_try_with)] use std::sync::atomic::{AtomicUsize, Ordering}; use std::thread; diff --git a/tests/ui/threads-sendsync/tls-try-with.rs b/tests/ui/threads-sendsync/tls-try-with.rs index 04071e77daa48..1d0c5de7d87f2 100644 --- a/tests/ui/threads-sendsync/tls-try-with.rs +++ b/tests/ui/threads-sendsync/tls-try-with.rs @@ -1,7 +1,5 @@ //@ run-pass -#![allow(stable_features)] //@ needs-threads -#![feature(thread_local_try_with)] use std::thread; diff --git a/tests/ui/use/use.rs b/tests/ui/use/use.rs index 25b8e529c432a..c6b6724ef7c15 100644 --- a/tests/ui/use/use.rs +++ b/tests/ui/use/use.rs @@ -1,9 +1,7 @@ //@ run-pass -#![allow(stable_features)] - #![allow(unused_imports)] -#![feature(no_core, core)] +#![feature(no_core)] #![no_core] extern crate std; From 0c8d2b40e39b4638d86126bd6072b2488ca141c7 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 17 Feb 2026 10:57:34 +0100 Subject: [PATCH 10/11] Update `sysinfo` version to `0.38.2` --- Cargo.lock | 12 ++++++------ src/bootstrap/Cargo.lock | 12 ++++++------ src/bootstrap/Cargo.toml | 2 +- src/tools/opt-dist/Cargo.toml | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d7d19be42c580..aa0bc0164e223 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2652,9 +2652,9 @@ dependencies = [ [[package]] name = "objc2-core-foundation" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166" dependencies = [ "bitflags", ] @@ -2667,9 +2667,9 @@ checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" [[package]] name = "objc2-io-kit" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" +checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a" dependencies = [ "libc", "objc2-core-foundation", @@ -5354,9 +5354,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.38.0" +version = "0.38.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe840c5b1afe259a5657392a4dbb74473a14c8db999c3ec2f4ae812e028a94da" +checksum = "1efc19935b4b66baa6f654ac7924c192f55b175c00a7ab72410fc24284dacda8" dependencies = [ "libc", "objc2-core-foundation", diff --git a/src/bootstrap/Cargo.lock b/src/bootstrap/Cargo.lock index 960f003992fb9..f9499d9927f27 100644 --- a/src/bootstrap/Cargo.lock +++ b/src/bootstrap/Cargo.lock @@ -472,18 +472,18 @@ dependencies = [ [[package]] name = "objc2-core-foundation" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166" dependencies = [ "bitflags", ] [[package]] name = "objc2-io-kit" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" +checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a" dependencies = [ "libc", "objc2-core-foundation", @@ -743,9 +743,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.38.0" +version = "0.38.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe840c5b1afe259a5657392a4dbb74473a14c8db999c3ec2f4ae812e028a94da" +checksum = "1efc19935b4b66baa6f654ac7924c192f55b175c00a7ab72410fc24284dacda8" dependencies = [ "libc", "memchr", diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index 008e0d37642b7..0019e9e6d92e2 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -57,7 +57,7 @@ walkdir = "2.4" xz2 = "0.1" # Dependencies needed by the build-metrics feature -sysinfo = { version = "0.38.0", default-features = false, optional = true, features = ["system"] } +sysinfo = { version = "0.38.2", default-features = false, optional = true, features = ["system"] } # Dependencies needed by the `tracing` feature chrono = { version = "0.4", default-features = false, optional = true, features = ["now", "std"] } diff --git a/src/tools/opt-dist/Cargo.toml b/src/tools/opt-dist/Cargo.toml index 9ca1729e2e8b5..b6547eff007b6 100644 --- a/src/tools/opt-dist/Cargo.toml +++ b/src/tools/opt-dist/Cargo.toml @@ -10,7 +10,7 @@ log = "0.4" anyhow = "1" humantime = "2" humansize = "2" -sysinfo = { version = "0.38.0", default-features = false, features = ["disk"] } +sysinfo = { version = "0.38.2", default-features = false, features = ["disk"] } fs_extra = "1" camino = "1" tar = "0.4" From 609fde856937601e1615185f1b48795080fa13ee Mon Sep 17 00:00:00 2001 From: cyrgani Date: Tue, 17 Feb 2026 10:54:04 +0000 Subject: [PATCH 11/11] remove the `issue_5723_bootstrap` feature --- compiler/rustc_feature/src/accepted.rs | 3 --- compiler/rustc_feature/src/removed.rs | 3 +++ tests/ui/regions/regions-bound-lists-feature-gate-2.rs | 3 --- tests/ui/regions/regions-bound-lists-feature-gate.rs | 3 --- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 43032bf938c0b..521168d4d8517 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -25,9 +25,6 @@ declare_features! ( // feature-group-start: for testing purposes // ------------------------------------------------------------------------- - /// A temporary feature gate used to enable parser extensions needed - /// to bootstrap fix for #5723. - (accepted, issue_5723_bootstrap, "1.0.0", None), /// These are used to test this portion of the compiler, /// they don't actually mean anything. (accepted, test_accepted_feature, "1.0.0", None), diff --git a/compiler/rustc_feature/src/removed.rs b/compiler/rustc_feature/src/removed.rs index 71a735cd8cc78..f8501ba3da296 100644 --- a/compiler/rustc_feature/src/removed.rs +++ b/compiler/rustc_feature/src/removed.rs @@ -172,6 +172,9 @@ declare_features! ( /// Allow anonymous constants from an inline `const` block in pattern position (removed, inline_const_pat, "1.88.0", Some(76001), Some("removed due to implementation concerns as it requires significant refactorings"), 138492), + /// A temporary feature gate used to enable parser extensions needed + /// to bootstrap fix for #5723. + (removed, issue_5723_bootstrap, "CURRENT_RUSTC_VERSION", None, None), /// Lazily evaluate constants. This allows constants to depend on type parameters. (removed, lazy_normalization_consts, "1.56.0", Some(72219), Some("superseded by `generic_const_exprs`"), 88369), /// Changes `impl Trait` to capture all lifetimes in scope. diff --git a/tests/ui/regions/regions-bound-lists-feature-gate-2.rs b/tests/ui/regions/regions-bound-lists-feature-gate-2.rs index f4f27a4456dfb..6cdae0d49081e 100644 --- a/tests/ui/regions/regions-bound-lists-feature-gate-2.rs +++ b/tests/ui/regions/regions-bound-lists-feature-gate-2.rs @@ -1,8 +1,5 @@ //@ run-pass #![allow(dead_code)] -#![allow(stable_features)] - -#![feature(issue_5723_bootstrap)] trait Foo { fn dummy(&self) { } diff --git a/tests/ui/regions/regions-bound-lists-feature-gate.rs b/tests/ui/regions/regions-bound-lists-feature-gate.rs index 1bc2b7dd03efc..23878f5b406f1 100644 --- a/tests/ui/regions/regions-bound-lists-feature-gate.rs +++ b/tests/ui/regions/regions-bound-lists-feature-gate.rs @@ -1,9 +1,6 @@ //@ run-pass #![allow(dead_code)] #![allow(unused_variables)] -#![allow(stable_features)] - -#![feature(issue_5723_bootstrap)] trait Foo { fn dummy(&self) { }