Uh oh!
There was an error while loading. Please reload this page.
Don't create impl candidates when obligation contains errors - #73005
Conversation
Fixesrust-lang#72839 In PR rust-lang#72621, trait selection was modified to no longer bail out early when an error type was encountered. This allowed us treat `ty::Error` as `Sized`, causing us to avoid emitting a spurious "not sized" error after a type error had already occured. However, this means that we may now try to match an impl candidate against the error type. Since the error type will unify with almost anything, this can cause us to infinitely recurse (eventually triggering an overflow) when trying to verify certain `where` clauses. This commit causes us to skip generating any impl candidates when an error type is involved.
rust-highfive
commented
Jun 4, 2020
(rust_highfive has picked a reviewer for you, use r? to override) |
estebank
commented
Jun 5, 2020
You'll need to re |
| // emitting additional spurious errors, since we're guaranteed | ||
| // to have emitted at least one. | ||
| if stack.obligation.references_error() { | ||
| debug!("no results for error type, treating as ambiguous"); |
There was a problem hiding this comment.
Add a delay_span_bug, just in case.
There was a problem hiding this comment.
With #70551, seeing an error type guarantees that delay_span_bug has been called.
There was a problem hiding this comment.
Did you want to wait for #70551, or can I r+ this now?
Uh oh!
There was an error while loading. Please reload this page.
Aaron1011
commented
Jun 9, 2020
bors
commented
Jun 9, 2020
📌 Commit ae42c91 has been approved by |
Aaron1011
commented
Jun 9, 2020
Nominating for beta backport: while #72839 is 'only' a diagnostics issue, it's a very annoying one. When working on |
Rollup of 9 pull requests Successful merges: - rust-lang#72706 (Add windows group to triagebot) - rust-lang#72789 (resolve: Do not suggest imports from the same module in which we are resolving) - rust-lang#72890 (improper ctypes: normalize return types and transparent structs) - rust-lang#72897 (normalize adt fields during structural match checking) - rust-lang#73005 (Don't create impl candidates when obligation contains errors) - rust-lang#73023 (Remove noisy suggestion of hash_map ) - rust-lang#73070 (Add regression test for const generic ICE in rust-lang#72819) - rust-lang#73157 (Don't lose empty `where` clause when pretty-printing) - rust-lang#73184 (Reoder order in which MinGW libs are linked to fix recent breakage) Failed merges: r? @ghost
pnkfelix
commented
Jun 17, 2020
unilaterally accepting for beta-backport. |
Mark-Simulacrum
commented
Jun 26, 2020
@Aaron1011 -- on beta, it looks like src/librustc_trait_selection/traits/select/candidate_assembly.rs doesn't exist. Can you prepare a commit that backports this cleanly? (Or alternatively we can just not backport this as it's solely a diagnostics fix I guess?) |
Aaron1011
commented
Jun 26, 2020
@Mark-Simulacrum: I've created e461d2e |
Mark-Simulacrum
commented
Jun 26, 2020
Thanks, included. |
…ulacrum [beta] backports This PR backports the following: * Make novel structural match violations not a `bug` rust-lang#73446 * linker: Never pass `-no-pie` to non-gnu linkers rust-lang#73384 * Disable the `SimplifyArmIdentity` pass rust-lang#73262 * Allow inference regions when relating consts rust-lang#73225 * Fix link error with #[thread_local] introduced by rust-lang#71192rust-lang#73065 * Ensure stack when building MIR for matches rust-lang#72941 * Don't create impl candidates when obligation contains errors rust-lang#73005 r? @ghost
…ompiler-errors Don't Create `ParamCandidate` When Obligation Contains Errors Fixesrust-lang#121941 I'm not sure if I understand this correctly but this bug was caused by an error type incorrectly matching against `ParamCandidate`. This was introduced by the changes made in rust-lang#72621 (figured using cargo-bisect-rustc). This PR fixes it by skipping `ParamCandidate` generation when an error type is involved. Also, this is similar to rust-lang#73005 but addresses `ParamCandidate` instead of `ImplCandidate`.
…ompiler-errors Don't Create `ParamCandidate` When Obligation Contains Errors Fixesrust-lang#121941 I'm not sure if I understand this correctly but this bug was caused by an error type incorrectly matching against `ParamCandidate`. This was introduced by the changes made in rust-lang#72621 (figured using cargo-bisect-rustc). This PR fixes it by skipping `ParamCandidate` generation when an error type is involved. Also, this is similar to rust-lang#73005 but addresses `ParamCandidate` instead of `ImplCandidate`.
Rollup merge of rust-lang#122360 - veera-sivarajan:bugfix-121941, r=compiler-errors Don't Create `ParamCandidate` When Obligation Contains Errors Fixesrust-lang#121941 I'm not sure if I understand this correctly but this bug was caused by an error type incorrectly matching against `ParamCandidate`. This was introduced by the changes made in rust-lang#72621 (figured using cargo-bisect-rustc). This PR fixes it by skipping `ParamCandidate` generation when an error type is involved. Also, this is similar to rust-lang#73005 but addresses `ParamCandidate` instead of `ImplCandidate`.
Fixes#72839
In PR #72621, trait selection was modified to no longer bail out early
when an error type was encountered. This allowed us treat
ty::ErrorasSized, causing us to avoid emitting a spurious "not sized" error aftera type error had already occured.
However, this means that we may now try to match an impl candidate
against the error type. Since the error type will unify with almost
anything, this can cause us to infinitely recurse (eventually triggering
an overflow) when trying to verify certain
whereclauses.This commit causes us to skip generating any impl candidates when an
error type is involved.