X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_trait_selection%2Fsrc%2Ftraits%2Fobject_safety.rs;h=8b1ced78f4e8a06fe4a69ed1d0a4f49c8e043935;hb=78cf8cc02e26b20e8d76a7a2557defd6072dda1c;hp=3e85ea69635e645c953b4e3eec401e1f3390e318;hpb=49b99078b0ea08e37ed006e10f3e0705c63c4560;p=rust.git diff --git a/compiler/rustc_trait_selection/src/traits/object_safety.rs b/compiler/rustc_trait_selection/src/traits/object_safety.rs index 3e85ea69635..8b1ced78f4e 100644 --- a/compiler/rustc_trait_selection/src/traits/object_safety.rs +++ b/compiler/rustc_trait_selection/src/traits/object_safety.rs @@ -694,18 +694,12 @@ fn receiver_is_dispatchable<'tcx>( // U: Trait let trait_predicate = { - let substs = - InternalSubsts::for_item(tcx, method.trait_container(tcx).unwrap(), |param, _| { - if param.index == 0 { - unsized_self_ty.into() - } else { - tcx.mk_param_from_def(param) - } - }); + let trait_def_id = method.trait_container(tcx).unwrap(); + let substs = InternalSubsts::for_item(tcx, trait_def_id, |param, _| { + if param.index == 0 { unsized_self_ty.into() } else { tcx.mk_param_from_def(param) } + }); - ty::Binder::dummy(ty::TraitRef { def_id: unsize_did, substs }) - .without_const() - .to_predicate(tcx) + ty::Binder::dummy(tcx.mk_trait_ref(trait_def_id, substs)).to_predicate(tcx) }; let caller_bounds: Vec> =