-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove define_debug_via_print
for ExistentialProjection
, use regular structural debug impl
#139777
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
Merged
+2
−2
Conversation
This file contains hidden or 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
@bors r+ rollup |
☔ The latest upstream changes (presumably #139781) made this pull request unmergeable. Please resolve the merge conflicts. |
c289b94
to
1b9ae74
Compare
@bors r=lcnr |
This comment has been minimized.
This comment has been minimized.
@bors r- |
1b9ae74
to
83ea345
Compare
@bors r=lcnr |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 14, 2025
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#139127 (Fix up partial res of segment in primitive resolution hack) - rust-lang#139392 (Detect and provide suggestion for `&raw EXPR`) - rust-lang#139767 (Visit place in `BackwardIncompatibleDropHint` statement) - rust-lang#139777 (Remove `define_debug_via_print` for `ExistentialProjection`, use regular structural debug impl) - rust-lang#139796 (ptr docs: add missing backtics around 'usize') - rust-lang#139801 (Add myself to mailmap) - rust-lang#139804 (use `realpath` in `bootstrap.py` when creating build-dir) - rust-lang#139807 (Improve wording of post-merge report) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 14, 2025
Rollup merge of rust-lang#139777 - compiler-errors:debuggier-proj, r=lcnr Remove `define_debug_via_print` for `ExistentialProjection`, use regular structural debug impl The pretty print impl for `ExistentialProjection` always prints `AssocItem = Ty`: https://github.com/rust-lang/rust/blob/6e830462330a9e34d8176e86d4580dd0820c6fd5/compiler/rustc_middle/src/ty/print/pretty.rs#L3293-L3299 We can't change this, b/c it's used for both pretty printing dyn types and for legacy symbol mangling. Unfortunately, we also use this printing procedure for `Debug` impls. That means that it leaves out the *trait name* and *trait args* when debug printing an `ExistentialProjection` (or an `ExistentialPredicate` which has a variant for `ExistentialProjection`). This leads to awkward situations, like the two seemingly identical existential projection predicates present in a `dyn Trait` type using the definition below: ```rust trait Super { type Assoc; } trait Foo: Super<A, Assoc = i32> + Super<B, Assoc = i32> {} ``` Namely, they both just render as `Projection(Assoc = i32)`! This makes debugging `dyn Trait` type system bugs really hard, so let's use the *regular* debug impl for `ExistentialProjection`.
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Apr 19, 2025
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#139127 (Fix up partial res of segment in primitive resolution hack) - rust-lang#139392 (Detect and provide suggestion for `&raw EXPR`) - rust-lang#139767 (Visit place in `BackwardIncompatibleDropHint` statement) - rust-lang#139777 (Remove `define_debug_via_print` for `ExistentialProjection`, use regular structural debug impl) - rust-lang#139796 (ptr docs: add missing backtics around 'usize') - rust-lang#139801 (Add myself to mailmap) - rust-lang#139804 (use `realpath` in `bootstrap.py` when creating build-dir) - rust-lang#139807 (Improve wording of post-merge report) 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.
The pretty print impl for
ExistentialProjection
always printsAssocItem = Ty
:rust/compiler/rustc_middle/src/ty/print/pretty.rs
Lines 3293 to 3299 in 6e83046
We can't change this, b/c it's used for both pretty printing dyn types and for legacy symbol mangling.
Unfortunately, we also use this printing procedure for
Debug
impls. That means that it leaves out the trait name and trait args when debug printing anExistentialProjection
(or anExistentialPredicate
which has a variant forExistentialProjection
). This leads to awkward situations, like the two seemingly identical existential projection predicates present in adyn Trait
type using the definition below:Namely, they both just render as
Projection(Assoc = i32)
! This makes debuggingdyn Trait
type system bugs really hard, so let's use the regular debug impl forExistentialProjection
.