1
Fork 0

Rollup merge of #118915 - compiler-errors:alias-nits, r=lcnr

Add some comments, add `can_define_opaque_ty` check to `try_normalize_ty_recur`

Follow-up from #117278, since I was recently re-reviewing this code.
This commit is contained in:
Matthias Krüger 2024-01-11 03:02:39 +01:00 committed by GitHub
commit 859874f3eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 45 deletions

View file

@ -1225,7 +1225,7 @@ impl<'tcx> AliasTy<'tcx> {
/// Whether this alias type is an opaque.
pub fn is_opaque(self, tcx: TyCtxt<'tcx>) -> bool {
matches!(self.opt_kind(tcx), Some(ty::AliasKind::Opaque))
matches!(self.opt_kind(tcx), Some(ty::Opaque))
}
/// FIXME: rename `AliasTy` to `AliasTerm` and always handle
@ -2745,7 +2745,7 @@ impl<'tcx> Ty<'tcx> {
// Extern types have metadata = ().
| ty::Foreign(..)
// `dyn*` has no metadata
| ty::Dynamic(_, _, DynKind::DynStar)
| ty::Dynamic(_, _, ty::DynStar)
// If returned by `struct_tail_without_normalization` this is a unit struct
// without any fields, or not a struct, and therefore is Sized.
| ty::Adt(..)
@ -2754,7 +2754,7 @@ impl<'tcx> Ty<'tcx> {
| ty::Tuple(..) => (tcx.types.unit, false),
ty::Str | ty::Slice(_) => (tcx.types.usize, false),
ty::Dynamic(_, _, DynKind::Dyn) => {
ty::Dynamic(_, _, ty::Dyn) => {
let dyn_metadata = tcx.require_lang_item(LangItem::DynMetadata, None);
(tcx.type_of(dyn_metadata).instantiate(tcx, &[tail.into()]), false)
},