Skip to content

Commit 06f95e2

Browse files
committed
Fix dop_in_place<dyn* Trait> and do some cleanup
1 parent 34b8fe4 commit 06f95e2

File tree

7 files changed

+10
-13
lines changed

7 files changed

+10
-13
lines changed

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
727727
return Err(TypeError::Mismatch);
728728
}
729729

730-
if let ty::Dynamic(a_data, _) | ty::DynStar(a_data, _) = a.kind()
731-
&& let ty::Dynamic(b_data, _) | ty::DynStar(b_data, _) = b.kind()
732-
&& a_data.principal_def_id() == b_data.principal_def_id()
730+
if let (ty::Dynamic(a_data, _), ty::Dynamic(b_data, _)) | (ty::DynStar(a_data, _), ty::DynStar(b_data, _)) = (a.kind(), b.kind())
731+
&& a_data.principal_def_id() == b_data.principal_def_id()
733732
{
734733
return self.unify_and(a, b, |_| vec![]);
735734
}

compiler/rustc_middle/src/ty/relate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>(
449449
let region_bound = relation.with_cause(Cause::ExistentialRegionBound, |relation| {
450450
relation.relate(a_region, b_region)
451451
})?;
452-
Ok(tcx.mk_dynamic(relation.relate(a_obj, b_obj)?, region_bound))
452+
Ok(tcx.mk_dyn_star(relation.relate(a_obj, b_obj)?, region_bound))
453453
}
454454

455455
(&ty::Generator(a_id, a_substs, movability), &ty::Generator(b_id, b_substs, _))

compiler/rustc_mir_dataflow/src/elaborate_drops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ where
888888
self.open_drop_for_adt(*def, substs)
889889
}
890890
}
891-
ty::Dynamic(..) => self.complete_drop(self.succ, self.unwind),
891+
ty::Dynamic(..) | ty::DynStar(..) => self.complete_drop(self.succ, self.unwind),
892892
ty::Array(ety, size) => {
893893
let size = size.try_eval_usize(self.tcx(), self.elaborator.param_env());
894894
self.open_drop_for_array(*ety, size)

compiler/rustc_monomorphize/src/collector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ fn find_vtable_types_for_unsizing<'tcx>(
10721072
let tail = tcx.struct_tail_erasing_lifetimes(ty, param_env);
10731073
match tail.kind() {
10741074
ty::Foreign(..) => false,
1075-
ty::Str | ty::Slice(..) | ty::Dynamic(..) => true,
1075+
ty::Str | ty::Slice(..) | ty::Dynamic(..) | ty::DynStar(..) => true,
10761076
_ => bug!("unexpected unsized tail: {:?}", tail),
10771077
}
10781078
};
@@ -1147,7 +1147,7 @@ fn create_mono_items_for_vtable_methods<'tcx>(
11471147
) {
11481148
assert!(!trait_ty.has_escaping_bound_vars() && !impl_ty.has_escaping_bound_vars());
11491149

1150-
if let ty::Dynamic(ref trait_ty, ..) = trait_ty.kind() {
1150+
if let ty::Dynamic(ref trait_ty, ..) | ty::DynStar(ref trait_ty, ..) = trait_ty.kind() {
11511151
if let Some(principal) = trait_ty.principal() {
11521152
let poly_trait_ref = principal.with_self_ty(tcx, impl_ty);
11531153
assert!(!poly_trait_ref.has_escaping_bound_vars());

compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ fn encode_ty<'tcx>(
634634
typeid.push_str(&s);
635635
}
636636
ty::DynStar(predicates, region) => {
637-
// u3dynI<element-type1[..element-typeN]>E, where <element-type> is <predicate>, as
637+
// u3dynstarI<element-type1[..element-typeN]>E, where <element-type> is <predicate>, as
638638
// vendor extended type.
639639
let mut s = String::from("u7dynstarI");
640640
s.push_str(&encode_predicates(tcx, predicates, dict, options));

compiler/rustc_ty_utils/src/instance.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ fn inner_resolve_instance<'tcx>(
7171
| ty::Tuple(..)
7272
| ty::Adt(..)
7373
| ty::Dynamic(..)
74+
| ty::DynStar(..)
7475
| ty::Array(..)
7576
| ty::Slice(..) => {}
7677
// Drop shims can only be built from ADTs.

compiler/rustc_type_ir/src/sty.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,7 @@ impl<I: Interner> Ord for TyKind<I> {
400400
}
401401
(FnDef(a_d, a_s), FnDef(b_d, b_s)) => a_d.cmp(b_d).then_with(|| a_s.cmp(b_s)),
402402
(FnPtr(a_s), FnPtr(b_s)) => a_s.cmp(b_s),
403-
(Dynamic(a_p, a_r), Dynamic(b_p, b_r)) => {
404-
a_p.cmp(b_p).then_with(|| a_r.cmp(b_r))
405-
}
406-
(DynStar(a_p, a_r), DynStar(b_p, b_r)) => {
403+
(Dynamic(a_p, a_r), Dynamic(b_p, b_r)) | (DynStar(a_p, a_r), DynStar(b_p, b_r))=> {
407404
a_p.cmp(b_p).then_with(|| a_r.cmp(b_r))
408405
}
409406
(Closure(a_p, a_s), Closure(b_p, b_s)) => a_p.cmp(b_p).then_with(|| a_s.cmp(b_s)),
@@ -713,7 +710,7 @@ where
713710
"{}",
714711
format!(
715712
"invalid enum variant tag while decoding `{}`, expected 0..{}",
716-
"TyKind", 27,
713+
"TyKind", 28,
717714
)
718715
),
719716
}

0 commit comments

Comments
 (0)