-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Look at proc-macro attributes when encountering unknown attribute #134841
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: master
Are you sure you want to change the base?
Conversation
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
f88709b
to
4a5ec26
Compare
This comment was marked as resolved.
This comment was marked as resolved.
4a5ec26
to
291aaa9
Compare
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@bors r+ rollup |
@bors r=wesleywiser |
Look at proc-macro attributes when encountering unknown attribute ``` error: cannot find attribute `sede` in this scope --> $DIR/missing-derive-2.rs:22:7 | LL | #[sede(untagged)] | ^^^^ | help: the derive macros `Deserialize` and `Serialize` accept the similarly named `serde` attribute | LL | #[serde(untagged)] | + error: cannot find attribute `serde` in this scope --> $DIR/missing-derive-2.rs:16:7 | LL | #[serde(untagged)] | ^^^^^ | note: `serde` is imported here, but it is a crate, not an attribute --> $DIR/missing-derive-2.rs:5:1 | LL | extern crate serde; | ^^^^^^^^^^^^^^^^^^^ help: `serde` is an attribute that can be used by the derive macros `Serialize` and `Deserialize`, you might be missing a `derive` attribute | LL + #[derive(Serialize, Deserialize)] LL | enum B { | ``` Partially address rust-lang#47608. This PR doesn't find [macros that haven't yet been imported by name](rust-lang@af945cb).
Rollup of 13 pull requests Successful merges: - #134442 (Specify the behavior of `file!`) - #134841 (Look at proc-macro attributes when encountering unknown attribute) - #140372 (Exhaustively handle parsed attributes in CheckAttr) - #140766 (Stabilize keylocker) - #141061 (Change __rust_no_alloc_shim_is_unstable to be a function) - #142042 (Make E0621 missing lifetime suggestion verbose) - #142101 (core::ptr: deduplicate more method docs) - #142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches) - #142258 (platform-support.md: Mention specific Linux kernel version or later) - #142260 (Miri subtree update) - #142262 (Mark `core::slice::memchr` as `#[doc(hidden)]`) - #142272 (tests: Change ABIs in tests to more future-resilient ones) - #142275 (rustdoc: Refractor `clean_ty_generics`) r? `@ghost` `@rustbot` modify labels: rollup
Look at proc-macro attributes when encountering unknown attribute ``` error: cannot find attribute `sede` in this scope --> $DIR/missing-derive-2.rs:22:7 | LL | #[sede(untagged)] | ^^^^ | help: the derive macros `Deserialize` and `Serialize` accept the similarly named `serde` attribute | LL | #[serde(untagged)] | + error: cannot find attribute `serde` in this scope --> $DIR/missing-derive-2.rs:16:7 | LL | #[serde(untagged)] | ^^^^^ | note: `serde` is imported here, but it is a crate, not an attribute --> $DIR/missing-derive-2.rs:5:1 | LL | extern crate serde; | ^^^^^^^^^^^^^^^^^^^ help: `serde` is an attribute that can be used by the derive macros `Serialize` and `Deserialize`, you might be missing a `derive` attribute | LL + #[derive(Serialize, Deserialize)] LL | enum B { | ``` Partially address rust-lang#47608. This PR doesn't find [macros that haven't yet been imported by name](rust-lang@af945cb).
Rollup of 12 pull requests Successful merges: - #134442 (Specify the behavior of `file!`) - #134841 (Look at proc-macro attributes when encountering unknown attribute) - #140372 (Exhaustively handle parsed attributes in CheckAttr) - #140766 (Stabilize keylocker) - #141061 (Change __rust_no_alloc_shim_is_unstable to be a function) - #142042 (Make E0621 missing lifetime suggestion verbose) - #142101 (core::ptr: deduplicate more method docs) - #142258 (platform-support.md: Mention specific Linux kernel version or later) - #142260 (Miri subtree update) - #142262 (Mark `core::slice::memchr` as `#[doc(hidden)]`) - #142272 (tests: Change ABIs in tests to more future-resilient ones) - #142275 (rustdoc: Refractor `clean_ty_generics`) r? `@ghost` `@rustbot` modify labels: rollup
Look at proc-macro attributes when encountering unknown attribute ``` error: cannot find attribute `sede` in this scope --> $DIR/missing-derive-2.rs:22:7 | LL | #[sede(untagged)] | ^^^^ | help: the derive macros `Deserialize` and `Serialize` accept the similarly named `serde` attribute | LL | #[serde(untagged)] | + error: cannot find attribute `serde` in this scope --> $DIR/missing-derive-2.rs:16:7 | LL | #[serde(untagged)] | ^^^^^ | note: `serde` is imported here, but it is a crate, not an attribute --> $DIR/missing-derive-2.rs:5:1 | LL | extern crate serde; | ^^^^^^^^^^^^^^^^^^^ help: `serde` is an attribute that can be used by the derive macros `Serialize` and `Deserialize`, you might be missing a `derive` attribute | LL + #[derive(Serialize, Deserialize)] LL | enum B { | ``` Partially address rust-lang#47608. This PR doesn't find [macros that haven't yet been imported by name](rust-lang@af945cb).
Rollup of 14 pull requests Successful merges: - #134442 (Specify the behavior of `file!`) - #134841 (Look at proc-macro attributes when encountering unknown attribute) - #140372 (Exhaustively handle parsed attributes in CheckAttr) - #140766 (Stabilize keylocker) - #141642 (Note the version and PR of removed features when using it) - #141909 (Add central execution context to bootstrap) - #141992 (use `#[naked]` for `__rust_probestack`) - #142102 (docs: Small clarification on the usage of read_to_string and read_to_end trait methods) - #142124 (Allow transmute casts in pre-runtime-MIR) - #142240 (deduplicate the rest of AST walker functions) - #142258 (platform-support.md: Mention specific Linux kernel version or later) - #142262 (Mark `core::slice::memchr` as `#[doc(hidden)]`) - #142271 (compiler: fn ptrs should hit different lints based on ABI) - #142288 (const_eval: fix some outdated comments) r? `@ghost` `@rustbot` modify labels: rollup
Failed in rollup: #142290 (comment) |
I've only briefly looked at the failure but I see a list of something changing order depending on the target (failure here is on dist-i586-gnu-i586-i686-musl), so this is likely query instability, e.g., iterating over a HashMap. |
// We didn't find an exact match. Look for close matches. If any, suggest fixing typo. | ||
#[allow(rustc::potential_query_instability)] // We're immediately sorting these. | ||
let mut all_attr_names: Vec<Symbol> = all_attrs.keys().cloned().collect(); | ||
all_attr_names.sort(); |
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.
This doesn't do what you think it does and thus does actually result in query instability: The Ord
impl for Symbol
sorts by interning ID (which seems to be unstable). You instead want to sort by the string contents of the Symbol:
all_attr_names.sort(); | |
all_attr_names.sort_by(|a, b| a.as_str().cmp(b.as_str())); |
(pretty sure sort_by_key
wouldn't work because the key wouldn't live long enough)
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 don't actually know why we still have Ord
impls for Symbol
. IMO, we should have impl !Ord for Symbol {} impl !PartialOrd for Symbol {}
but idk, maybe the query system or metadata encoding actually needs it to be Ord...
This comment has been minimized.
This comment has been minimized.
``` error: cannot find attribute `empty_helper` in this scope --> $DIR/derive-helper-legacy-limits.rs:17:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ | help: `empty_helper` is an attribute that can be used by the derive macro `Empty`, you might be missing a `derive` attribute | LL + #[derive(Empty)] LL | struct S2; | ``` Look at proc-macro attributes when encountering unknown attribute ``` error: cannot find attribute `sede` in this scope --> src/main.rs:18:7 | 18 | #[sede(untagged)] | ^^^^ | help: the derive macros `Serialize` and `Deserialize` accept the similarly named `serde` attribute | 18 | #[serde(untagged)] | ~~~~~ error: cannot find attribute `serde` in this scope --> src/main.rs:12:7 | 12 | #[serde(untagged)] | ^^^^^ | = note: `serde` is in scope, but it is a crate, not an attribute help: `serde` is an attribute that can be used by the derive macros `Serialize` and `Deserialize`, you might be missing a `derive` attribute | 10 | #[derive(Serialize, Deserialize)] | ```
@bors r=wesleywiser |
Look at proc-macro attributes when encountering unknown attribute ``` error: cannot find attribute `sede` in this scope --> $DIR/missing-derive-2.rs:22:7 | LL | #[sede(untagged)] | ^^^^ | help: the derive macros `Deserialize` and `Serialize` accept the similarly named `serde` attribute | LL | #[serde(untagged)] | + error: cannot find attribute `serde` in this scope --> $DIR/missing-derive-2.rs:16:7 | LL | #[serde(untagged)] | ^^^^^ | note: `serde` is imported here, but it is a crate, not an attribute --> $DIR/missing-derive-2.rs:5:1 | LL | extern crate serde; | ^^^^^^^^^^^^^^^^^^^ help: `serde` is an attribute that can be used by the derive macros `Serialize` and `Deserialize`, you might be missing a `derive` attribute | LL + #[derive(Serialize, Deserialize)] LL | enum B { | ``` Partially address rust-lang#47608. This PR doesn't find [macros that haven't yet been imported by name](rust-lang@af945cb).
Look at proc-macro attributes when encountering unknown attribute ``` error: cannot find attribute `sede` in this scope --> $DIR/missing-derive-2.rs:22:7 | LL | #[sede(untagged)] | ^^^^ | help: the derive macros `Deserialize` and `Serialize` accept the similarly named `serde` attribute | LL | #[serde(untagged)] | + error: cannot find attribute `serde` in this scope --> $DIR/missing-derive-2.rs:16:7 | LL | #[serde(untagged)] | ^^^^^ | note: `serde` is imported here, but it is a crate, not an attribute --> $DIR/missing-derive-2.rs:5:1 | LL | extern crate serde; | ^^^^^^^^^^^^^^^^^^^ help: `serde` is an attribute that can be used by the derive macros `Serialize` and `Deserialize`, you might be missing a `derive` attribute | LL + #[derive(Serialize, Deserialize)] LL | enum B { | ``` Partially address rust-lang#47608. This PR doesn't find [macros that haven't yet been imported by name](rust-lang@af945cb).
Rollup of 13 pull requests Successful merges: - #134841 (Look at proc-macro attributes when encountering unknown attribute) - #141639 (Expose discriminant values in stable_mir) - #141967 (Configure bootstrap backport nominations through triagebot) - #142042 (Make E0621 missing lifetime suggestion verbose) - #142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches) - #142248 (Add supported asm types for LoongArch32) - #142272 (tests: Change ABIs in tests to more future-resilient ones) - #142282 (Only run `citool` tests on the `auto` branch) - #142297 (Implement `//@ needs-target-std` compiletest directive) - #142298 (Make loongarch-none target maintainers more easily pingable) - #142306 (Dont unwrap and re-wrap typing envs) - #142324 (Remove unneeded `FunctionCx` from some codegen methods) - #142328 (feat: Add `bit_width` for unsigned integer types) r? `@ghost` `@rustbot` modify labels: rollup
seems it still has problems? @bors r- |
@bors rollup=iffy |
Partially address #47608. This PR doesn't find macros that haven't yet been imported by name.