fix ptr_metadata_ty for DynStar type
This commit is contained in:
parent
a38a3bfc6d
commit
4999000da1
@ -2735,6 +2735,8 @@ pub fn ptr_metadata_ty(
|
||||
| ty::Error(_)
|
||||
// Extern types have metadata = ().
|
||||
| ty::Foreign(..)
|
||||
// `dyn*` has no metadata
|
||||
| ty::Dynamic(_, _, DynKind::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(..)
|
||||
@ -2743,7 +2745,7 @@ pub fn ptr_metadata_ty(
|
||||
| ty::Tuple(..) => (tcx.types.unit, false),
|
||||
|
||||
ty::Str | ty::Slice(_) => (tcx.types.usize, false),
|
||||
ty::Dynamic(..) => {
|
||||
ty::Dynamic(_, _, DynKind::Dyn) => {
|
||||
let dyn_metadata = tcx.require_lang_item(LangItem::DynMetadata, None);
|
||||
(tcx.type_of(dyn_metadata).instantiate(tcx, &[tail.into()]), false)
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user