-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Add FCW for derive helper attributes that will conflict with built-in attributes #151152
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
base: main
Are you sure you want to change the base?
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
|
r? @chenyukang rustbot has assigned @chenyukang. Use |
This comment has been minimized.
This comment has been minimized.
54147eb to
c9b7a07
Compare
c9b7a07 to
4dda363
Compare
This comment has been minimized.
This comment has been minimized.
|
@bors r=chenyukang |
|
New deprecation lints go through language team process, and the lint name also doesn't follow naming conventions. |
|
@bors r- |
|
Commit 4dda363 has been unapproved. |
|
@rustbot label +I-lang-nominated I am nominating this for lang-team attention. What name should this lint have? The current name doesn't follow the naming conventions My main idea is |
This comment has been minimized.
This comment has been minimized.
7903366 to
f4eca01
Compare
|
Thanks! |
…=chenyukang
Add FCW for derive helper attributes that will conflict with built-in attributes
Adds a future-compatibility-warning deny-by-default lint that helps catch invalid derive helper attribute names early.
This issues the lint, saying that `ignore` helper will clash with the built-in `ignore` attribute.
```rust
#![crate_type = "proc-macro"]
#![deny(ambiguous_derive_helpers)]
use proc_macro::TokenStream;
#[proc_macro_derive(Trait, attributes(ignore))]
pub fn example(input: TokenStream) -> TokenStream {
TokenStream::new()
}
```
If you actually tried to use that `ignore` helper attribute, you won't be able to due to the ambiguity:
```rust
#[derive(Trait)]
struct Foo {
#[ignore]
field: (),
}
```
Produces:
```
error[E0659]: `ignore` is ambiguous
--> src/lib.rs:5:7
|
5 | #[ignore]
| ^^^^^^ ambiguous name
|
= note: ambiguous because of a name conflict with a builtin attribute
= note: `ignore` could refer to a built-in attribute
note: `ignore` could also refer to the derive helper attribute defined here
--> src/lib.rs:3:10
|
3 | #[derive(Trait)]
| ^^^^^
```
Rollup of 7 pull requests Successful merges: - #151152 (Add FCW for derive helper attributes that will conflict with built-in attributes) - #151954 (Add help message suggesting explicit reference cast for From/TryFrom) - #152148 (Move `impl Interner for TyCtxt` to its own submodule) - #152226 (Modernize diagnostic for indeterminate trait object lifetime bounds) - #150688 (typeck: Make it clearer that `check_pat_lit` only handles literal patterns) - #152293 (Format heterogeneous try blocks) - #152396 (Uplift `Predicate::allow_normalization` to `rustc_type_ir`)
f4eca01 to
846e4ee
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r+ |
|
@nik-rev: 🔑 Insufficient privileges: not in review users |
|
@bors r=JonathanBrouwer |
|
@nik-rev: 🔑 Insufficient privileges: not in review users |
|
@rustbot ready |
|
@bors try jobs=test-various |
This comment has been minimized.
This comment has been minimized.
Add FCW for derive helper attributes that will conflict with built-in attributes try-job: test-various
|
@bors r=chenyukang |
Adds a future-compatibility-warning deny-by-default lint that helps catch invalid derive helper attribute names early.
This issues the lint, saying that
ignorehelper will clash with the built-inignoreattribute.If you actually tried to use that
ignorehelper attribute, you won't be able to due to the ambiguity:Produces: