Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed PerDefTables to Tables #70615

Merged
merged 1 commit into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions src/librustc_metadata/rmeta/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
}

fn maybe_kind(&self, item_id: DefIndex) -> Option<EntryKind> {
self.root.per_def.kind.get(self, item_id).map(|k| k.decode(self))
self.root.tables.kind.get(self, item_id).map(|k| k.decode(self))
}

fn kind(&self, item_id: DefIndex) -> EntryKind {
Expand Down Expand Up @@ -665,7 +665,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
.expect("no name in item_ident");
let span = self
.root
.per_def
.tables
.ident_span
.get(self, item_index)
.map(|data| data.decode((self, sess)))
Expand All @@ -688,7 +688,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
}

fn get_span(&self, index: DefIndex, sess: &Session) -> Span {
self.root.per_def.span.get(self, index).unwrap().decode((self, sess))
self.root.tables.span.get(self, index).unwrap().decode((self, sess))
}

fn load_proc_macro(&self, id: DefIndex, sess: &Session) -> SyntaxExtension {
Expand Down Expand Up @@ -781,7 +781,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
ctor_did,
data.discr,
self.root
.per_def
.tables
.children
.get(self, index)
.unwrap_or(Lazy::empty())
Expand Down Expand Up @@ -812,7 +812,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {

let variants = if let ty::AdtKind::Enum = adt_kind {
self.root
.per_def
.tables
.children
.get(self, item_id)
.unwrap_or(Lazy::empty())
Expand All @@ -831,7 +831,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
item_id: DefIndex,
tcx: TyCtxt<'tcx>,
) -> ty::GenericPredicates<'tcx> {
self.root.per_def.explicit_predicates.get(self, item_id).unwrap().decode((self, tcx))
self.root.tables.explicit_predicates.get(self, item_id).unwrap().decode((self, tcx))
}

fn get_inferred_outlives(
Expand All @@ -840,7 +840,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
tcx: TyCtxt<'tcx>,
) -> &'tcx [(ty::Predicate<'tcx>, Span)] {
self.root
.per_def
.tables
.inferred_outlives
.get(self, item_id)
.map(|predicates| predicates.decode((self, tcx)))
Expand All @@ -852,31 +852,31 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
item_id: DefIndex,
tcx: TyCtxt<'tcx>,
) -> ty::GenericPredicates<'tcx> {
self.root.per_def.super_predicates.get(self, item_id).unwrap().decode((self, tcx))
self.root.tables.super_predicates.get(self, item_id).unwrap().decode((self, tcx))
}

fn get_generics(&self, item_id: DefIndex, sess: &Session) -> ty::Generics {
self.root.per_def.generics.get(self, item_id).unwrap().decode((self, sess))
self.root.tables.generics.get(self, item_id).unwrap().decode((self, sess))
}

fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
self.root.per_def.ty.get(self, id).unwrap().decode((self, tcx))
self.root.tables.ty.get(self, id).unwrap().decode((self, tcx))
}

fn get_stability(&self, id: DefIndex) -> Option<attr::Stability> {
match self.is_proc_macro(id) {
true => self.root.proc_macro_stability,
false => self.root.per_def.stability.get(self, id).map(|stab| stab.decode(self)),
false => self.root.tables.stability.get(self, id).map(|stab| stab.decode(self)),
}
}

fn get_const_stability(&self, id: DefIndex) -> Option<attr::ConstStability> {
self.root.per_def.const_stability.get(self, id).map(|stab| stab.decode(self))
self.root.tables.const_stability.get(self, id).map(|stab| stab.decode(self))
}

fn get_deprecation(&self, id: DefIndex) -> Option<attr::Deprecation> {
self.root
.per_def
.tables
.deprecation
.get(self, id)
.filter(|_| !self.is_proc_macro(id))
Expand All @@ -886,7 +886,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
fn get_visibility(&self, id: DefIndex) -> ty::Visibility {
match self.is_proc_macro(id) {
true => ty::Visibility::Public,
false => self.root.per_def.visibility.get(self, id).unwrap().decode(self),
false => self.root.tables.visibility.get(self, id).unwrap().decode(self),
}
}

Expand Down Expand Up @@ -914,7 +914,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
}

fn get_impl_trait(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> Option<ty::TraitRef<'tcx>> {
self.root.per_def.impl_trait_ref.get(self, id).map(|tr| tr.decode((self, tcx)))
self.root.tables.impl_trait_ref.get(self, id).map(|tr| tr.decode((self, tcx)))
}

/// Iterates over all the stability attributes in the given crate.
Expand Down Expand Up @@ -984,7 +984,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {

// Iterate over all children.
let macros_only = self.dep_kind.lock().macros_only();
let children = self.root.per_def.children.get(self, id).unwrap_or(Lazy::empty());
let children = self.root.tables.children.get(self, id).unwrap_or(Lazy::empty());
for child_index in children.decode((self, sess)) {
if macros_only {
continue;
Expand All @@ -1004,7 +1004,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
EntryKind::ForeignMod => {
let child_children = self
.root
.per_def
.tables
.children
.get(self, child_index)
.unwrap_or(Lazy::empty());
Expand All @@ -1016,7 +1016,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
vis: self.get_visibility(child_index),
span: self
.root
.per_def
.tables
.span
.get(self, child_index)
.unwrap()
Expand Down Expand Up @@ -1096,13 +1096,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
}

fn is_item_mir_available(&self, id: DefIndex) -> bool {
!self.is_proc_macro(id) && self.root.per_def.mir.get(self, id).is_some()
!self.is_proc_macro(id) && self.root.tables.mir.get(self, id).is_some()
}

fn get_optimized_mir(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> BodyAndCache<'tcx> {
let mut cache = self
.root
.per_def
.tables
.mir
.get(self, id)
.filter(|_| !self.is_proc_macro(id))
Expand All @@ -1121,7 +1121,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
) -> IndexVec<Promoted, BodyAndCache<'tcx>> {
let mut cache = self
.root
.per_def
.tables
.promoted_mir
.get(self, id)
.filter(|_| !self.is_proc_macro(id))
Expand Down Expand Up @@ -1172,7 +1172,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
}

fn get_item_variances(&self, id: DefIndex) -> Vec<ty::Variance> {
self.root.per_def.variances.get(self, id).unwrap_or(Lazy::empty()).decode(self).collect()
self.root.tables.variances.get(self, id).unwrap_or(Lazy::empty()).decode(self).collect()
}

fn get_ctor_kind(&self, node_id: DefIndex) -> CtorKind {
Expand Down Expand Up @@ -1209,7 +1209,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {

Lrc::from(
self.root
.per_def
.tables
.attributes
.get(self, item_id)
.unwrap_or(Lazy::empty())
Expand All @@ -1220,7 +1220,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {

fn get_struct_field_names(&self, id: DefIndex, sess: &Session) -> Vec<Spanned<ast::Name>> {
self.root
.per_def
.tables
.children
.get(self, id)
.unwrap_or(Lazy::empty())
Expand All @@ -1236,7 +1236,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
) -> &'tcx [DefId] {
tcx.arena.alloc_from_iter(
self.root
.per_def
.tables
.inherent_impls
.get(self, id)
.unwrap_or(Lazy::empty())
Expand Down Expand Up @@ -1416,7 +1416,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
}

fn fn_sig(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> ty::PolyFnSig<'tcx> {
self.root.per_def.fn_sig.get(self, id).unwrap().decode((self, tcx))
self.root.tables.fn_sig.get(self, id).unwrap().decode((self, tcx))
}

#[inline]
Expand Down
Loading