Skip to content
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 an opt-out in pretty printing for RTN rendering #138126

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Mar 6, 2025

Today, we render RPITIT types like impl Sized { T::method(..) } when RTN is enabled. This is very useful for diagnostics, since it's often not clear what the impl Sized type means by itself, and it makes it clear that that's an RPITIT that can be bounded using RTN syntax. See #115624.

However, since we don't distinguish types that are rendered for the purposes of printing messages vs suggestions, this representation leaks into suggestions and turns into code that can't be parsed. This PR adds a new with_types_for_suggestion! {} and with_types_for_signature! {} options to the pretty printing architecture to make it clear that we're rendering a type for code suggestions.

This can be applied later as we find that we need it.

@rustbot
Copy link
Collaborator

rustbot commented Mar 6, 2025

r? @estebank

rustbot has assigned @estebank.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot 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 Mar 6, 2025
@compiler-errors
Copy link
Member Author

r? oli-obk

@rustbot rustbot assigned oli-obk and unassigned estebank Mar 12, 2025
@@ -15,6 +15,10 @@ note: required by a bound in `is_send`
|
LL | fn is_send(_: impl Send) {}
| ^^^^ required by this bound in `is_send`
help: consider further restricting the associated type
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:D

@oli-obk
Copy link
Contributor

oli-obk commented Mar 13, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Mar 13, 2025

📌 Commit 7a08d03 has been approved by oli-obk

It is now in the queue for this repository.

@bors 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 Mar 13, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 13, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#138126 (Add an opt-out in pretty printing for RTN rendering)
 - rust-lang#138399 (Delegation: allow foreign fns `reuse`)
 - rust-lang#138406 (Update mdbook to 0.4.47)
 - rust-lang#138417 (minor interpreter cleanups)
 - rust-lang#138420 (Adapt to LLVM dropping CfiFunctionIndex::begin()/end())
 - rust-lang#138423 (Don't emit error within cast function, propagate it as a `CastError`)
 - rust-lang#138425 (Remove `feature = "hash_raw_entry"`)
 - rust-lang#138427 (Fix RISC-V VxWorks LLVM target triples)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b5955e7 into rust-lang:master Mar 13, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 13, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 13, 2025
Rollup merge of rust-lang#138126 - compiler-errors:rtn-for-sugg, r=oli-obk

Add an opt-out in pretty printing for RTN rendering

Today, we render RPITIT types like `impl Sized { T::method(..) }` when RTN is enabled. This is very useful for diagnostics, since it's often not clear what the `impl Sized` type means by itself, and it makes it clear that that's an RPITIT that can be bounded using RTN syntax. See rust-lang#115624.

However, since we don't distinguish types that are rendered for the purposes of printing messages vs suggestions, this representation leaks into suggestions and turns into code that can't be parsed. This PR adds a new `with_types_for_suggestion! {}` and `with_types_for_signature! {}` options to the pretty printing architecture to make it clear that we're rendering a type for code suggestions.

This can be applied later as we find that we need it.
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants