Move lifetime resolution module to rustc_hir_analysis.
This commit is contained in:
parent
0265a3e93b
commit
a474ec50b7
5 changed files with 5 additions and 21 deletions
|
@ -46,6 +46,7 @@ use std::iter;
|
||||||
|
|
||||||
mod generics_of;
|
mod generics_of;
|
||||||
mod item_bounds;
|
mod item_bounds;
|
||||||
|
mod lifetimes;
|
||||||
mod predicates_of;
|
mod predicates_of;
|
||||||
mod type_of;
|
mod type_of;
|
||||||
|
|
||||||
|
@ -57,6 +58,7 @@ fn collect_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut Providers) {
|
pub fn provide(providers: &mut Providers) {
|
||||||
|
lifetimes::provide(providers);
|
||||||
*providers = Providers {
|
*providers = Providers {
|
||||||
opt_const_param_of: type_of::opt_const_param_of,
|
opt_const_param_of: type_of::opt_const_param_of,
|
||||||
type_of: type_of::type_of,
|
type_of: type_of::type_of,
|
||||||
|
|
|
@ -32,8 +32,6 @@ trait RegionExt {
|
||||||
fn id(&self) -> Option<DefId>;
|
fn id(&self) -> Option<DefId>;
|
||||||
|
|
||||||
fn shifted(self, amount: u32) -> Region;
|
fn shifted(self, amount: u32) -> Region;
|
||||||
|
|
||||||
fn shifted_out_to_binder(self, binder: ty::DebruijnIndex) -> Region;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RegionExt for Region {
|
impl RegionExt for Region {
|
||||||
|
@ -69,15 +67,6 @@ impl RegionExt for Region {
|
||||||
_ => self,
|
_ => self,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn shifted_out_to_binder(self, binder: ty::DebruijnIndex) -> Region {
|
|
||||||
match self {
|
|
||||||
Region::LateBound(debruijn, index, id) => {
|
|
||||||
Region::LateBound(debruijn.shifted_out_to_binder(binder), index, id)
|
|
||||||
}
|
|
||||||
_ => self,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Maps the id of each lifetime reference to the lifetime decl
|
/// Maps the id of each lifetime reference to the lifetime decl
|
||||||
|
@ -101,8 +90,8 @@ struct NamedRegionMap {
|
||||||
late_bound_vars: HirIdMap<Vec<ty::BoundVariableKind>>,
|
late_bound_vars: HirIdMap<Vec<ty::BoundVariableKind>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct LifetimeContext<'a, 'tcx> {
|
struct LifetimeContext<'a, 'tcx> {
|
||||||
pub(crate) tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
map: &'a mut NamedRegionMap,
|
map: &'a mut NamedRegionMap,
|
||||||
scope: ScopeRef<'a>,
|
scope: ScopeRef<'a>,
|
||||||
|
|
||||||
|
@ -234,7 +223,7 @@ type ScopeRef<'a> = &'a Scope<'a>;
|
||||||
|
|
||||||
const ROOT_SCOPE: ScopeRef<'static> = &Scope::Root;
|
const ROOT_SCOPE: ScopeRef<'static> = &Scope::Root;
|
||||||
|
|
||||||
pub fn provide(providers: &mut ty::query::Providers) {
|
pub(crate) fn provide(providers: &mut ty::query::Providers) {
|
||||||
*providers = ty::query::Providers {
|
*providers = ty::query::Providers {
|
||||||
resolve_lifetimes_trait_definition,
|
resolve_lifetimes_trait_definition,
|
||||||
resolve_lifetimes,
|
resolve_lifetimes,
|
|
@ -739,7 +739,6 @@ pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| {
|
||||||
ty::provide(providers);
|
ty::provide(providers);
|
||||||
traits::provide(providers);
|
traits::provide(providers);
|
||||||
rustc_passes::provide(providers);
|
rustc_passes::provide(providers);
|
||||||
rustc_resolve::provide(providers);
|
|
||||||
rustc_traits::provide(providers);
|
rustc_traits::provide(providers);
|
||||||
rustc_ty_utils::provide(providers);
|
rustc_ty_utils::provide(providers);
|
||||||
rustc_metadata::provide(providers);
|
rustc_metadata::provide(providers);
|
||||||
|
|
|
@ -34,7 +34,6 @@ use std::collections::{hash_map::Entry, BTreeSet};
|
||||||
use std::mem::{replace, take};
|
use std::mem::{replace, take};
|
||||||
|
|
||||||
mod diagnostics;
|
mod diagnostics;
|
||||||
pub(crate) mod lifetimes;
|
|
||||||
|
|
||||||
type Res = def::Res<NodeId>;
|
type Res = def::Res<NodeId>;
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ use rustc_metadata::creader::{CStore, CrateLoader};
|
||||||
use rustc_middle::metadata::ModChild;
|
use rustc_middle::metadata::ModChild;
|
||||||
use rustc_middle::middle::privacy::AccessLevels;
|
use rustc_middle::middle::privacy::AccessLevels;
|
||||||
use rustc_middle::span_bug;
|
use rustc_middle::span_bug;
|
||||||
use rustc_middle::ty::query::Providers;
|
|
||||||
use rustc_middle::ty::{self, DefIdTree, MainDefinition, RegisteredTools, ResolverOutputs};
|
use rustc_middle::ty::{self, DefIdTree, MainDefinition, RegisteredTools, ResolverOutputs};
|
||||||
use rustc_query_system::ich::StableHashingContext;
|
use rustc_query_system::ich::StableHashingContext;
|
||||||
use rustc_session::cstore::{CrateStore, CrateStoreDyn, MetadataLoaderDyn};
|
use rustc_session::cstore::{CrateStore, CrateStoreDyn, MetadataLoaderDyn};
|
||||||
|
@ -2082,7 +2081,3 @@ impl Finalize {
|
||||||
Finalize { node_id, path_span, root_span, report_private: true }
|
Finalize { node_id, path_span, root_span, report_private: true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut Providers) {
|
|
||||||
late::lifetimes::provide(providers);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue