Skip to content

Commit d9600ee

Browse files
committed
Fix dyn* impl recognition
1 parent 592fb72 commit d9600ee

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

compiler/rustc_trait_selection/src/solve/trait_goals.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,10 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
385385

386386
let a_ty = goal.predicate.self_ty();
387387
let b_ty = goal.predicate.trait_ref.substs.type_at(1);
388-
let ty::Dynamic(a_data, a_region) = *a_ty.kind() else {
388+
let (ty::Dynamic(a_data, a_region) | ty::DynStar(a_data, a_region)) = *a_ty.kind() else {
389389
return vec![];
390390
};
391-
let ty::Dynamic(b_data, b_region) = *b_ty.kind() else {
391+
let (ty::Dynamic(b_data, b_region) | ty::DynStar(b_data, b_region)) = *b_ty.kind() else {
392392
return vec![];
393393
};
394394

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2864,7 +2864,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
28642864
if let Some(span) = sp {
28652865
if let ty::PredicateKind::Clause(clause) = predicate.kind().skip_binder()
28662866
&& let ty::Clause::Trait(trait_pred) = clause
2867-
&& let ty::Dynamic(..) = trait_pred.self_ty().kind()
2867+
&& let ty::Dynamic(..) | ty::DynStar(..) = trait_pred.self_ty().kind()
28682868
{
28692869
let span = if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span)
28702870
&& snippet.starts_with("dyn ")

compiler/rustc_trait_selection/src/traits/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@ fn assemble_candidates_from_object_ty<'cx, 'tcx>(
14161416
let self_ty = obligation.predicate.self_ty();
14171417
let object_ty = selcx.infcx.shallow_resolve(self_ty);
14181418
let data = match object_ty.kind() {
1419-
ty::Dynamic(data, ..) => data,
1419+
ty::Dynamic(data, ..) | ty::DynStar(data, ..) => data,
14201420
ty::Infer(ty::TyVar(_)) => {
14211421
// If the self-type is an inference variable, then it MAY wind up
14221422
// being an object type, so induce an ambiguity.

compiler/rustc_trait_selection/src/traits/vtable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ pub(crate) fn vtable_trait_upcasting_coercion_new_vptr_slot<'tcx>(
353353
),
354354
) -> Option<usize> {
355355
let (source, target) = key;
356-
assert!(matches!(&source.kind(), &ty::Dynamic(..)) && !source.needs_infer());
357-
assert!(matches!(&target.kind(), &ty::Dynamic(..)) && !target.needs_infer());
356+
assert!(matches!(&source.kind(), &ty::Dynamic(..) | &ty::DynStar(..)) && !source.needs_infer());
357+
assert!(matches!(&target.kind(), &ty::Dynamic(..) | &ty::DynStar(..)) && !target.needs_infer());
358358

359359
// this has been typecked-before, so diagnostics is not really needed.
360360
let unsize_trait_did = tcx.require_lang_item(LangItem::Unsize, None);

0 commit comments

Comments
 (0)