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`.
This commit is contained in:
Nicholas Nethercote 2022-03-05 07:28:41 +11:00
parent 5f4e067719
commit ca5525d564
169 changed files with 702 additions and 687 deletions

View file

@ -12,7 +12,7 @@ use std::ops::ControlFlow;
#[derive(Debug)]
pub enum NonStructuralMatchTy<'tcx> {
Adt(&'tcx AdtDef),
Adt(AdtDef<'tcx>),
Param,
Dynamic,
Foreign,
@ -208,14 +208,14 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for Search<'a, 'tcx> {
}
};
if !self.seen.insert(adt_def.did) {
if !self.seen.insert(adt_def.did()) {
debug!("Search already seen adt_def: {:?}", adt_def);
return ControlFlow::CONTINUE;
}
if !self.type_marked_structural(ty) {
debug!("Search found ty: {:?}", ty);
return ControlFlow::Break(NonStructuralMatchTy::Adt(&adt_def));
return ControlFlow::Break(NonStructuralMatchTy::Adt(adt_def));
}
// structural-match does not care about the