Move expansion of query macros in rustc_middle to rustc_middle::query
This commit is contained in:
parent
a14d6961f9
commit
fff20a703d
102 changed files with 257 additions and 222 deletions
|
@ -1,5 +1,6 @@
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::layout::{
|
||||
fn_can_unwind, FnAbiError, HasParamEnv, HasTyCtxt, LayoutCx, LayoutOf, TyAndLayout,
|
||||
};
|
||||
|
@ -14,8 +15,8 @@ use rustc_target::spec::abi::Abi as SpecAbi;
|
|||
|
||||
use std::iter;
|
||||
|
||||
pub fn provide(providers: &mut ty::query::Providers) {
|
||||
*providers = ty::query::Providers { fn_abi_of_fn_ptr, fn_abi_of_instance, ..*providers };
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { fn_abi_of_fn_ptr, fn_abi_of_instance, ..*providers };
|
||||
}
|
||||
|
||||
// NOTE(eddyb) this is private to avoid using it from outside of
|
||||
|
|
|
@ -4,11 +4,12 @@ use rustc_hir::def::DefKind;
|
|||
use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId};
|
||||
use rustc_hir::definitions::DefPathData;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{self, ImplTraitInTraitData, InternalSubsts, TyCtxt};
|
||||
use rustc_span::symbol::kw;
|
||||
|
||||
pub fn provide(providers: &mut ty::query::Providers) {
|
||||
*providers = ty::query::Providers {
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
*providers = Providers {
|
||||
associated_item,
|
||||
associated_item_def_ids,
|
||||
associated_items,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_trait_selection::traits;
|
||||
|
||||
|
@ -32,12 +33,6 @@ fn is_item_raw<'tcx>(
|
|||
traits::type_known_to_meet_bound_modulo_regions(&infcx, param_env, ty, trait_def_id)
|
||||
}
|
||||
|
||||
pub(crate) fn provide(providers: &mut ty::query::Providers) {
|
||||
*providers = ty::query::Providers {
|
||||
is_copy_raw,
|
||||
is_sized_raw,
|
||||
is_freeze_raw,
|
||||
is_unpin_raw,
|
||||
..*providers
|
||||
};
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { is_copy_raw, is_sized_raw, is_freeze_raw, is_unpin_raw, ..*providers };
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ use rustc_errors::ErrorGuaranteed;
|
|||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_middle::mir::interpret::{LitToConstError, LitToConstInput};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::thir::visit;
|
||||
use rustc_middle::thir::visit::Visitor;
|
||||
use rustc_middle::ty::abstract_const::CastKind;
|
||||
|
@ -423,6 +424,6 @@ pub fn thir_abstract_const(
|
|||
Ok(Some(ty::EarlyBinder(recurse_build(tcx, body, body_id, root_span)?)))
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut ty::query::Providers) {
|
||||
*providers = ty::query::Providers { destructure_const, thir_abstract_const, ..*providers };
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { destructure_const, thir_abstract_const, ..*providers };
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use rustc_hir::{def::DefKind, def_id::DefId};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
|
||||
pub fn provide(providers: &mut ty::query::Providers) {
|
||||
*providers = ty::query::Providers { assumed_wf_types, ..*providers };
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { assumed_wf_types, ..*providers };
|
||||
}
|
||||
|
||||
fn assumed_wf_types(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::List<Ty<'_>> {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::traits::CodegenObligationError;
|
||||
use rustc_middle::ty::subst::SubstsRef;
|
||||
use rustc_middle::ty::{self, Instance, TyCtxt, TypeVisitableExt};
|
||||
|
@ -319,6 +320,6 @@ fn resolve_associated_item<'tcx>(
|
|||
})
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut ty::query::Providers) {
|
||||
*providers = ty::query::Providers { resolve_instance, ..*providers };
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { resolve_instance, ..*providers };
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ use rustc_hir as hir;
|
|||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_index::{IndexSlice, IndexVec};
|
||||
use rustc_middle::mir::{GeneratorLayout, GeneratorSavedLocal};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::layout::{
|
||||
IntegerExt, LayoutCx, LayoutError, LayoutOf, TyAndLayout, MAX_SIMD_LANES,
|
||||
};
|
||||
|
@ -22,8 +23,8 @@ use crate::errors::{
|
|||
};
|
||||
use crate::layout_sanity_check::sanity_check_layout;
|
||||
|
||||
pub fn provide(providers: &mut ty::query::Providers) {
|
||||
*providers = ty::query::Providers { layout_of, ..*providers };
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { layout_of, ..*providers };
|
||||
}
|
||||
|
||||
#[instrument(skip(tcx, query), level = "debug")]
|
||||
|
|
|
@ -21,7 +21,7 @@ extern crate tracing;
|
|||
|
||||
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
|
||||
use rustc_fluent_macro::fluent_messages;
|
||||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_middle::query::Providers;
|
||||
|
||||
mod abi;
|
||||
mod assoc;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::subst::SubstsRef;
|
||||
use rustc_middle::ty::util::{needs_drop_components, AlwaysRequiresDrop};
|
||||
use rustc_middle::ty::{self, EarlyBinder, Ty, TyCtxt};
|
||||
|
@ -323,8 +324,8 @@ fn adt_significant_drop_tys(
|
|||
.map(|components| tcx.mk_type_list(&components))
|
||||
}
|
||||
|
||||
pub(crate) fn provide(providers: &mut ty::query::Providers) {
|
||||
*providers = ty::query::Providers {
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
*providers = Providers {
|
||||
needs_drop_raw,
|
||||
has_significant_drop_raw,
|
||||
adt_drop_tys,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::{def::DefKind, def_id::LocalDefId};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::util::{CheckRegions, NotUniqueParam};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{TypeSuperVisitable, TypeVisitable, TypeVisitor};
|
||||
|
@ -192,6 +193,6 @@ fn opaque_types_defined_by<'tcx>(tcx: TyCtxt<'tcx>, item: LocalDefId) -> &'tcx [
|
|||
}
|
||||
}
|
||||
|
||||
pub(super) fn provide(providers: &mut ty::query::Providers) {
|
||||
*providers = ty::query::Providers { opaque_types_defined_by, ..*providers };
|
||||
pub(super) fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { opaque_types_defined_by, ..*providers };
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{self, Representability, Ty, TyCtxt};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
|
|
|
@ -2,6 +2,7 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{
|
||||
self, Binder, EarlyBinder, ImplTraitInTraitData, Predicate, PredicateKind, ToPredicate, Ty,
|
||||
TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor,
|
||||
|
@ -566,8 +567,8 @@ fn unsizing_params_for_adt<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> BitSet<u32
|
|||
unsizing_params
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut ty::query::Providers) {
|
||||
*providers = ty::query::Providers {
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
*providers = Providers {
|
||||
asyncness,
|
||||
adt_sized_constraint,
|
||||
param_env,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue