Skip to content

If the projection is InProgress on the projection cache while normalizing, return that same type. #48756

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 1 commit into from
Closed
Changes from all commits
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
18 changes: 4 additions & 14 deletions src/librustc/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,24 +546,14 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
// to normalize `A::B`, we will want to check the
// where-clauses in scope. So we will try to unify `A::B`
// with `A::B`, which can trigger a recursive
// normalization. In that case, I think we will want this code:
//
// ```
// let ty = selcx.tcx().mk_projection(projection_ty.item_def_id,
// projection_ty.substs;
// return Some(NormalizedTy { value: v, obligations: vec![] });
// ```
// normalization.

debug!("opt_normalize_projection_type: \
found cache entry: in-progress");

// But for now, let's classify this as an overflow:
let recursion_limit = selcx.tcx().sess.recursion_limit.get();
let obligation = Obligation::with_depth(cause.clone(),
recursion_limit,
param_env,
projection_ty);
selcx.infcx().report_overflow_error(&obligation, false);
let ty = selcx.tcx().mk_projection(projection_ty.item_def_id,
projection_ty.substs);
return Some(NormalizedTy { value: ty, obligations: vec![] });
}
Err(ProjectionCacheEntry::NormalizedTy(mut ty)) => {
// If we find the value in the cache, then return it along
Expand Down