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

Make hitting the recursion limit in projection non-fatal #81055

Merged
merged 1 commit into from
Jan 28, 2021

Conversation

matthewjasper
Copy link
Contributor

@matthewjasper matthewjasper commented Jan 15, 2021

This change was originally made in #80246 to avoid future (effectively) infinite loop bugs in projections,
but wundergraph relies on rustc recovering here.

cc #80953

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. stable-nominated Nominated for backporting to the compiler in the stable channel. labels Jan 15, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 15, 2021
@jyn514
Copy link
Member

jyn514 commented Jan 15, 2021

I wonder if this would help with #79506.

@jyn514
Copy link
Member

jyn514 commented Jan 15, 2021

See also #79517.

@jyn514
Copy link
Member

jyn514 commented Jan 15, 2021

It does not fix #79506, because that gives an error in check_recursion_limit instead, which wasn't modified here:

match self.query_mode {
TraitQueryMode::Standard => {
self.infcx().report_overflow_error(error_obligation, true);
}
TraitQueryMode::Canonical => {
return Err(OverflowError);
}
}

@matthewjasper should that match be changed too?

@matthewjasper
Copy link
Contributor Author

This change already isn't really correct, it's just the safest fix for a backport.

For rustdoc it would make sense to move reporting recursion limit errors outside of the trait system, but that's not what this change does (this change incorrectly allows the trait system to recover from recursion limit errors).

@jyn514
Copy link
Member

jyn514 commented Jan 16, 2021

For rustdoc it would make sense to move reporting recursion limit errors outside of the trait system, but that's not what this change does

Got it, thanks. Do you have suggestions for moving recursion limit errors out of the trait system? I'd be interested in working on it.

@matthewjasper
Copy link
Contributor Author

It's basically find all of the places that create a OverflowError or SelectionError::Overflow and make sure that they are always early returned until outside of rustc_trait_selection::traits::{select, project}, at which point they should be emitted. Overflow errors should never be converted to any other kind of error (such as EvaluatedToRecur or EvaluatedToError)

@apiraino apiraino added beta-accepted Accepted for backporting to the compiler in the beta channel. and removed beta-nominated Nominated for backporting to the compiler in the beta channel. labels Jan 21, 2021
@apiraino
Copy link
Contributor

beta backport approved, stable backport on hold, will be discussed next week (Zulip discussion)

@Mark-Simulacrum
Copy link
Member

beta-nom label should not have been removed, see https://forge.rust-lang.org/release/beta-backporting.html -- can we add this to wg-prioritization docs perhaps? I think we're not highlighting those docs enough or they are confusing perhaps?

@Mark-Simulacrum Mark-Simulacrum added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jan 25, 2021
@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 28, 2021

📌 Commit 5db5d8f 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 Jan 28, 2021
@nikomatsakis
Copy link
Contributor

@bors p=1

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jan 28, 2021
…=nikomatsakis

Make hitting the recursion limit in projection non-fatal

This change was originally made in rust-lang#80246 to avoid future (effectively) infinite loop bugs in projections,
but wundergraph relies on rustc recovering here.

cc rust-lang#80953

r? `@nikomatsakis`
@apiraino
Copy link
Contributor

discussed in T-compiler meeting, declined to backport to stable

@rustbot modify labels: -stable-nominated

@rustbot rustbot removed the stable-nominated Nominated for backporting to the compiler in the stable channel. label Jan 28, 2021
@bors
Copy link
Contributor

bors commented Jan 28, 2021

⌛ Testing commit 5db5d8f with merge c0b64d9...

@bors
Copy link
Contributor

bors commented Jan 28, 2021

☀️ Test successful - checks-actions
Approved by: nikomatsakis
Pushing c0b64d9 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 28, 2021
@bors bors merged commit c0b64d9 into rust-lang:master Jan 28, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 28, 2021
@matthewjasper matthewjasper deleted the non-fatal-overflow branch January 28, 2021 22:51
ehuss pushed a commit to ehuss/rust that referenced this pull request Feb 5, 2021
…ikomatsakis

Make hitting the recursion limit in projection non-fatal

This change was originally made in rust-lang#80246 to avoid future (effectively) infinite loop bugs in projections,
but wundergraph relies on rustc recovering here.

cc rust-lang#80953

r? `@nikomatsakis`
@ehuss ehuss mentioned this pull request Feb 5, 2021
@ehuss ehuss removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Feb 5, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 6, 2021
[beta] backports

This backports:

* CI: only copy python.exe to python3.exe if the latter does not exist rust-lang#81762
* Make hitting the recursion limit in projection non-fatal rust-lang#81055
* Remove incorrect `delay_span_bug` rust-lang#81532
* introduce future-compatibility warning for forbidden lint groups rust-lang#81556
* Update cargo rust-lang#81755
* rustdoc: Fix visibility of trait and impl items rust-lang#81288
* Work around missing -dev packages in solaris docker image. rust-lang#81229
* Update LayoutError/LayoutErr stability attributes rust-lang#81767
* Revert 78373 ("dont leak return value after panic in drop") rust-lang#81257
* Rename `panic_fmt` lint to `non_fmt_panic` rust-lang#81729
@Aaron1011
Copy link
Member

this change incorrectly allows the trait system to recover from recursion limit errors

@matthewjasper Is there an open issue for applying the correct fix?

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.

10 participants