-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
fix ICE for deref coercions with type errors #120972
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Feb 12, 2024
compiler-errors
approved these changes
Feb 12, 2024
@bors r+ |
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
Feb 12, 2024
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Feb 12, 2024
…=compiler-errors fix ICE for deref coercions with type errors Follow-up to rust-lang#120895, where I made types with errors go through the full coercion code, which is necessary if we want to build MIR for bodies with errors (rust-lang#120550). The code for coercing `&T` to `&U` currently assumes that autoderef for `&T` will succeed for at least two steps (`&T` and `T`): https://github.com/rust-lang/rust/blob/b17491c8f6d555386104dfd82004c01bfef09c95/compiler/rustc_hir_typeck/src/coercion.rs#L339-L464 But for types with errors, we previously only returned the no-op autoderef step (`&{type error}` -> `&{type error}`) and then stopped early. This PR changes autoderef for types with errors to still go through the built-in derefs (e.g. `&&{type error}` -> `&{type error}` -> `{type error}`) and only stop early when it would have to go looking for `Deref` trait impls. fixes rust-lang#120945 r? `@compiler-errors` or compiler
This was referenced Feb 12, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 12, 2024
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#120765 (Reorder diagnostics API) - rust-lang#120833 (More internal emit diagnostics cleanups) - rust-lang#120899 (Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`) - rust-lang#120917 (Remove a bunch of dead parameters in functions) - rust-lang#120928 (Add test for recently fixed issue) - rust-lang#120933 (check_consts: fix duplicate errors, make importance consistent) - rust-lang#120936 (improve `btree_cursors` functions documentation) - rust-lang#120944 (Check that the ABI of the instance we are inlining is correct) - rust-lang#120956 (Clean inlined type alias with correct param-env) - rust-lang#120962 (Add myself to library/std review) - rust-lang#120972 (fix ICE for deref coercions with type errors) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 12, 2024
Rollup merge of rust-lang#120972 - lukas-code:autoderef-type-error, r=compiler-errors fix ICE for deref coercions with type errors Follow-up to rust-lang#120895, where I made types with errors go through the full coercion code, which is necessary if we want to build MIR for bodies with errors (rust-lang#120550). The code for coercing `&T` to `&U` currently assumes that autoderef for `&T` will succeed for at least two steps (`&T` and `T`): https://github.com/rust-lang/rust/blob/b17491c8f6d555386104dfd82004c01bfef09c95/compiler/rustc_hir_typeck/src/coercion.rs#L339-L464 But for types with errors, we previously only returned the no-op autoderef step (`&{type error}` -> `&{type error}`) and then stopped early. This PR changes autoderef for types with errors to still go through the built-in derefs (e.g. `&&{type error}` -> `&{type error}` -> `{type error}`) and only stop early when it would have to go looking for `Deref` trait impls. fixes rust-lang#120945 r? ``@compiler-errors`` or compiler
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Feb 26, 2024
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#120765 (Reorder diagnostics API) - rust-lang#120833 (More internal emit diagnostics cleanups) - rust-lang#120899 (Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`) - rust-lang#120917 (Remove a bunch of dead parameters in functions) - rust-lang#120928 (Add test for recently fixed issue) - rust-lang#120933 (check_consts: fix duplicate errors, make importance consistent) - rust-lang#120936 (improve `btree_cursors` functions documentation) - rust-lang#120944 (Check that the ABI of the instance we are inlining is correct) - rust-lang#120956 (Clean inlined type alias with correct param-env) - rust-lang#120962 (Add myself to library/std review) - rust-lang#120972 (fix ICE for deref coercions with type errors) r? `@ghost` `@rustbot` modify labels: rollup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-up to #120895, where I made types with errors go through the full coercion code, which is necessary if we want to build MIR for bodies with errors (#120550).
The code for coercing
&T
to&U
currently assumes that autoderef for&T
will succeed for at least two steps (&T
andT
):rust/compiler/rustc_hir_typeck/src/coercion.rs
Lines 339 to 464 in b17491c
But for types with errors, we previously only returned the no-op autoderef step (
&{type error}
->&{type error}
) and then stopped early. This PR changes autoderef for types with errors to still go through the built-in derefs (e.g.&&{type error}
->&{type error}
->{type error}
) and only stop early when it would have to go looking forDeref
trait impls.fixes #120945
r? @compiler-errors or compiler