Skip to content

add #![rustc_no_implicit_bounds] #142671

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
merged 2 commits into from
Jun 27, 2025
Merged

Conversation

davidtwco
Copy link
Member

@davidtwco davidtwco commented Jun 18, 2025

Follow-up from #137944.

Adds a new rustc_attrs attribute that stops rustc from adding any default bounds. Useful for tests where default bounds just add noise and make debugging harder.

After reviewing all tests with ?Sized, these tests seem like they could probably benefit from #![rustc_no_implicit_bounds].

  • Skipping most of tests/ui/unsized as these seem to want to test ?Sized
  • Skipping tests that used Box<T> because it's still bound by T: MetaSized
  • Skipping parsing or other tests that cared about ?Sized syntactically
  • Skipping tests for derive(CoercePointee) because this appears to check that the pointee type is relaxed with ?Sized explicitly

r? @lcnr

@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jun 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 18, 2025

HIR ty lowering was modified

cc @fmease

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

r=me on the rustc impl. I personally feel like applying this attribute in some of the tests makes them worse 🤔 if u want I can check out your PR locally, reset the last commit and manually only readd the tests where I consider the attribute to be useful

@davidtwco davidtwco force-pushed the no-default-bounds-attr branch from fabf44b to d746230 Compare June 18, 2025 13:26
@davidtwco
Copy link
Member Author

r=me on the rustc impl. I personally feel like applying this attribute in some of the tests makes them worse 🤔 if u want I can check out your PR locally, reset the last commit and manually only readd the tests where I consider the attribute to be useful

Sure, go ahead :)

Adds a new `rustc_attrs` attribute that stops rustc from adding any
default bounds. Useful for tests where default bounds just add noise and
make debugging harder.
@davidtwco davidtwco force-pushed the no-default-bounds-attr branch from d746230 to 22a9327 Compare June 18, 2025 14:22
After reviewing all tests with `?Sized` and discussing with lcnr, these
tests seem like they could probably benefit from
`#![rustc_no_implicit_bounds]`.
@davidtwco davidtwco force-pushed the no-default-bounds-attr branch from 22a9327 to 1fd13fd Compare June 27, 2025 11:31
@davidtwco
Copy link
Member Author

Had a chat with @lcnr and using the attribute now in just the tests that we think are improvements.

@davidtwco
Copy link
Member Author

@bors r=lcnr rollup

@bors
Copy link
Collaborator

bors commented Jun 27, 2025

📌 Commit 1fd13fd has been approved by lcnr

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 Jun 27, 2025
bors added a commit that referenced this pull request Jun 27, 2025
Rollup of 10 pull requests

Successful merges:

 - #142270 (Rustdoc js: even more typechecking improvements)
 - #142420 (Report infer ty errors during hir ty lowering)
 - #142671 (add #![rustc_no_implicit_bounds])
 - #142721 (Add tracing to `InterpCx::layout_of()` )
 - #142818 (Port `#[used]` to new attribute parsing infrastructure)
 - #143020 (codegen_fn_attrs: make comment more precise)
 - #143051 (Add tracing to `validate_operand`)
 - #143060 (Only args in main diag are saved and restored without removing the newly added ones)
 - #143065 (Improve recovery when users write `where:`)
 - #143084 (const-eval: error when initializing a static writes to that static)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 80f20c9 into rust-lang:master Jun 27, 2025
10 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jun 27, 2025
rust-timer added a commit that referenced this pull request Jun 27, 2025
Rollup merge of #142671 - davidtwco:no-default-bounds-attr, r=lcnr

add #![rustc_no_implicit_bounds]

Follow-up from #137944.

Adds a new `rustc_attrs` attribute that stops rustc from adding any default bounds. Useful for tests where default bounds just add noise and make debugging harder.

After reviewing all tests with `?Sized`, these tests seem like they could probably benefit from `#![rustc_no_implicit_bounds]`.

- Skipping most of `tests/ui/unsized` as these seem to want to test `?Sized`
- Skipping tests that used `Box<T>` because it's still bound by `T: MetaSized`
- Skipping parsing or other tests that cared about `?Sized` syntactically
- Skipping tests for `derive(CoercePointee)` because this appears to check that the pointee type is relaxed with `?Sized` explicitly

r? `@lcnr`
@davidtwco davidtwco deleted the no-default-bounds-attr branch June 27, 2025 19:22
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jun 28, 2025
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#142270 (Rustdoc js: even more typechecking improvements)
 - rust-lang/rust#142420 (Report infer ty errors during hir ty lowering)
 - rust-lang/rust#142671 (add #![rustc_no_implicit_bounds])
 - rust-lang/rust#142721 (Add tracing to `InterpCx::layout_of()` )
 - rust-lang/rust#142818 (Port `#[used]` to new attribute parsing infrastructure)
 - rust-lang/rust#143020 (codegen_fn_attrs: make comment more precise)
 - rust-lang/rust#143051 (Add tracing to `validate_operand`)
 - rust-lang/rust#143060 (Only args in main diag are saved and restored without removing the newly added ones)
 - rust-lang/rust#143065 (Improve recovery when users write `where:`)
 - rust-lang/rust#143084 (const-eval: error when initializing a static writes to that static)

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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants