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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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

Comment on lines +2 to +5

#![feature(rustc_attrs)]
#![rustc_no_implicit_bounds]

Copy link
Contributor

Choose a reason for hiding this comment

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

for unsize coercions/trait object coercions test, the attribute makes them a bit confusing/harder to read for me 🤔

so maybe only limit the attribute to tests for the trait solver 🤔

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.
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
@davidtwco davidtwco force-pushed the no-default-bounds-attr branch from d746230 to 22a9327 Compare June 18, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants