Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.

This commit is contained in:
Eduard-Mihai Burtescu 2020-07-05 23:00:14 +03:00
parent f25811e34b
commit f07100afc8
74 changed files with 99 additions and 96 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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.

View file

@ -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);
}

View file

@ -55,8 +55,8 @@ pub trait CodegenBackend {
fn print_version(&self) {}
fn metadata_loader(&self) -> Box<MetadataLoaderDyn>;
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>,

View file

@ -38,7 +38,7 @@ pub struct Compiler {
pub(crate) crate_name: Option<String>,
pub(crate) register_lints: Option<Box<dyn Fn(&Session, &mut LintStore) + Send + Sync>>,
pub(crate) override_queries:
Option<fn(&Session, &mut ty::query::Providers<'_>, &mut ty::query::Providers<'_>)>,
Option<fn(&Session, &mut ty::query::Providers, &mut ty::query::Providers)>,
}
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<fn(&Session, &mut ty::query::Providers<'_>, &mut ty::query::Providers<'_>)>,
Option<fn(&Session, &mut ty::query::Providers, &mut ty::query::Providers)>,
/// Registry of diagnostics codes.
pub registry: Registry,

View file

@ -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);
}

View file

@ -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 };
}

View file

@ -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;
}

View file

@ -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 };
}

View file

@ -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

View file

@ -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());
}

View file

@ -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)))

View file

@ -1060,8 +1060,8 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn create_global_ctxt(
s: &'tcx Session,
lint_store: Lrc<dyn Any + sync::Send + sync::Sync>,
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<Arena<'tcx>>,
resolutions: ty::ResolverOutputs,
krate: &'tcx hir::Crate<'tcx>,
@ -2699,7 +2699,7 @@ fn ptr_eq<T, U>(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| {

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -2864,7 +2864,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
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);

View file

@ -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<CrateNum, Providers<$tcx>>,
fallback_extern_providers: Box<Providers<$tcx>>,
providers: IndexVec<CrateNum, Providers>,
fallback_extern_providers: Box<Providers>,
$($(#[$attr])* $name: QueryState<
TyCtxt<$tcx>,
@ -524,8 +527,8 @@ macro_rules! define_queries_struct {
impl<$tcx> Queries<$tcx> {
pub(crate) fn new(
providers: IndexVec<CrateNum, Providers<$tcx>>,
fallback_extern_providers: Providers<$tcx>,
providers: IndexVec<CrateNum, Providers>,
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",

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -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()),

View file

@ -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);

View file

@ -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| {

View file

@ -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;
}

View file

@ -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 };
}

View file

@ -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);
}

View file

@ -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,

View file

@ -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;

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -118,7 +118,7 @@ fn collect_all<'tcx>(tcx: TyCtxt<'tcx>) -> FxHashMap<Symbol, DefId> {
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)

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -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)

View file

@ -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);

View file

@ -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)

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -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);

View file

@ -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;

View file

@ -57,6 +57,6 @@ fn plugin_registrar_fn(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<DefId> {
}
}
pub fn provide(providers: &mut Providers<'_>) {
pub fn provide(providers: &mut Providers) {
*providers = Providers { plugin_registrar_fn, ..*providers };
}

View file

@ -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,

View file

@ -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,

View file

@ -3102,6 +3102,6 @@ impl CrateLint {
}
}
pub fn provide(providers: &mut Providers<'_>) {
pub fn provide(providers: &mut Providers) {
late::lifetimes::provide(providers);
}

View file

@ -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 };
}

View file

@ -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 {

View file

@ -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 };
}

View file

@ -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();

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -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);

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -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,

View file

@ -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 };
}

View file

@ -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 };
}

View file

@ -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);

View file

@ -183,6 +183,6 @@ fn adt_drop_tys(tcx: TyCtxt<'_>, def_id: DefId) -> Result<&ty::List<Ty<'_>>, 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 };
}

View file

@ -494,7 +494,7 @@ fn projection_predicates(tcx: TyCtxt<'_>, def_id: DefId) -> &'_ ty::List<ty::Pre
}
}
pub fn provide(providers: &mut ty::query::Providers<'_>) {
pub fn provide(providers: &mut ty::query::Providers) {
*providers = ty::query::Providers {
asyncness,
associated_item,

View file

@ -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);
}

View file

@ -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;
}

View file

@ -1292,7 +1292,7 @@ fn compute_all_traits(tcx: TyCtxt<'_>) -> Vec<DefId> {
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))[..]

View file

@ -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,

View file

@ -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;

View file

@ -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,

View file

@ -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 };
}

View file

@ -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);

View file

@ -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 };
}

View file

@ -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 };
}