diff options
Diffstat (limited to 'compiler/rustc_middle/src/ty/assoc.rs')
-rw-r--r-- | compiler/rustc_middle/src/ty/assoc.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_middle/src/ty/assoc.rs b/compiler/rustc_middle/src/ty/assoc.rs index bb7fba3ee..f1a9e50a4 100644 --- a/compiler/rustc_middle/src/ty/assoc.rs +++ b/compiler/rustc_middle/src/ty/assoc.rs @@ -79,11 +79,11 @@ impl AssocItem { // late-bound regions, and we don't want method signatures to show up // `as for<'r> fn(&'r MyType)`. Pretty-printing handles late-bound // regions just fine, showing `fn(&MyType)`. - tcx.fn_sig(self.def_id).skip_binder().to_string() + tcx.fn_sig(self.def_id).subst_identity().skip_binder().to_string() } ty::AssocKind::Type => format!("type {};", self.name), ty::AssocKind::Const => { - format!("const {}: {:?};", self.name, tcx.type_of(self.def_id)) + format!("const {}: {:?};", self.name, tcx.type_of(self.def_id).subst_identity()) } } } @@ -129,13 +129,13 @@ impl std::fmt::Display for AssocKind { /// it is relatively expensive. Instead, items are indexed by `Symbol` and hygienic comparison is /// done only on items with the same name. #[derive(Debug, Clone, PartialEq, HashStable)] -pub struct AssocItems<'tcx> { - pub(super) items: SortedIndexMultiMap<u32, Symbol, &'tcx ty::AssocItem>, +pub struct AssocItems { + items: SortedIndexMultiMap<u32, Symbol, ty::AssocItem>, } -impl<'tcx> AssocItems<'tcx> { +impl AssocItems { /// Constructs an `AssociatedItems` map from a series of `ty::AssocItem`s in definition order. - pub fn new(items_in_def_order: impl IntoIterator<Item = &'tcx ty::AssocItem>) -> Self { + pub fn new(items_in_def_order: impl IntoIterator<Item = ty::AssocItem>) -> Self { let items = items_in_def_order.into_iter().map(|item| (item.name, item)).collect(); AssocItems { items } } @@ -145,7 +145,7 @@ impl<'tcx> AssocItems<'tcx> { /// New code should avoid relying on definition order. If you need a particular associated item /// for a known trait, make that trait a lang item instead of indexing this array. pub fn in_definition_order(&self) -> impl '_ + Iterator<Item = &ty::AssocItem> { - self.items.iter().map(|(_, v)| *v) + self.items.iter().map(|(_, v)| v) } pub fn len(&self) -> usize { @@ -157,7 +157,7 @@ impl<'tcx> AssocItems<'tcx> { &self, name: Symbol, ) -> impl '_ + Iterator<Item = &ty::AssocItem> { - self.items.get_by_key(name).copied() + self.items.get_by_key(name) } /// Returns the associated item with the given name and `AssocKind`, if one exists. |