You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Spurious legacy_derive_helpers lint when unrelated attribute fails to resolve #81871
error: cannot find attribute `dummy` in this scope
--> src/main.rs:1:4
|
1 | #![dummy]
| ^^^^^
error: cannot determine resolution for the attribute macro `derive`
--> src/main.rs:5:3
|
5 | #[derive(MyDerive)]
| ^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
error: cannot determine resolution for the derive macro `MyDerive`
--> src/main.rs:5:10
|
5 | #[derive(MyDerive)]
| ^^^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
error: cannot determine resolution for the attribute macro `my_helper`
--> src/main.rs:6:3
|
6 | #[my_helper]
| ^^^^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
warning: derive helper attribute `my_helper` is used before it is introduced
--> src/main.rs:6:3
|
5 | #[derive(MyDerive)]
| -------- the attribute is introduced here
6 | #[my_helper]
| ^^^^^^^^^
|
= note: `#[warn(legacy_derive_helpers)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79202 <https://github.com/rust-lang/rust/issues/79202>
error: aborting due to 4 previous errors; 1 warning emitted
The legacy_derive_helpers warning is spurious and will disappear if #![dummy] is removed.
Initial resolution of derive fails, so it's recovered as an unresolved inert attribute, but due to the linked issue the order of attributes swaps during the "inert attribute expansion".
So we have this code before resolving my_helper:
#[my_helper]
#[derive(MyDerive)]
struct Foo {}
and my_derive gets resolved as a legacy helper.
A fix for #67839 is one of direct follow ups to #79078, so it is in my queue and pretty close to the top.
// aux-build:test-macros.rs
#![dummy] //~ ERROR cannot find attribute `dummy` in this scope
#[macro_use]
extern crate test_macros;
#[derive(Empty)] //~ ERROR cannot determine resolution for the attribute macro `derive`
#[empty_helper] //~ WARN derive helper attribute is used before it is introduced
//~| WARN this was previously accepted
struct Foo {}
fn main() {}
Activity
Aaron1011 commentedon Feb 8, 2021
Caused by #79078
cc @petrochenkov
petrochenkov commentedon Feb 13, 2021
This looks like a consequence of #67839.
Initial resolution of
derivefails, so it's recovered as an unresolved inert attribute, but due to the linked issue the order of attributes swaps during the "inert attribute expansion".So we have this code before resolving
my_helper:and
my_derivegets resolved as a legacy helper.A fix for #67839 is one of direct follow ups to #79078, so it is in my queue and pretty close to the top.
petrochenkov commentedon Feb 13, 2021
Copypasting a future test for the ui test suite:
petrochenkov commentedon Feb 22, 2021
Fixed in #82419.
Rollup merge of rust-lang#82419 - petrochenkov:inertord, r=Aaron1011
Rollup merge of rust-lang#82419 - petrochenkov:inertord, r=Aaron1011
Rollup merge of rust-lang#82419 - petrochenkov:inertord, r=Aaron1011
Rollup merge of rust-lang#82419 - petrochenkov:inertord, r=Aaron1011
Rollup merge of rust-lang#82419 - petrochenkov:inertord, r=Aaron1011