Skip to content

Rollup of 7 pull requests #104932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 16 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Define all clauses as dummy_with_span as the usages are all equivalent
  • Loading branch information
spastorino committed Nov 25, 2022
commit 3c9b30e65876090b2e1e4944dac24d7e9e182d1f
12 changes: 5 additions & 7 deletions compiler/rustc_traits/src/type_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ pub fn type_op_ascribe_user_type_with_span<'tcx>(

let UserSubsts { user_self_ty, substs } = user_substs;
let tcx = ocx.infcx.tcx;
let cause = ObligationCause::dummy_with_span(span);

let ty = tcx.bound_type_of(def_id).subst(tcx, substs);
let ty = ocx.normalize(ObligationCause::misc(span, hir::CRATE_HIR_ID), param_env, ty);
let ty = ocx.normalize(cause.clone(), param_env, ty);
debug!("relate_type_and_user_type: ty of def-id is {:?}", ty);

ocx.eq(&ObligationCause::dummy_with_span(span), param_env, mir_ty, ty)?;
ocx.eq(&cause, param_env, mir_ty, ty)?;

// Prove the predicates coming along with `def_id`.
//
Expand All @@ -73,8 +74,6 @@ pub fn type_op_ascribe_user_type_with_span<'tcx>(
// outlives" error messages.
let instantiated_predicates = tcx.predicates_of(def_id).instantiate(tcx, substs);

let cause = ObligationCause::dummy_with_span(span);

debug!(?instantiated_predicates);
for (instantiated_predicate, predicate_span) in
zip(instantiated_predicates.predicates, instantiated_predicates.spans)
Expand All @@ -93,10 +92,9 @@ pub fn type_op_ascribe_user_type_with_span<'tcx>(

if let Some(UserSelfTy { impl_def_id, self_ty }) = user_self_ty {
let impl_self_ty = tcx.bound_type_of(impl_def_id).subst(tcx, substs);
let impl_self_ty =
ocx.normalize(ObligationCause::misc(span, hir::CRATE_HIR_ID), param_env, impl_self_ty);
let impl_self_ty = ocx.normalize(cause.clone(), param_env, impl_self_ty);

ocx.eq(&ObligationCause::dummy_with_span(span), param_env, self_ty, impl_self_ty)?;
ocx.eq(&cause, param_env, self_ty, impl_self_ty)?;

let predicate: Predicate<'tcx> =
ty::Binder::dummy(ty::PredicateKind::WellFormed(impl_self_ty.into())).to_predicate(tcx);
Expand Down