Skip to content

Commit 9f6ae88

Browse files
committed
Fix a freshly detected wrong TraitRef
1 parent 0ae3da3 commit 9f6ae88

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

compiler/rustc_trait_selection/src/traits/object_safety.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -694,16 +694,12 @@ fn receiver_is_dispatchable<'tcx>(
694694

695695
// U: Trait<Arg1, ..., ArgN>
696696
let trait_predicate = {
697-
let substs =
698-
InternalSubsts::for_item(tcx, method.trait_container(tcx).unwrap(), |param, _| {
699-
if param.index == 0 {
700-
unsized_self_ty.into()
701-
} else {
702-
tcx.mk_param_from_def(param)
703-
}
704-
});
697+
let trait_def_id = method.trait_container(tcx).unwrap();
698+
let substs = InternalSubsts::for_item(tcx, trait_def_id, |param, _| {
699+
if param.index == 0 { unsized_self_ty.into() } else { tcx.mk_param_from_def(param) }
700+
});
705701

706-
ty::Binder::dummy(tcx.mk_trait_ref(unsize_did, substs)).to_predicate(tcx)
702+
ty::Binder::dummy(tcx.mk_trait_ref(trait_def_id, substs)).to_predicate(tcx)
707703
};
708704

709705
let caller_bounds: Vec<Predicate<'tcx>> =

0 commit comments

Comments
 (0)