Skip to content
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

Don't immediately error for cycles during normalization #75494

Merged

Conversation

matthewjasper
Copy link
Contributor

#73452 meant some normalization cycles could be detected earlier, breaking some code.
This PR makes defers errors for normalization cycles to fulfillment, fixing said code.

Fixes #74868

r? @nikomatsakis

@matthewjasper matthewjasper added beta-nominated Nominated for backporting to the compiler in the beta channel. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 13, 2020
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 13, 2020
@spastorino
Copy link
Member

@bors p=1

Once approved we want this to be in ASAP.

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I understand the strategy now, it's not once I had ever considered. Interesting. Also, a good example to try throwing at chalk, I've been wanting to create realistic examples of cycles (or near cycles) that arise during projection.

selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &PolyProjectionObligation<'tcx>,
) -> Result<Option<Vec<PredicateObligation<'tcx>>>, MismatchedProjectionTypes<'tcx>> {
) -> Result<
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this is a complex return type! I thnk the doc comment could be extended to explain what the various return values mean.

// Let the caller handle the recursion
Ok(Err(project::InProgress)) => ProcessResult::Changed(mk_pending(vec![
project_obligation.with(project_obligation.predicate.to_predicate(tcx)),
])),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I see, so we basically just push the project predicate back up to the caller... interesting...

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Aug 20, 2020

📌 Commit 8e81710685349464553b30c0a7e89c50eb4d3b24 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 20, 2020
@nikomatsakis
Copy link
Contributor

Er, @bors r-

r=me with the nit addressed

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 20, 2020
@nikomatsakis
Copy link
Contributor

Or just r+ if we think it's important enough

@spastorino
Copy link
Member

heavily discussed in T-compiler meeting.

This is a subtle change to subtle code. We've also agreed on backporting it and fire a crater run as soon as possible, which probably won't be on time but would give as an advantage to act quickly if there are bad consequences.

@rustbot modify labels: beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Aug 20, 2020
@matthewjasper matthewjasper force-pushed the defer-recursive-projection-error branch from 8e81710 to 67fb583 Compare August 20, 2020 18:30
@matthewjasper
Copy link
Contributor Author

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Aug 20, 2020

📌 Commit 67fb583 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 20, 2020
@bors
Copy link
Contributor

bors commented Aug 20, 2020

⌛ Testing commit 67fb583 with merge e15510c...

@bors
Copy link
Contributor

bors commented Aug 20, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: nikomatsakis
Pushing e15510c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 20, 2020
@bors bors merged commit e15510c into rust-lang:master Aug 20, 2020
@matthewjasper matthewjasper deleted the defer-recursive-projection-error branch August 21, 2020 07:04
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 21, 2020
This was referenced Aug 21, 2020
@rust-log-analyzer
Copy link
Collaborator

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
##[section]Starting: Request a runner to run this job
Found online and idle self-hosted runner in current repository that matches the required labels: 'self-hosted , ARM64 , linux'

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected trait resolution overflow error
9 participants