-
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
Add test for bad cast with deferred projection equality #108287
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
compiler-errors
added
the
WG-trait-system-refactor
The Rustc Trait System Refactor Initiative (-Znext-solver)
label
Feb 20, 2023
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 20, 2023
r? types |
This comment has been minimized.
This comment has been minimized.
compiler-errors
force-pushed
the
new-solver-bad-cast
branch
from
February 21, 2023 00:07
40ab096
to
eb1f9ba
Compare
@bors r+ rollup |
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 23, 2023
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Feb 23, 2023
…t, r=spastorino Add test for bad cast with deferred projection equality 1. Unification during coercion (`Coerce::unify`) needs to consider deferred projection obligations (at least pass over them with `predicate_may_hold` or something, to disqualify any totally wrong unifications) -- otherwise, we'll shallowly consider `<u8 as Add>::Output` and `char` as coercible during `FnCtxt::try_coerce`, which will fail later when the nested obligations are registered and processed. 2. Cast checking needs to be able to structurally normalize types so it sees `u8` instead of `<u8 as Add>::Output`. Otherwise it'll always consider the latter as part of a non-primitive cast. Currently `FnCtxt::normalize` doesn't do anything useful here, interestingly. I tried looking into both of these and it's not immediately clear where to refactor existing typeck code to fix this (at least the latter), but I'm gonna commit a test for it at least so we don't forget. This is one of the issues that's keeping us from building larger projects.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 24, 2023
Rollup of 10 pull requests Successful merges: - rust-lang#106541 (implement const iterator using `rustc_do_not_const_check`) - rust-lang#106918 (Rebuild BinaryHeap on unwind from retain) - rust-lang#106923 (Restore behavior when primary bundle is missing) - rust-lang#108169 (Make query keys `Copy`) - rust-lang#108287 (Add test for bad cast with deferred projection equality) - rust-lang#108370 (std: time: Avoid to use "was created" in elapsed() description) - rust-lang#108377 (Fix ICE in 'duplicate diagnostic item' diagnostic) - rust-lang#108388 (parser: provide better suggestions and errors on closures with braces missing) - rust-lang#108391 (Fix `is_terminal`'s handling of long paths on Windows.) - rust-lang#108401 (diagnostics: remove inconsistent English article "this" from E0107) Failed merges: 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.
WG-trait-system-refactor
The Rustc Trait System Refactor Initiative (-Znext-solver)
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.
Unification during coercion (
Coerce::unify
) needs to consider deferred projection obligations (at least pass over them withpredicate_may_hold
or something, to disqualify any totally wrong unifications) -- otherwise, we'll shallowly consider<u8 as Add>::Output
andchar
as coercible duringFnCtxt::try_coerce
, which will fail later when the nested obligations are registered and processed.Cast checking needs to be able to structurally normalize types so it sees
u8
instead of<u8 as Add>::Output
. Otherwise it'll always consider the latter as part of a non-primitive cast. CurrentlyFnCtxt::normalize
doesn't do anything useful here, interestingly.I tried looking into both of these and it's not immediately clear where to refactor existing typeck code to fix this (at least the latter), but I'm gonna commit a test for it at least so we don't forget. This is one of the issues that's keeping us from building larger projects.