-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Process alias-relate obligations in CoerceUnsized loop #121702
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 27, 2024
r? lcnr |
lcnr
added
the
WG-trait-system-refactor
The Rustc Trait System Refactor Initiative (-Znext-solver)
label
Feb 27, 2024
@bors r+ rollup (new solver) |
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 27, 2024
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Feb 28, 2024
…e, r=lcnr Process alias-relate obligations in CoerceUnsized loop After rust-lang#119106, we now emit `AliasRelate` goals when relating `?0` and `Alias<T, ..>` in the new solver. In the ad-hoc `CoerceUnsized` selection loop, we now may have `AliasRelate` goals which must be processed to constrain type variables which are mentioned in other goals. --- For example, in the included test, we try to coerce `&<ManuallyDrop<T> as Deref>::Target` to `&dyn Foo`. This requires proving: * 1 `&<ManuallyDrop<T> as Deref>::Target: CoerceUnsized<&dyn Foo>` * 2 `<ManuallyDrop<T> as Deref>::Target alias-relate ?0` * 3 `?0: Unsize<dyn Foo>` * 4 `?0: Foo` * 5 `?0: Sized` If we don't process goal (2.) before processing goal (3.), then we hit ambiguity since `?0` is never constrained, and therefore we bail out, refusing to coerce the types. After processing (2.), we know `?0 := T`, and the rest of the goals can be processed normally.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 28, 2024
…llaumeGomez Rollup of 13 pull requests Successful merges: - rust-lang#120051 (Add `display` method to `OsStr`) - rust-lang#121226 (Fix issues in suggesting importing extern crate paths) - rust-lang#121423 (Remove the `UntranslatableDiagnosticTrivial` lint.) - rust-lang#121527 (unix_sigpipe: Simple fixes and improvements in tests) - rust-lang#121572 (Add test case for primitive links in alias js) - rust-lang#121661 (Changing some attributes to only_local.) - rust-lang#121680 (Fix link generation for foreign macro in jump to definition feature) - rust-lang#121686 (Adjust printing for RPITITs) - rust-lang#121689 ([rustdoc] Prevent inclusion of whitespace character after macro_rules ident) - rust-lang#121691 (handle unavailable creation time as `io::ErrorKind::Unsupported`) - rust-lang#121695 (Split rustc_type_ir to avoid rustc_ast from depending on it) - rust-lang#121698 (CFI: Fix typo in test file names) - rust-lang#121702 (Process alias-relate obligations in CoerceUnsized loop) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 28, 2024
…llaumeGomez Rollup of 12 pull requests Successful merges: - rust-lang#120051 (Add `display` method to `OsStr`) - rust-lang#121226 (Fix issues in suggesting importing extern crate paths) - rust-lang#121423 (Remove the `UntranslatableDiagnosticTrivial` lint.) - rust-lang#121527 (unix_sigpipe: Simple fixes and improvements in tests) - rust-lang#121572 (Add test case for primitive links in alias js) - rust-lang#121661 (Changing some attributes to only_local.) - rust-lang#121680 (Fix link generation for foreign macro in jump to definition feature) - rust-lang#121686 (Adjust printing for RPITITs) - rust-lang#121691 (handle unavailable creation time as `io::ErrorKind::Unsupported`) - rust-lang#121695 (Split rustc_type_ir to avoid rustc_ast from depending on it) - rust-lang#121698 (CFI: Fix typo in test file names) - rust-lang#121702 (Process alias-relate obligations in CoerceUnsized loop) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 28, 2024
Rollup merge of rust-lang#121702 - compiler-errors:coerce-alias-relate, r=lcnr Process alias-relate obligations in CoerceUnsized loop After rust-lang#119106, we now emit `AliasRelate` goals when relating `?0` and `Alias<T, ..>` in the new solver. In the ad-hoc `CoerceUnsized` selection loop, we now may have `AliasRelate` goals which must be processed to constrain type variables which are mentioned in other goals. --- For example, in the included test, we try to coerce `&<ManuallyDrop<T> as Deref>::Target` to `&dyn Foo`. This requires proving: * 1 `&<ManuallyDrop<T> as Deref>::Target: CoerceUnsized<&dyn Foo>` * 2 `<ManuallyDrop<T> as Deref>::Target alias-relate ?0` * 3 `?0: Unsize<dyn Foo>` * 4 `?0: Foo` * 5 `?0: Sized` If we don't process goal (2.) before processing goal (3.), then we hit ambiguity since `?0` is never constrained, and therefore we bail out, refusing to coerce the types. After processing (2.), we know `?0 := T`, and the rest of the goals can be processed normally.
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.
After #119106, we now emit
AliasRelate
goals when relating?0
andAlias<T, ..>
in the new solver. In the ad-hocCoerceUnsized
selection loop, we now may haveAliasRelate
goals which must be processed to constrain type variables which are mentioned in other goals.For example, in the included test, we try to coerce
&<ManuallyDrop<T> as Deref>::Target
to&dyn Foo
. This requires proving:&<ManuallyDrop<T> as Deref>::Target: CoerceUnsized<&dyn Foo>
<ManuallyDrop<T> as Deref>::Target alias-relate ?0
?0: Unsize<dyn Foo>
?0: Foo
?0: Sized
If we don't process goal (2.) before processing goal (3.), then we hit ambiguity since
?0
is never constrained, and therefore we bail out, refusing to coerce the types. After processing (2.), we know?0 := T
, and the rest of the goals can be processed normally.