diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-03-05 07:28:41 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-03-11 13:31:24 +1100 |
| commit | ca5525d5643f4eb7de5c5e69d0691fc8f1cacfca (patch) | |
| tree | cbe3682d3e3ff0d1a48b76f972f0322ea28c9542 /compiler/rustc_middle/src/ty/print | |
| parent | 5f4e0677190b82e61dc507e3e72caf89da8e5e28 (diff) | |
| download | rust-ca5525d5643f4eb7de5c5e69d0691fc8f1cacfca.tar.gz rust-ca5525d5643f4eb7de5c5e69d0691fc8f1cacfca.zip | |
Improve `AdtDef` interning.
This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`.
Diffstat (limited to 'compiler/rustc_middle/src/ty/print')
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/print/mod.rs b/compiler/rustc_middle/src/ty/print/mod.rs index 8d7f6d84c7c..c74b3e9d0fc 100644 --- a/compiler/rustc_middle/src/ty/print/mod.rs +++ b/compiler/rustc_middle/src/ty/print/mod.rs @@ -274,7 +274,7 @@ fn characteristic_def_id_of_type_cached<'a>( visited: &mut SsoHashSet<Ty<'a>>, ) -> Option<DefId> { match *ty.kind() { - ty::Adt(adt_def, _) => Some(adt_def.did), + ty::Adt(adt_def, _) => Some(adt_def.did()), ty::Dynamic(data, ..) => data.principal_def_id(), diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 0927dc2d266..00cb9907d95 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -618,7 +618,7 @@ pub trait PrettyPrinter<'tcx>: ty::BoundTyKind::Param(p) => p!(write("{}", p)), }, ty::Adt(def, substs) => { - p!(print_def_path(def.did, substs)); + p!(print_def_path(def.did(), substs)); } ty::Dynamic(data, r) => { let print_r = self.should_print_region(r); @@ -1487,7 +1487,7 @@ pub trait PrettyPrinter<'tcx>: } p!(")"); } - ty::Adt(def, _) if def.variants.is_empty() => { + ty::Adt(def, _) if def.variants().is_empty() => { self = self.typed_value( |mut this| { write!(this, "unreachable()")?; @@ -1500,7 +1500,7 @@ pub trait PrettyPrinter<'tcx>: ty::Adt(def, substs) => { let variant_idx = contents.variant.expect("destructed const of adt without variant idx"); - let variant_def = &def.variants[variant_idx]; + let variant_def = &def.variant(variant_idx); p!(print_value_path(variant_def.def_id, substs)); match variant_def.ctor_kind { |
