-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Rewrite on_unimplemented format string parser. #139091
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
Conversation
This comment has been minimized.
This comment has been minimized.
This PR changes a file inside |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8f91772
to
232c722
Compare
☔ The latest upstream changes (presumably #139555) made this pull request unmergeable. Please resolve the merge conflicts. |
r? @compiler-errors (or reroll) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ill actually look at this tomorrow, just a few actionable things until then
compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented_format.rs
Show resolved
Hide resolved
@@ -63,9 +60,8 @@ error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied | |||
--> $DIR/multiple-impls.rs:39:5 | |||
| | |||
LL | Index::index(&[] as &[i32], Bar(2u32)); | |||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the rustc_on_unimplemented
from impls in these test files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally we'd make it a validation error or something to put this on an impl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I plan on removing it in the future.
why not now? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for a couple reasons:
- in b1bc725 I deleted its only use in std, but it's still present in the beta std. I'm unsure whether raising an error would cause problems.
- rather than adding that check to this PR I'd rather do it in a future hir attributes related PR
- I'm not intimately familiar with this code so didn't feel like raising new errors.
I'm happy to start raising errors now if you'd prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I'd at least prefer for us to clean up the UI tests so they don't look like they're buggy (i.e. have annotations on impls, but don't use them).
I feel like the easiest way of doing that is just making rustc_on_unimplemented
an error then clean up the new errors in the UI tests, but it's up to you I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the "now the ui tests look buggy" argument is compelling to me, i'll experiment with a hard error tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've deleted the tests for attribute on impls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally we'd make it a validation error or something to put this on an impl
it's not a validation error to put it anywhere, you can put it on structs, functions, etc. I would like to start erroring on all of that after migrating the attribute itself.
the Tidy/bootstrap labels are just because it deletes a |
One nit, though I didn't review this for perfect parity with the previous behavior, it looks fine to me. |
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
I've fixed the doc comment. Thanks for the review :) @rustbot ready |
@compiler-errors ping 🙏 |
@bors r+ |
…enton Rollup of 8 pull requests Successful merges: - rust-lang#138934 (support config extensions) - rust-lang#139091 (Rewrite on_unimplemented format string parser.) - rust-lang#139753 (Make `#[naked]` an unsafe attribute) - rust-lang#139762 (Don't assemble non-env/bound candidates if projection is rigid) - rust-lang#139834 (Don't canonicalize crate paths) - rust-lang#139868 (Move `pal::env` to `std::sys::env_consts`) - rust-lang#139978 (Add citool command for generating a test dashboard) - rust-lang#139995 (Clean UI tests 4 of n) r? `@ghost` `@rustbot` modify labels: rollup
…enton Rollup of 8 pull requests Successful merges: - rust-lang#138934 (support config extensions) - rust-lang#139091 (Rewrite on_unimplemented format string parser.) - rust-lang#139753 (Make `#[naked]` an unsafe attribute) - rust-lang#139762 (Don't assemble non-env/bound candidates if projection is rigid) - rust-lang#139834 (Don't canonicalize crate paths) - rust-lang#139868 (Move `pal::env` to `std::sys::env_consts`) - rust-lang#139978 (Add citool command for generating a test dashboard) - rust-lang#139995 (Clean UI tests 4 of n) r? `@ghost` `@rustbot` modify labels: rollup
…enton Rollup of 8 pull requests Successful merges: - rust-lang#138934 (support config extensions) - rust-lang#139091 (Rewrite on_unimplemented format string parser.) - rust-lang#139753 (Make `#[naked]` an unsafe attribute) - rust-lang#139762 (Don't assemble non-env/bound candidates if projection is rigid) - rust-lang#139834 (Don't canonicalize crate paths) - rust-lang#139868 (Move `pal::env` to `std::sys::env_consts`) - rust-lang#139978 (Add citool command for generating a test dashboard) - rust-lang#139995 (Clean UI tests 4 of n) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#139091 - mejrs:format, r=compiler-errors Rewrite on_unimplemented format string parser. This PR rewrites the format string parser for `rustc_on_unimplemented` and `diagnostic::on_unimplemented`. I plan on moving this code (and more) into the new attribute parsing system soon and wanted to PR it separately. This PR introduces some minor differences though: - `rustc_on_unimplemented` on trait *implementations* is no longer checked/used - this is actually never used (outside of some tests) so I plan on removing it in the future. - for `rustc_on_unimplemented`, it introduces the `{This}` argument in favor of `{ThisTraitname}` (to be removed later). It'll be easier to parse. - for `rustc_on_unimplemented`, `Self` can now consistently be used as a filter, rather than just `_Self`. It used to not match correctly on for example `Self = "[{integer}]"` - Some error messages now have better spans. Fixes rust-lang#130627
…enton Rollup of 8 pull requests Successful merges: - rust-lang#138934 (support config extensions) - rust-lang#139091 (Rewrite on_unimplemented format string parser.) - rust-lang#139753 (Make `#[naked]` an unsafe attribute) - rust-lang#139762 (Don't assemble non-env/bound candidates if projection is rigid) - rust-lang#139834 (Don't canonicalize crate paths) - rust-lang#139868 (Move `pal::env` to `std::sys::env_consts`) - rust-lang#139978 (Add citool command for generating a test dashboard) - rust-lang#139995 (Clean UI tests 4 of n) r? `@ghost` `@rustbot` modify labels: rollup
This PR rewrites the format string parser for
rustc_on_unimplemented
anddiagnostic::on_unimplemented
. I plan on moving this code (and more) into the new attribute parsing system soon and wanted to PR it separately.This PR introduces some minor differences though:
rustc_on_unimplemented
on trait implementations is no longer checked/used - this is actually never used (outside of some tests) so I plan on removing it in the future.rustc_on_unimplemented
, it introduces the{This}
argument in favor of{ThisTraitname}
(to be removed later). It'll be easier to parse.rustc_on_unimplemented
,Self
can now consistently be used as a filter, rather than just_Self
. It used to not match correctly on for exampleSelf = "[{integer}]"
Fixes #130627