Skip to content

Commit 4999000

Browse files
committed
fix ptr_metadata_ty for DynStar type
1 parent a38a3bf commit 4999000

File tree

1 file changed

+3
-1
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+3
-1
lines changed

compiler/rustc_middle/src/ty/sty.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2735,6 +2735,8 @@ impl<'tcx> Ty<'tcx> {
27352735
| ty::Error(_)
27362736
// Extern types have metadata = ().
27372737
| ty::Foreign(..)
2738+
// `dyn*` has no metadata
2739+
| ty::Dynamic(_, _, DynKind::DynStar)
27382740
// If returned by `struct_tail_without_normalization` this is a unit struct
27392741
// without any fields, or not a struct, and therefore is Sized.
27402742
| ty::Adt(..)
@@ -2743,7 +2745,7 @@ impl<'tcx> Ty<'tcx> {
27432745
| ty::Tuple(..) => (tcx.types.unit, false),
27442746

27452747
ty::Str | ty::Slice(_) => (tcx.types.usize, false),
2746-
ty::Dynamic(..) => {
2748+
ty::Dynamic(_, _, DynKind::Dyn) => {
27472749
let dyn_metadata = tcx.require_lang_item(LangItem::DynMetadata, None);
27482750
(tcx.type_of(dyn_metadata).instantiate(tcx, &[tail.into()]), false)
27492751
},

0 commit comments

Comments
 (0)