From f25811e34bf89c3dde760d826ad4662c245be202 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Sun, 5 Jul 2020 22:58:46 +0300 Subject: [PATCH 1/2] Replace early-bound normalization hack with per-query key/value type aliases. --- .../rmeta/decoder/cstore_impl.rs | 9 +++----- src/librustc_middle/ty/query/plumbing.rs | 23 +++++++++++++++++-- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs index abbe45fe02e25..a1c586b3283c2 100644 --- a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs +++ b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs @@ -17,7 +17,6 @@ use rustc_middle::middle::cstore::{CrateSource, CrateStore, EncodedMetadata}; use rustc_middle::middle::exported_symbols::ExportedSymbol; use rustc_middle::middle::stability::DeprecationEntry; use rustc_middle::ty::query::Providers; -use rustc_middle::ty::query::QueryConfig; use rustc_middle::ty::{self, TyCtxt}; use rustc_session::utils::NativeLibKind; use rustc_session::{CrateDisambiguator, Session}; @@ -32,12 +31,10 @@ macro_rules! provide { (<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $($name:ident => $compute:block)*) => { pub fn provide_extern<$lt>(providers: &mut Providers<$lt>) { - // HACK(eddyb) `$lt: $lt` forces `$lt` to be early-bound, which - // allows the associated type in the return type to be normalized. - $(fn $name<$lt: $lt, T: IntoArgs>( + $(fn $name<$lt>( $tcx: TyCtxt<$lt>, - def_id_arg: T, - ) -> as QueryConfig>>::Value { + def_id_arg: ty::query::query_keys::$name<$lt>, + ) -> ty::query::query_values::$name<$lt> { let _prof_timer = $tcx.prof.generic_activity("metadata_decode_entry"); diff --git a/src/librustc_middle/ty/query/plumbing.rs b/src/librustc_middle/ty/query/plumbing.rs index c711de9476e9d..de79a33fac462 100644 --- a/src/librustc_middle/ty/query/plumbing.rs +++ b/src/librustc_middle/ty/query/plumbing.rs @@ -318,15 +318,34 @@ macro_rules! define_queries_inner { } } + #[allow(nonstandard_style)] pub mod queries { use std::marker::PhantomData; - $(#[allow(nonstandard_style)] - pub struct $name<$tcx> { + $(pub struct $name<$tcx> { data: PhantomData<&$tcx ()> })* } + // HACK(eddyb) this is like the `impl QueryConfig for queries::$name` + // below, but using type aliases instead of associated types, to bypass + // the limitations around normalizing under HRTB - for example, this: + // `for<'tcx> fn(...) -> as QueryConfig>>::Value` + // doesn't currently normalize to `for<'tcx> fn(...) -> query_values::$name<'tcx>`. + // This is primarily used by the `provide!` macro in `rustc_metadata`. + #[allow(nonstandard_style, unused_lifetimes)] + pub mod query_keys { + use super::*; + + $(pub type $name<$tcx> = $($K)*;)* + } + #[allow(nonstandard_style, unused_lifetimes)] + pub mod query_values { + use super::*; + + $(pub type $name<$tcx> = $V;)* + } + $(impl<$tcx> QueryConfig> for queries::$name<$tcx> { type Key = $($K)*; type Value = $V; From f07100afc8650101ac924d728521e1a5d0ce9080 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Sun, 5 Jul 2020 23:00:14 +0300 Subject: [PATCH 2/2] Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>. --- src/librustc_codegen_llvm/attributes.rs | 4 ++-- src/librustc_codegen_llvm/lib.rs | 4 ++-- .../back/symbol_export.rs | 8 +++---- src/librustc_codegen_ssa/base.rs | 2 +- src/librustc_codegen_ssa/lib.rs | 4 ++-- src/librustc_codegen_ssa/traits/backend.rs | 4 ++-- src/librustc_interface/interface.rs | 4 ++-- src/librustc_interface/passes.rs | 4 ++-- src/librustc_interface/proc_macro_decls.rs | 2 +- src/librustc_lint/levels.rs | 2 +- src/librustc_lint/lib.rs | 2 +- .../rmeta/decoder/cstore_impl.rs | 4 ++-- src/librustc_middle/hir/map/mod.rs | 2 +- src/librustc_middle/hir/mod.rs | 2 +- src/librustc_middle/ty/context.rs | 6 +++--- src/librustc_middle/ty/erase_regions.rs | 2 +- src/librustc_middle/ty/layout.rs | 2 +- src/librustc_middle/ty/mod.rs | 2 +- src/librustc_middle/ty/query/plumbing.rs | 21 +++++++++++-------- src/librustc_middle/util/bug.rs | 2 +- src/librustc_mir/borrow_check/mod.rs | 2 +- src/librustc_mir/const_eval/fn_queries.rs | 2 +- src/librustc_mir/lib.rs | 2 +- src/librustc_mir/monomorphize/partitioning.rs | 6 +++--- src/librustc_mir/shim.rs | 2 +- src/librustc_mir/transform/check_unsafety.rs | 2 +- .../transform/instrument_coverage.rs | 2 +- src/librustc_mir/transform/mod.rs | 2 +- src/librustc_mir_build/lib.rs | 2 +- src/librustc_passes/check_attr.rs | 2 +- src/librustc_passes/check_const.rs | 2 +- src/librustc_passes/diagnostic_items.rs | 2 +- src/librustc_passes/entry.rs | 2 +- src/librustc_passes/intrinsicck.rs | 2 +- src/librustc_passes/lang_items.rs | 2 +- src/librustc_passes/lib.rs | 2 +- src/librustc_passes/lib_features.rs | 2 +- src/librustc_passes/liveness.rs | 2 +- src/librustc_passes/loops.rs | 2 +- src/librustc_passes/reachable.rs | 2 +- src/librustc_passes/region.rs | 2 +- src/librustc_passes/stability.rs | 2 +- src/librustc_passes/upvars.rs | 2 +- src/librustc_plugin_impl/build.rs | 2 +- src/librustc_privacy/lib.rs | 2 +- src/librustc_resolve/late/lifetimes.rs | 2 +- src/librustc_resolve/lib.rs | 2 +- src/librustc_symbol_mangling/lib.rs | 2 +- src/librustc_trait_selection/traits/mod.rs | 2 +- .../traits/object_safety.rs | 2 +- .../traits/structural_match.rs | 2 +- src/librustc_traits/chalk/mod.rs | 2 +- src/librustc_traits/dropck_outlives.rs | 2 +- src/librustc_traits/evaluate_obligation.rs | 2 +- .../implied_outlives_bounds.rs | 2 +- src/librustc_traits/lib.rs | 2 +- .../normalize_erasing_regions.rs | 2 +- .../normalize_projection_ty.rs | 2 +- src/librustc_traits/type_op.rs | 2 +- src/librustc_ty/common_traits.rs | 2 +- src/librustc_ty/instance.rs | 2 +- src/librustc_ty/lib.rs | 2 +- src/librustc_ty/needs_drop.rs | 2 +- src/librustc_ty/ty.rs | 2 +- src/librustc_typeck/check/method/mod.rs | 2 +- src/librustc_typeck/check/method/probe.rs | 2 +- src/librustc_typeck/check/method/suggest.rs | 2 +- src/librustc_typeck/check/mod.rs | 2 +- src/librustc_typeck/coherence/mod.rs | 2 +- src/librustc_typeck/collect.rs | 2 +- src/librustc_typeck/impl_wf_check.rs | 2 +- src/librustc_typeck/lib.rs | 2 +- src/librustc_typeck/outlives/mod.rs | 2 +- src/librustc_typeck/variance/mod.rs | 2 +- 74 files changed, 99 insertions(+), 96 deletions(-) diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index 6234ade8a1612..c53a64664a639 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -342,7 +342,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty:: } } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.target_features_whitelist = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); if tcx.sess.opts.actually_rustdoc { @@ -360,7 +360,7 @@ pub fn provide(providers: &mut Providers<'_>) { provide_extern(providers); } -pub fn provide_extern(providers: &mut Providers<'_>) { +pub fn provide_extern(providers: &mut Providers) { providers.wasm_import_module_map = |tcx, cnum| { // Build up a map from DefId to a `NativeLib` structure, where // `NativeLib` internally contains information about diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 565968f9952e5..67d4b2642c058 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -241,11 +241,11 @@ impl CodegenBackend for LlvmCodegenBackend { Box::new(metadata::LlvmMetadataLoader) } - fn provide(&self, providers: &mut ty::query::Providers<'_>) { + fn provide(&self, providers: &mut ty::query::Providers) { attributes::provide(providers); } - fn provide_extern(&self, providers: &mut ty::query::Providers<'_>) { + fn provide_extern(&self, providers: &mut ty::query::Providers) { attributes::provide_extern(providers); } diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index 217ad57ddc9c3..2efbfcb995027 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -161,9 +161,9 @@ fn is_reachable_non_generic_provider_extern(tcx: TyCtxt<'_>, def_id: DefId) -> b } fn exported_symbols_provider_local( - tcx: TyCtxt<'_>, + tcx: TyCtxt<'tcx>, cnum: CrateNum, -) -> &'tcx [(ExportedSymbol<'_>, SymbolExportLevel)] { +) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)] { assert_eq!(cnum, LOCAL_CRATE); if !tcx.sess.opts.output_types.should_codegen() { @@ -366,7 +366,7 @@ fn is_unreachable_local_definition_provider(tcx: TyCtxt<'_>, def_id: DefId) -> b } } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.reachable_non_generics = reachable_non_generics_provider; providers.is_reachable_non_generic = is_reachable_non_generic_provider_local; providers.exported_symbols = exported_symbols_provider_local; @@ -375,7 +375,7 @@ pub fn provide(providers: &mut Providers<'_>) { providers.upstream_drop_glue_for = upstream_drop_glue_for_provider; } -pub fn provide_extern(providers: &mut Providers<'_>) { +pub fn provide_extern(providers: &mut Providers) { providers.is_reachable_non_generic = is_reachable_non_generic_provider_extern; providers.upstream_monomorphizations_for = upstream_monomorphizations_for_provider; } diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index 5b14258bd25be..4e257fba44ab6 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -853,7 +853,7 @@ impl CrateInfo { } } -pub fn provide_both(providers: &mut Providers<'_>) { +pub fn provide_both(providers: &mut Providers) { providers.backend_optimization_level = |tcx, cratenum| { let for_speed = match tcx.sess.opts.optimize { // If globally no optimisation is done, #[optimize] has no effect. diff --git a/src/librustc_codegen_ssa/lib.rs b/src/librustc_codegen_ssa/lib.rs index 618df15f5bcbe..bdd73c0831352 100644 --- a/src/librustc_codegen_ssa/lib.rs +++ b/src/librustc_codegen_ssa/lib.rs @@ -138,12 +138,12 @@ pub struct CodegenResults { pub crate_info: CrateInfo, } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { crate::back::symbol_export::provide(providers); crate::base::provide_both(providers); } -pub fn provide_extern(providers: &mut Providers<'_>) { +pub fn provide_extern(providers: &mut Providers) { crate::back::symbol_export::provide_extern(providers); crate::base::provide_both(providers); } diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index 6cbb47efa99f2..3522ea0115334 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -55,8 +55,8 @@ pub trait CodegenBackend { fn print_version(&self) {} fn metadata_loader(&self) -> Box; - fn provide(&self, _providers: &mut Providers<'_>); - fn provide_extern(&self, _providers: &mut Providers<'_>); + fn provide(&self, _providers: &mut Providers); + fn provide_extern(&self, _providers: &mut Providers); fn codegen_crate<'tcx>( &self, tcx: TyCtxt<'tcx>, diff --git a/src/librustc_interface/interface.rs b/src/librustc_interface/interface.rs index 920cc6021e687..570104e09b842 100644 --- a/src/librustc_interface/interface.rs +++ b/src/librustc_interface/interface.rs @@ -38,7 +38,7 @@ pub struct Compiler { pub(crate) crate_name: Option, pub(crate) register_lints: Option>, pub(crate) override_queries: - Option, &mut ty::query::Providers<'_>)>, + Option, } impl Compiler { @@ -153,7 +153,7 @@ pub struct Config { /// /// The second parameter is local providers and the third parameter is external providers. pub override_queries: - Option, &mut ty::query::Providers<'_>)>, + Option, /// Registry of diagnostics codes. pub registry: Registry, diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index ed5e715ce7084..6d85c2f182544 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -719,7 +719,7 @@ pub fn prepare_outputs( Ok(outputs) } -pub fn default_provide(providers: &mut ty::query::Providers<'_>) { +pub fn default_provide(providers: &mut ty::query::Providers) { providers.analysis = analysis; proc_macro_decls::provide(providers); plugin::build::provide(providers); @@ -740,7 +740,7 @@ pub fn default_provide(providers: &mut ty::query::Providers<'_>) { rustc_codegen_ssa::provide(providers); } -pub fn default_provide_extern(providers: &mut ty::query::Providers<'_>) { +pub fn default_provide_extern(providers: &mut ty::query::Providers) { rustc_metadata::provide_extern(providers); rustc_codegen_ssa::provide_extern(providers); } diff --git a/src/librustc_interface/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs index c74cba81ca907..e91003b450c3c 100644 --- a/src/librustc_interface/proc_macro_decls.rs +++ b/src/librustc_interface/proc_macro_decls.rs @@ -35,6 +35,6 @@ impl<'v> ItemLikeVisitor<'v> for Finder { fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem<'_>) {} } -pub(crate) fn provide(providers: &mut Providers<'_>) { +pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { proc_macro_decls_static, ..*providers }; } diff --git a/src/librustc_lint/levels.rs b/src/librustc_lint/levels.rs index f875e2750a5c5..2e9cd962a7401 100644 --- a/src/librustc_lint/levels.rs +++ b/src/librustc_lint/levels.rs @@ -571,6 +571,6 @@ impl<'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'_, 'tcx> { } } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.lint_levels = lint_levels; } diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 45a86cf2cc6cc..89e6803e67a2b 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -88,7 +88,7 @@ pub use rustc_session::lint::Level::{self, *}; pub use rustc_session::lint::{BufferedEarlyLint, FutureIncompatibleInfo, Lint, LintId}; pub use rustc_session::lint::{LintArray, LintPass}; -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { levels::provide(providers); *providers = Providers { lint_mod, ..*providers }; } diff --git a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs index a1c586b3283c2..201a32d387779 100644 --- a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs +++ b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs @@ -30,7 +30,7 @@ use std::any::Any; macro_rules! provide { (<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $($name:ident => $compute:block)*) => { - pub fn provide_extern<$lt>(providers: &mut Providers<$lt>) { + pub fn provide_extern(providers: &mut Providers) { $(fn $name<$lt>( $tcx: TyCtxt<$lt>, def_id_arg: ty::query::query_keys::$name<$lt>, @@ -240,7 +240,7 @@ provide! { <'tcx> tcx, def_id, other, cdata, crate_extern_paths => { cdata.source().paths().cloned().collect() } } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { // FIXME(#44234) - almost all of these queries have no sub-queries and // therefore no actual inputs, they're just reading tables calculated in // resolve! Does this work? Unsure! That's what the issue is about diff --git a/src/librustc_middle/hir/map/mod.rs b/src/librustc_middle/hir/map/mod.rs index 75c10de9bbe5e..250f4d5187f2f 100644 --- a/src/librustc_middle/hir/map/mod.rs +++ b/src/librustc_middle/hir/map/mod.rs @@ -1067,6 +1067,6 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId) -> String { } } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.def_kind = |tcx, def_id| tcx.hir().def_kind(def_id.expect_local()); } diff --git a/src/librustc_middle/hir/mod.rs b/src/librustc_middle/hir/mod.rs index e152d11c081a1..485f9b7ce8a6c 100644 --- a/src/librustc_middle/hir/mod.rs +++ b/src/librustc_middle/hir/mod.rs @@ -62,7 +62,7 @@ impl<'tcx> TyCtxt<'tcx> { } } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.parent_module_from_def_id = |tcx, id| { let hir = tcx.hir(); hir.local_def_id(hir.get_module_parent_node(hir.as_local_hir_id(id))) diff --git a/src/librustc_middle/ty/context.rs b/src/librustc_middle/ty/context.rs index d942c07965a49..cb2a6a231a716 100644 --- a/src/librustc_middle/ty/context.rs +++ b/src/librustc_middle/ty/context.rs @@ -1060,8 +1060,8 @@ impl<'tcx> TyCtxt<'tcx> { pub fn create_global_ctxt( s: &'tcx Session, lint_store: Lrc, - local_providers: ty::query::Providers<'tcx>, - extern_providers: ty::query::Providers<'tcx>, + local_providers: ty::query::Providers, + extern_providers: ty::query::Providers, arena: &'tcx WorkerLocal>, resolutions: ty::ResolverOutputs, krate: &'tcx hir::Crate<'tcx>, @@ -2699,7 +2699,7 @@ fn ptr_eq(t: *const T, u: *const U) -> bool { t as *const () == u as *const () } -pub fn provide(providers: &mut ty::query::Providers<'_>) { +pub fn provide(providers: &mut ty::query::Providers) { providers.in_scope_traits_map = |tcx, id| tcx.gcx.trait_map.get(&id); providers.module_exports = |tcx, id| tcx.gcx.export_map.get(&id).map(|v| &v[..]); providers.crate_name = |tcx, id| { diff --git a/src/librustc_middle/ty/erase_regions.rs b/src/librustc_middle/ty/erase_regions.rs index ba165925b6474..48d0fc1839e2f 100644 --- a/src/librustc_middle/ty/erase_regions.rs +++ b/src/librustc_middle/ty/erase_regions.rs @@ -1,7 +1,7 @@ use crate::ty::fold::{TypeFoldable, TypeFolder}; use crate::ty::{self, Ty, TyCtxt, TypeFlags}; -pub(super) fn provide(providers: &mut ty::query::Providers<'_>) { +pub(super) fn provide(providers: &mut ty::query::Providers) { *providers = ty::query::Providers { erase_regions_ty, ..*providers }; } diff --git a/src/librustc_middle/ty/layout.rs b/src/librustc_middle/ty/layout.rs index 39b8566e7a873..73ab54db59f0e 100644 --- a/src/librustc_middle/ty/layout.rs +++ b/src/librustc_middle/ty/layout.rs @@ -210,7 +210,7 @@ fn layout_raw<'tcx>( }) } -pub fn provide(providers: &mut ty::query::Providers<'_>) { +pub fn provide(providers: &mut ty::query::Providers) { *providers = ty::query::Providers { layout_raw, ..*providers }; } diff --git a/src/librustc_middle/ty/mod.rs b/src/librustc_middle/ty/mod.rs index 03aab2c0f9f2c..6b405f77b2e8b 100644 --- a/src/librustc_middle/ty/mod.rs +++ b/src/librustc_middle/ty/mod.rs @@ -2864,7 +2864,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_>, def_id: DefId) -> Option { None } -pub fn provide(providers: &mut ty::query::Providers<'_>) { +pub fn provide(providers: &mut ty::query::Providers) { context::provide(providers); erase_regions::provide(providers); layout::provide(providers); diff --git a/src/librustc_middle/ty/query/plumbing.rs b/src/librustc_middle/ty/query/plumbing.rs index de79a33fac462..f3fa3634026fd 100644 --- a/src/librustc_middle/ty/query/plumbing.rs +++ b/src/librustc_middle/ty/query/plumbing.rs @@ -497,13 +497,16 @@ macro_rules! define_queries_inner { input: ($(([$($modifiers)*] [$name] [$($K)*] [$V]))*) } - impl<$tcx> Copy for Providers<$tcx> {} - impl<$tcx> Clone for Providers<$tcx> { + impl Copy for Providers {} + impl Clone for Providers { fn clone(&self) -> Self { *self } } } } +// FIXME(eddyb) this macro (and others?) use `$tcx` and `'tcx` interchangeably. +// We should either not take `$tcx` at all and use `'tcx` everywhere, or use +// `$tcx` everywhere (even if that isn't necessary due to lack of hygiene). macro_rules! define_queries_struct { (tcx: $tcx:tt, input: ($(([$($modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => { @@ -513,8 +516,8 @@ macro_rules! define_queries_struct { /// `DepGraph::try_mark_green()` and the query infrastructure. pub(crate) on_disk_cache: OnDiskCache<'tcx>, - providers: IndexVec>, - fallback_extern_providers: Box>, + providers: IndexVec, + fallback_extern_providers: Box, $($(#[$attr])* $name: QueryState< TyCtxt<$tcx>, @@ -524,8 +527,8 @@ macro_rules! define_queries_struct { impl<$tcx> Queries<$tcx> { pub(crate) fn new( - providers: IndexVec>, - fallback_extern_providers: Providers<$tcx>, + providers: IndexVec, + fallback_extern_providers: Providers, on_disk_cache: OnDiskCache<'tcx>, ) -> Self { Queries { @@ -558,11 +561,11 @@ macro_rules! define_queries_struct { macro_rules! define_provider_struct { (tcx: $tcx:tt, input: ($(([$($modifiers:tt)*] [$name:ident] [$K:ty] [$R:ty]))*)) => { - pub struct Providers<$tcx> { - $(pub $name: fn(TyCtxt<$tcx>, $K) -> $R,)* + pub struct Providers { + $(pub $name: for<$tcx> fn(TyCtxt<$tcx>, $K) -> $R,)* } - impl<$tcx> Default for Providers<$tcx> { + impl Default for Providers { fn default() -> Self { $(fn $name<$tcx>(_: TyCtxt<$tcx>, key: $K) -> $R { bug!("`tcx.{}({:?})` unsupported by its crate", diff --git a/src/librustc_middle/util/bug.rs b/src/librustc_middle/util/bug.rs index 9c3a97d8332f1..0903ef5089861 100644 --- a/src/librustc_middle/util/bug.rs +++ b/src/librustc_middle/util/bug.rs @@ -47,6 +47,6 @@ pub fn trigger_delay_span_bug(tcx: TyCtxt<'_>, key: rustc_hir::def_id::DefId) { ); } -pub fn provide(providers: &mut crate::ty::query::Providers<'_>) { +pub fn provide(providers: &mut crate::ty::query::Providers) { *providers = crate::ty::query::Providers { trigger_delay_span_bug, ..*providers }; } diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 83691d439eb81..beb5f1fe924ec 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -86,7 +86,7 @@ crate struct Upvar { const DEREF_PROJECTION: &[PlaceElem<'_>; 1] = &[ProjectionElem::Deref]; -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { mir_borrowck, ..*providers }; } diff --git a/src/librustc_mir/const_eval/fn_queries.rs b/src/librustc_mir/const_eval/fn_queries.rs index 74f8a1cb6d124..daa458f70f9a7 100644 --- a/src/librustc_mir/const_eval/fn_queries.rs +++ b/src/librustc_mir/const_eval/fn_queries.rs @@ -156,7 +156,7 @@ fn const_fn_is_allowed_fn_ptr(tcx: TyCtxt<'_>, def_id: DefId) -> bool { && tcx.lookup_const_stability(def_id).map(|stab| stab.allow_const_fn_ptr).unwrap_or(false) } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { is_const_fn_raw, is_const_impl_raw: |tcx, def_id| is_const_impl_raw(tcx, def_id.expect_local()), diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index cb6893166fd79..eff1dc135554f 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -47,7 +47,7 @@ pub mod util; use rustc_middle::ty::query::Providers; -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { borrow_check::provide(providers); const_eval::provide(providers); shim::provide(providers); diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index a945c1d626a9a..ebea65c8f96f2 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -880,9 +880,9 @@ where } fn collect_and_partition_mono_items( - tcx: TyCtxt<'_>, + tcx: TyCtxt<'tcx>, cnum: CrateNum, -) -> (&'tcx DefIdSet, &'tcx [CodegenUnit<'_>]) { +) -> (&'tcx DefIdSet, &'tcx [CodegenUnit<'tcx>]) { assert_eq!(cnum, LOCAL_CRATE); let collection_mode = match tcx.sess.opts.debugging_opts.print_mono_items { @@ -994,7 +994,7 @@ fn collect_and_partition_mono_items( (tcx.arena.alloc(mono_items), codegen_units) } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.collect_and_partition_mono_items = collect_and_partition_mono_items; providers.is_codegened_item = |tcx, def_id| { diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 5671b5b4f04c1..98286cddea68b 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -23,7 +23,7 @@ use crate::util::elaborate_drops::{self, DropElaborator, DropFlagMode, DropStyle use crate::util::expand_aggregate; use crate::util::patch::MirPatch; -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.mir_shims = make_shim; } diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index b8f725e967ddb..f218dd397c0c8 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -488,7 +488,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { } } -pub(crate) fn provide(providers: &mut Providers<'_>) { +pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { unsafety_check_result, unsafe_derive_on_repr_packed, ..*providers }; } diff --git a/src/librustc_mir/transform/instrument_coverage.rs b/src/librustc_mir/transform/instrument_coverage.rs index 25e154f2e9597..76904b7edd533 100644 --- a/src/librustc_mir/transform/instrument_coverage.rs +++ b/src/librustc_mir/transform/instrument_coverage.rs @@ -25,7 +25,7 @@ pub struct InstrumentCoverage; /// The `query` provider for `CoverageInfo`, requested by `codegen_intrinsic_call()` when /// constructing the arguments for `llvm.instrprof.increment`. -pub(crate) fn provide(providers: &mut Providers<'_>) { +pub(crate) fn provide(providers: &mut Providers) { providers.coverageinfo = |tcx, def_id| coverageinfo_from_mir(tcx, def_id); } diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 8ca240d2c7da7..1f48052c1ce0f 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -43,7 +43,7 @@ pub mod uninhabited_enum_branching; pub mod unreachable_prop; pub mod validate; -pub(crate) fn provide(providers: &mut Providers<'_>) { +pub(crate) fn provide(providers: &mut Providers) { self::check_unsafety::provide(providers); *providers = Providers { mir_keys, diff --git a/src/librustc_mir_build/lib.rs b/src/librustc_mir_build/lib.rs index b44d8eee462f0..be495e431eb3c 100644 --- a/src/librustc_mir_build/lib.rs +++ b/src/librustc_mir_build/lib.rs @@ -23,7 +23,7 @@ mod lints; use rustc_middle::ty::query::Providers; -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.check_match = hair::pattern::check_match; providers.lit_to_const = hair::constant::lit_to_const; providers.mir_built = build::mir_built; diff --git a/src/librustc_passes/check_attr.rs b/src/librustc_passes/check_attr.rs index ef84f251390e6..3272ac8f9c73d 100644 --- a/src/librustc_passes/check_attr.rs +++ b/src/librustc_passes/check_attr.rs @@ -469,6 +469,6 @@ fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { .visit_item_likes_in_module(module_def_id, &mut CheckAttrVisitor { tcx }.as_deep_visitor()); } -pub(crate) fn provide(providers: &mut Providers<'_>) { +pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { check_mod_attrs, ..*providers }; } diff --git a/src/librustc_passes/check_const.rs b/src/librustc_passes/check_const.rs index 738754557d84c..b1ebab3f2f806 100644 --- a/src/librustc_passes/check_const.rs +++ b/src/librustc_passes/check_const.rs @@ -62,7 +62,7 @@ fn check_mod_const_bodies(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut vis.as_deep_visitor()); } -pub(crate) fn provide(providers: &mut Providers<'_>) { +pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { check_mod_const_bodies, ..*providers }; } diff --git a/src/librustc_passes/diagnostic_items.rs b/src/librustc_passes/diagnostic_items.rs index d91f49554ff48..3cce4b8d00e8b 100644 --- a/src/librustc_passes/diagnostic_items.rs +++ b/src/librustc_passes/diagnostic_items.rs @@ -118,7 +118,7 @@ fn collect_all<'tcx>(tcx: TyCtxt<'tcx>) -> FxHashMap { collector } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.diagnostic_items = |tcx, id| { assert_eq!(id, LOCAL_CRATE); collect(tcx) diff --git a/src/librustc_passes/entry.rs b/src/librustc_passes/entry.rs index e0ad0ac77476f..11612101e3771 100644 --- a/src/librustc_passes/entry.rs +++ b/src/librustc_passes/entry.rs @@ -217,6 +217,6 @@ pub fn find_entry_point(tcx: TyCtxt<'_>) -> Option<(LocalDefId, EntryFnType)> { tcx.entry_fn(LOCAL_CRATE) } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { entry_fn, ..*providers }; } diff --git a/src/librustc_passes/intrinsicck.rs b/src/librustc_passes/intrinsicck.rs index e4f4885690fd9..25edfad86e8ec 100644 --- a/src/librustc_passes/intrinsicck.rs +++ b/src/librustc_passes/intrinsicck.rs @@ -18,7 +18,7 @@ fn check_mod_intrinsics(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut ItemVisitor { tcx }.as_deep_visitor()); } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { check_mod_intrinsics, ..*providers }; } diff --git a/src/librustc_passes/lang_items.rs b/src/librustc_passes/lang_items.rs index 0326591a931f5..809697134b759 100644 --- a/src/librustc_passes/lang_items.rs +++ b/src/librustc_passes/lang_items.rs @@ -205,7 +205,7 @@ fn collect(tcx: TyCtxt<'_>) -> LanguageItems { items } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.get_lang_items = |tcx, id| { assert_eq!(id, LOCAL_CRATE); collect(tcx) diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index 5109d8debeefd..3f10c418811b7 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -37,7 +37,7 @@ pub mod stability; mod upvars; mod weak_lang_items; -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { check_attr::provide(providers); check_const::provide(providers); diagnostic_items::provide(providers); diff --git a/src/librustc_passes/lib_features.rs b/src/librustc_passes/lib_features.rs index 31c7ba2a4b205..922a475e5f4e4 100644 --- a/src/librustc_passes/lib_features.rs +++ b/src/librustc_passes/lib_features.rs @@ -135,7 +135,7 @@ fn collect(tcx: TyCtxt<'_>) -> LibFeatures { collector.lib_features } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.get_lib_features = |tcx, id| { assert_eq!(id, LOCAL_CRATE); collect(tcx) diff --git a/src/librustc_passes/liveness.rs b/src/librustc_passes/liveness.rs index b288a41e0cfd6..3675a987644da 100644 --- a/src/librustc_passes/liveness.rs +++ b/src/librustc_passes/liveness.rs @@ -179,7 +179,7 @@ fn check_mod_liveness(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { ); } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { check_mod_liveness, ..*providers }; } diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index d7012d4d711df..9b4da71e5e961 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -36,7 +36,7 @@ fn check_mod_loops(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { ); } -pub(crate) fn provide(providers: &mut Providers<'_>) { +pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { check_mod_loops, ..*providers }; } diff --git a/src/librustc_passes/reachable.rs b/src/librustc_passes/reachable.rs index 50fcefa3569ac..c46f4856cfe3a 100644 --- a/src/librustc_passes/reachable.rs +++ b/src/librustc_passes/reachable.rs @@ -425,6 +425,6 @@ fn reachable_set<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> &'tcx HirIdSet tcx.arena.alloc(reachable_context.reachable_symbols) } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { reachable_set, ..*providers }; } diff --git a/src/librustc_passes/region.rs b/src/librustc_passes/region.rs index a6fa677cbc0af..b2a89651881e5 100644 --- a/src/librustc_passes/region.rs +++ b/src/librustc_passes/region.rs @@ -842,6 +842,6 @@ fn region_scope_tree(tcx: TyCtxt<'_>, def_id: DefId) -> &ScopeTree { tcx.arena.alloc(scope_tree) } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { region_scope_tree, ..*providers }; } diff --git a/src/librustc_passes/stability.rs b/src/librustc_passes/stability.rs index 2e1775ca46534..5bacab671ec14 100644 --- a/src/librustc_passes/stability.rs +++ b/src/librustc_passes/stability.rs @@ -476,7 +476,7 @@ fn check_mod_unstable_api_usage(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut Checker { tcx }.as_deep_visitor()); } -pub(crate) fn provide(providers: &mut Providers<'_>) { +pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { check_mod_unstable_api_usage, ..*providers }; providers.stability_index = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); diff --git a/src/librustc_passes/upvars.rs b/src/librustc_passes/upvars.rs index 99b4ef9d12fcd..3aed4942563dd 100644 --- a/src/librustc_passes/upvars.rs +++ b/src/librustc_passes/upvars.rs @@ -9,7 +9,7 @@ use rustc_middle::ty::query::Providers; use rustc_middle::ty::TyCtxt; use rustc_span::Span; -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.upvars_mentioned = |tcx, def_id| { if !tcx.is_closure(def_id) { return None; diff --git a/src/librustc_plugin_impl/build.rs b/src/librustc_plugin_impl/build.rs index 34522cfe97f35..db2363316cd1a 100644 --- a/src/librustc_plugin_impl/build.rs +++ b/src/librustc_plugin_impl/build.rs @@ -57,6 +57,6 @@ fn plugin_registrar_fn(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option { } } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { plugin_registrar_fn, ..*providers }; } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index de21365c5369a..2c5cbed2192ef 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -2029,7 +2029,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> } } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { privacy_access_levels, check_private_in_public, diff --git a/src/librustc_resolve/late/lifetimes.rs b/src/librustc_resolve/late/lifetimes.rs index 903eee672cf1f..e9b917168d67b 100644 --- a/src/librustc_resolve/late/lifetimes.rs +++ b/src/librustc_resolve/late/lifetimes.rs @@ -278,7 +278,7 @@ type ScopeRef<'a> = &'a Scope<'a>; const ROOT_SCOPE: ScopeRef<'static> = &Scope::Root; -pub fn provide(providers: &mut ty::query::Providers<'_>) { +pub fn provide(providers: &mut ty::query::Providers) { *providers = ty::query::Providers { resolve_lifetimes, diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index f3a1934abc9fe..a4ae9eb773168 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -3102,6 +3102,6 @@ impl CrateLint { } } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { late::lifetimes::provide(providers); } diff --git a/src/librustc_symbol_mangling/lib.rs b/src/librustc_symbol_mangling/lib.rs index 5a1c6491f86d8..012321026938e 100644 --- a/src/librustc_symbol_mangling/lib.rs +++ b/src/librustc_symbol_mangling/lib.rs @@ -126,7 +126,7 @@ pub fn symbol_name_for_instance_in_crate( compute_symbol_name(tcx, instance, || instantiating_crate) } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { symbol_name: symbol_name_provider, ..*providers }; } diff --git a/src/librustc_trait_selection/traits/mod.rs b/src/librustc_trait_selection/traits/mod.rs index 9ab87e6b6ca01..597d05145dad6 100644 --- a/src/librustc_trait_selection/traits/mod.rs +++ b/src/librustc_trait_selection/traits/mod.rs @@ -550,7 +550,7 @@ fn type_implements_trait<'tcx>( tcx.infer_ctxt().enter(|infcx| infcx.predicate_must_hold_modulo_regions(&obligation)) } -pub fn provide(providers: &mut ty::query::Providers<'_>) { +pub fn provide(providers: &mut ty::query::Providers) { object_safety::provide(providers); structural_match::provide(providers); *providers = ty::query::Providers { diff --git a/src/librustc_trait_selection/traits/object_safety.rs b/src/librustc_trait_selection/traits/object_safety.rs index 5befc797a517a..9e523865abb8d 100644 --- a/src/librustc_trait_selection/traits/object_safety.rs +++ b/src/librustc_trait_selection/traits/object_safety.rs @@ -790,6 +790,6 @@ fn contains_illegal_self_type_reference<'tcx>( }) } -pub fn provide(providers: &mut ty::query::Providers<'_>) { +pub fn provide(providers: &mut ty::query::Providers) { *providers = ty::query::Providers { object_safety_violations, ..*providers }; } diff --git a/src/librustc_trait_selection/traits/structural_match.rs b/src/librustc_trait_selection/traits/structural_match.rs index 201edf27a655c..377d163d10439 100644 --- a/src/librustc_trait_selection/traits/structural_match.rs +++ b/src/librustc_trait_selection/traits/structural_match.rs @@ -271,7 +271,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for Search<'a, 'tcx> { } } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { providers.has_structural_eq_impls = |tcx, ty| { tcx.infer_ctxt().enter(|infcx| { let cause = ObligationCause::dummy(); diff --git a/src/librustc_traits/chalk/mod.rs b/src/librustc_traits/chalk/mod.rs index 52ec0f2409dce..0c5d57551f9c5 100644 --- a/src/librustc_traits/chalk/mod.rs +++ b/src/librustc_traits/chalk/mod.rs @@ -29,7 +29,7 @@ use crate::chalk::lowering::{LowerInto, ParamsSubstitutor}; use chalk_solve::Solution; -crate fn provide(p: &mut Providers<'_>) { +crate fn provide(p: &mut Providers) { *p = Providers { evaluate_goal, ..*p }; } diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs index 6339f8288d54e..ce00060b9b172 100644 --- a/src/librustc_traits/dropck_outlives.rs +++ b/src/librustc_traits/dropck_outlives.rs @@ -17,7 +17,7 @@ use rustc_trait_selection::traits::{ Normalized, ObligationCause, TraitEngine, TraitEngineExt as _, }; -crate fn provide(p: &mut Providers<'_>) { +crate fn provide(p: &mut Providers) { *p = Providers { dropck_outlives, adt_dtorck_constraint, ..*p }; } diff --git a/src/librustc_traits/evaluate_obligation.rs b/src/librustc_traits/evaluate_obligation.rs index e6afc15fa15fe..2404b7ff4b54a 100644 --- a/src/librustc_traits/evaluate_obligation.rs +++ b/src/librustc_traits/evaluate_obligation.rs @@ -7,7 +7,7 @@ use rustc_trait_selection::traits::{ EvaluationResult, Obligation, ObligationCause, OverflowError, SelectionContext, TraitQueryMode, }; -crate fn provide(p: &mut Providers<'_>) { +crate fn provide(p: &mut Providers) { *p = Providers { evaluate_obligation, ..*p }; } diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index 651596d0379bb..bda3da120e958 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -18,7 +18,7 @@ use rustc_trait_selection::traits::FulfillmentContext; use rustc_trait_selection::traits::TraitEngine; use smallvec::{smallvec, SmallVec}; -crate fn provide(p: &mut Providers<'_>) { +crate fn provide(p: &mut Providers) { *p = Providers { implied_outlives_bounds, ..*p }; } diff --git a/src/librustc_traits/lib.rs b/src/librustc_traits/lib.rs index f3dfdffda4191..b8e23760ba5d4 100644 --- a/src/librustc_traits/lib.rs +++ b/src/librustc_traits/lib.rs @@ -22,7 +22,7 @@ mod type_op; use rustc_middle::ty::query::Providers; -pub fn provide(p: &mut Providers<'_>) { +pub fn provide(p: &mut Providers) { dropck_outlives::provide(p); evaluate_obligation::provide(p); implied_outlives_bounds::provide(p); diff --git a/src/librustc_traits/normalize_erasing_regions.rs b/src/librustc_traits/normalize_erasing_regions.rs index fcb75142269df..7092515af0882 100644 --- a/src/librustc_traits/normalize_erasing_regions.rs +++ b/src/librustc_traits/normalize_erasing_regions.rs @@ -7,7 +7,7 @@ use rustc_trait_selection::traits::query::normalize::AtExt; use rustc_trait_selection::traits::{Normalized, ObligationCause}; use std::sync::atomic::Ordering; -crate fn provide(p: &mut Providers<'_>) { +crate fn provide(p: &mut Providers) { *p = Providers { normalize_generic_arg_after_erasing_regions, ..*p }; } diff --git a/src/librustc_traits/normalize_projection_ty.rs b/src/librustc_traits/normalize_projection_ty.rs index d6d3e86a2c8d3..a8e376838e218 100644 --- a/src/librustc_traits/normalize_projection_ty.rs +++ b/src/librustc_traits/normalize_projection_ty.rs @@ -10,7 +10,7 @@ use rustc_trait_selection::traits::query::{ use rustc_trait_selection::traits::{self, ObligationCause, SelectionContext}; use std::sync::atomic::Ordering; -crate fn provide(p: &mut Providers<'_>) { +crate fn provide(p: &mut Providers) { *p = Providers { normalize_projection_ty, ..*p }; } diff --git a/src/librustc_traits/type_op.rs b/src/librustc_traits/type_op.rs index 374ef3fc9c783..9cc9a35b38b8a 100644 --- a/src/librustc_traits/type_op.rs +++ b/src/librustc_traits/type_op.rs @@ -21,7 +21,7 @@ use rustc_trait_selection::traits::query::{Fallible, NoSolution}; use rustc_trait_selection::traits::{Normalized, Obligation, ObligationCause, TraitEngine}; use std::fmt; -crate fn provide(p: &mut Providers<'_>) { +crate fn provide(p: &mut Providers) { *p = Providers { type_op_ascribe_user_type, type_op_eq, diff --git a/src/librustc_ty/common_traits.rs b/src/librustc_ty/common_traits.rs index 265b811571afe..8d153e77f0b7d 100644 --- a/src/librustc_ty/common_traits.rs +++ b/src/librustc_ty/common_traits.rs @@ -36,6 +36,6 @@ fn is_item_raw<'tcx>( }) } -pub(crate) fn provide(providers: &mut ty::query::Providers<'_>) { +pub(crate) fn provide(providers: &mut ty::query::Providers) { *providers = ty::query::Providers { is_copy_raw, is_sized_raw, is_freeze_raw, ..*providers }; } diff --git a/src/librustc_ty/instance.rs b/src/librustc_ty/instance.rs index 0acf769168137..d74f25e655611 100644 --- a/src/librustc_ty/instance.rs +++ b/src/librustc_ty/instance.rs @@ -243,6 +243,6 @@ fn resolve_associated_item<'tcx>( }) } -pub fn provide(providers: &mut ty::query::Providers<'_>) { +pub fn provide(providers: &mut ty::query::Providers) { *providers = ty::query::Providers { resolve_instance, ..*providers }; } diff --git a/src/librustc_ty/lib.rs b/src/librustc_ty/lib.rs index 75e62e796408a..8f3b20c7aaf40 100644 --- a/src/librustc_ty/lib.rs +++ b/src/librustc_ty/lib.rs @@ -21,7 +21,7 @@ pub mod instance; mod needs_drop; mod ty; -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { common_traits::provide(providers); needs_drop::provide(providers); ty::provide(providers); diff --git a/src/librustc_ty/needs_drop.rs b/src/librustc_ty/needs_drop.rs index 7880c09c2ad81..c4af95205fe27 100644 --- a/src/librustc_ty/needs_drop.rs +++ b/src/librustc_ty/needs_drop.rs @@ -183,6 +183,6 @@ fn adt_drop_tys(tcx: TyCtxt<'_>, def_id: DefId) -> Result<&ty::List>, Alw res.map(|components| tcx.intern_type_list(&components)) } -pub(crate) fn provide(providers: &mut ty::query::Providers<'_>) { +pub(crate) fn provide(providers: &mut ty::query::Providers) { *providers = ty::query::Providers { needs_drop_raw, adt_drop_tys, ..*providers }; } diff --git a/src/librustc_ty/ty.rs b/src/librustc_ty/ty.rs index 595992d01dd2d..c99bc8a47e33b 100644 --- a/src/librustc_ty/ty.rs +++ b/src/librustc_ty/ty.rs @@ -494,7 +494,7 @@ fn projection_predicates(tcx: TyCtxt<'_>, def_id: DefId) -> &'_ ty::List) { +pub fn provide(providers: &mut ty::query::Providers) { *providers = ty::query::Providers { asyncness, associated_item, diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index 7bdf137f116c8..b1799c6eef336 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -28,7 +28,7 @@ use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt; use self::probe::{IsSuggestion, ProbeScope}; -pub fn provide(providers: &mut ty::query::Providers<'_>) { +pub fn provide(providers: &mut ty::query::Providers) { suggest::provide(providers); probe::provide(providers); } diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 8842ca877268a..a11198348682d 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -440,7 +440,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } -pub fn provide(providers: &mut ty::query::Providers<'_>) { +pub fn provide(providers: &mut ty::query::Providers) { providers.method_autoderef_steps = method_autoderef_steps; } diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index fbf81e94d03d5..44ffabc4c2662 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -1292,7 +1292,7 @@ fn compute_all_traits(tcx: TyCtxt<'_>) -> Vec { traits } -pub fn provide(providers: &mut ty::query::Providers<'_>) { +pub fn provide(providers: &mut ty::query::Providers) { providers.all_traits = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); &tcx.arena.alloc(compute_all_traits(tcx))[..] diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 58fd0f989c678..dc62c7ec01ce3 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -760,7 +760,7 @@ fn check_impl_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) { wfcheck::check_impl_item(tcx, def_id); } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { method::provide(providers); *providers = Providers { typeck_item_bodies, diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 3b203dd222afb..1483244717b4f 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -151,7 +151,7 @@ fn enforce_empty_impls_for_marker_traits( struct_span_err!(tcx.sess, span, E0715, "impls for marker traits cannot contain items").emit(); } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { use self::builtin::coerce_unsized_info; use self::inherent_impls::{crate_inherent_impls, inherent_impls}; use self::inherent_impls_overlap::crate_inherent_impls_overlap_check; diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 8920203e6af40..cbee74a0e0124 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -62,7 +62,7 @@ fn collect_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { ); } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { type_of: type_of::type_of, generics_of, diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 77cd1b3de0106..891e482b43133 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -69,7 +69,7 @@ fn check_mod_impl_wf(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { .visit_item_likes_in_module(module_def_id, &mut ImplWfCheck { tcx, min_specialization }); } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { check_mod_impl_wf, ..*providers }; } diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 8d8a1b4d96761..9ba2545ba63cb 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -309,7 +309,7 @@ fn check_for_entry_fn(tcx: TyCtxt<'_>) { } } -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { collect::provide(providers); coherence::provide(providers); check::provide(providers); diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index 1b2b08a2e62ee..cc5858314597c 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -13,7 +13,7 @@ mod implicit_infer; pub mod test; mod utils; -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { inferred_outlives_of, inferred_outlives_crate, ..*providers }; } diff --git a/src/librustc_typeck/variance/mod.rs b/src/librustc_typeck/variance/mod.rs index 23f4e1f5346e5..b307363dc3ab0 100644 --- a/src/librustc_typeck/variance/mod.rs +++ b/src/librustc_typeck/variance/mod.rs @@ -26,7 +26,7 @@ pub mod test; /// Code for transforming variances. mod xform; -pub fn provide(providers: &mut Providers<'_>) { +pub fn provide(providers: &mut Providers) { *providers = Providers { variances_of, crate_variances, ..*providers }; }