Skip to content

Rustdoc label trait feature#157058

Open
ThierryBerger wants to merge 6 commits into
rust-lang:mainfrom
ThierryBerger:rustdoc_label_trait
Open

Rustdoc label trait feature#157058
ThierryBerger wants to merge 6 commits into
rust-lang:mainfrom
ThierryBerger:rustdoc_label_trait

Conversation

@ThierryBerger
Copy link
Copy Markdown

@ThierryBerger ThierryBerger commented May 28, 2026

View all comments

  • Part of Tracking Issue for doc_label_trait #156865
  • parse #[doc(label_trait)]
  • render it in html
  • add some parsing tests (for the unstable feature)
  • add some html tests
  • Render a color from a hash from its full path -> ⚠️ some colors may be ugly, but we have a path forward with the color argument.

Should the following be out of scope ?

  • Parse color (#[doc(label_trait(color="0xff0000")])
  • display a small colored indicator (with a hover/first letter?) when a type implementing a label_trait is listed outside of its main page
  • Some Integration with rust analyzer
Screenshot 2026-05-28 at 14 06 01

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 28, 2026

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @lolbinarycat

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-json Area: Rustdoc JSON backend 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. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels May 28, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 28, 2026

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: rustdoc
  • rustdoc expanded to 9 candidates
  • Random selection from GuillaumeGomez, camelid, fmease, lolbinarycat, notriddle

@rust-log-analyzer

This comment has been minimized.

Comment thread src/doc/rustdoc/src/unstable-features.md Outdated
Comment thread src/doc/rustdoc/src/unstable-features.md Outdated
Copy link
Copy Markdown
Author

@ThierryBerger ThierryBerger May 28, 2026

Choose a reason for hiding this comment

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

This is mostly a copy from notable_trait, should be updated.

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should not be here, only in rustdoc book considering it's a rustdoc attribute.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I removed it, but seeing src/doc/unstable-book/src/language-features/doc-notable-trait.md is making me push back lightly on that, are you sure about your feedback? - or should we clean up other doc attributes that shouldn't be here (in other pr)?

Comment on lines +58 to +59
/// Relative URL to the trait page, or empty when not linkable.
href: String,
Copy link
Copy Markdown
Author

@ThierryBerger ThierryBerger May 28, 2026

Choose a reason for hiding this comment

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

should it be an option?

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should always link to the trait, so I'd say no.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Maybe doc_hidden would make us not be able to do so ? It would be quite far-fetched to add label_trait to doc_hidden but... Maybe other cases like... visibility? not sure.

Comment thread compiler/rustc_feature/src/unstable.rs Outdated
@GuillaumeGomez
Copy link
Copy Markdown
Member

Render a color from a hash from DefId -> ⚠️ is that an issue? color won't be stable between releases.

I would generated the color hash from the trait path (so crate::Trait for current crate, etc). Like that it will be stable across releases.

Comment thread src/librustdoc/html/render/mod.rs Outdated
Comment thread src/librustdoc/html/render/mod.rs Outdated
Comment thread src/librustdoc/html/render/mod.rs Outdated

let Some(impls) = cx.cache().impls.get(&did) else { return Vec::new() };

let mut out: Vec<LabelTraitInfo> = impls
Copy link
Copy Markdown
Member

@GuillaumeGomez GuillaumeGomez May 28, 2026

Choose a reason for hiding this comment

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

Instead of using a Vec, would be better to use a BTreeMap. It's sorted on insert and prevents duplications.

View changes since the review

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I changed to do that but then collect it to Vec, keeping this discussion opened as I'm not sure if you meant something else.

Comment thread src/librustdoc/html/render/print_item.rs Outdated
Comment thread src/librustdoc/html/render/mod.rs Outdated
Comment thread src/librustdoc/html/templates/print_item.html Outdated
Comment thread src/librustdoc/html/templates/print_item.html
Comment thread src/librustdoc/html/templates/print_item.html Outdated
Comment thread src/librustdoc/html/templates/print_item.html Outdated
Comment on lines +1040 to +1041
// FIXME: valid for traits, should be checked in attr_parsing
label_trait: _,
Copy link
Copy Markdown
Author

@ThierryBerger ThierryBerger May 28, 2026

Choose a reason for hiding this comment

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

should we have strong verification on which items those are applied?

View changes since the review

Copy link
Copy Markdown
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

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

Could you remove the two rust-analyzer changes please? They don't do anything as is so they will likely cause unnecessary conflicts for us

View changes since this review

@rust-log-analyzer

This comment has been minimized.

@ThierryBerger ThierryBerger force-pushed the rustdoc_label_trait branch from 2977320 to 6cddf7b Compare May 28, 2026 19:50
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

841 LL | #[repr]
842    | ^^^^^^^
843 
- error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(label_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
+ error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
845   --> $DIR/malformed-attrs.rs:41:1
846    |
847 LL | #[doc]

878 LL | | }
879    | |_^
880 
- error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(label_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
+ error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
882   --> $DIR/malformed-attrs.rs:76:1
883    |
884 LL | #[doc]


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args attributes/malformed-attrs.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/attributes/malformed-attrs.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/attributes/malformed-attrs" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0539]: malformed `cfg` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:106:1
   |
---
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes>
help: the following are the possible correct uses
   |
LL | #[forbid(lint1)]
   |         +++++++
LL | #[forbid(lint1, lint2, ...)]
   |         +++++++++++++++++++
LL | #[forbid(lint1, lint2, lint3, reason = "...")]
   |         +++++++++++++++++++++++++++++++++++++

error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:103:1
   |
LL | #[proc_macro = 18]
   | ^^^^^^^^^^^^^^^^^^

error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:120:1
   |
---
   |
LL | #[allow_internal_unsafe = 1]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(allow_internal_unsafe)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0539]: malformed `windows_subsystem` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:26:1
   |
LL | #![windows_subsystem]
---
   | ^^^^^^^^^^^^^^^^^^^^ expected this to be a list
   |
help: must be of the form
   |
LL | #[rustc_confusables("name1", "name2", ...)]
   |                    +++++++++++++++++++++++

error: `#[rustc_confusables]` attribute cannot be used on functions
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:36:1
   |
---
help: try changing it to one of the following valid forms of the attribute
   |
LL | #[rustc_macro_transparency = "opaque"]
   |                            ++++++++++
LL | #[rustc_macro_transparency = "semiopaque"]
   |                            ++++++++++++++
LL | #[rustc_macro_transparency = "transparent"]
   |                            +++++++++++++++

error: `#[rustc_macro_transparency]` attribute cannot be used on functions
---
   | ^^^^^^^^^^^^^^ expected this to be a list
   |
help: must be of the form
   |
LL | #[rustc_align(<alignment in bytes>)]
   |              ++++++++++++++++++++++

error[E0539]: malformed `optimize` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:56:1
   |
---
LL | #[optimize(none)]
   |           ++++++
LL | #[optimize(size)]
   |           ++++++
LL | #[optimize(speed)]
   |           +++++++

error[E0565]: malformed `cold` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:58:1
   |
---
   |               didn't expect any arguments here
   |
help: must be of the form
   |
LL - #[unsafe(naked())]
LL + #[unsafe(naked)]
   |

error[E0565]: malformed `track_caller` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:66:1
   |
---
   | ^^^^^^^^^^^^^^^^^ expected this to be a list
   |
help: must be of the form
   |
LL | #[target_feature(enable = "feat1, feat2")]
   |                 +++++++++++++++++++++++++

error[E0565]: malformed `export_stable` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:80:1
   |
---

error[E0565]: malformed `proc_macro` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:103:1
   |
LL | #[proc_macro = 18]
   | ^^^^^^^^^^^^^----^
   |              |
   |              didn't expect any arguments here
   |
help: must be of the form
   |
LL - #[proc_macro = 18]
LL + #[proc_macro]
   |

error[E0539]: malformed `instruction_set` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:110:1
   |
---
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected this to be a list
   |
help: must be of the form
   |
LL | #[patchable_function_entry(prefix_nops = m, entry_nops = n)]
   |                           +++++++++++++++++++++++++++++++++

error[E0565]: malformed `coroutine` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:115:5
   |
---
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
help: try changing it to one of the following valid forms of the attribute
   |
LL | #[proc_macro_derive(TraitName)]
   |                    +++++++++++
LL | #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
   |                    ++++++++++++++++++++++++++++++++++++++++++

error[E0539]: malformed `must_not_suspend` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:132:1
   |
---
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
help: must be of the form
   |
LL |     #[link_ordinal(ordinal)]
   |                   +++++++++

error[E0565]: malformed `ffi_const` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:169:5
   |
---
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute>
help: must be of the form
   |
LL | #[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]
   |                      ++++++++++++++++++++++++++++++++++++++++++++++

error[E0565]: malformed `automatically_derived` attribute input
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:188:1
   |
---
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute>
help: try changing it to one of the following valid forms of the attribute
   |
LL - #[macro_use = 1]
LL + #[macro_use(name1, name2, ...)]
   |
LL - #[macro_use = 1]
LL + #[macro_use]
   |

---
   |
LL | #[repr]
   | ^^^^^^^

error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:41:1
   |
LL | #[doc]
   | ^^^^^^
   |
---
   | ^^^^^^^^^^^^^
   |
   = 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
   = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default

warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]`
##[warning]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:73:1
   |
LL | #[crate_name]
---
...  |
LL | | }
   | |_^

error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:76:1
   |
LL | #[doc]
   | ^^^^^^

---
LL |     #[coroutine = 63] || {}
   |                       ^^^^^ expected `()`, found coroutine
   |
   = note: expected unit type `()`
              found coroutine `{coroutine@/checkout/tests/ui/attributes/malformed-attrs.rs:115:23: 115:25}`

error: aborting due to 73 previous errors; 8 warnings emitted

Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805.
For more information about an error, try `rustc --explain E0308`.
---
   | ^^^^^^^^^^^^^
   |
   = 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
   = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default

Future breakage diagnostic:
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:96:1
   |
LL | #[ignore()]
   | ^^^^^^^^^^^
   |
   = 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
   = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default

Future breakage diagnostic:
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
##[error]  --> /checkout/tests/ui/attributes/malformed-attrs.rs:222:1
   |
LL | #[ignore = 1]
   | ^^^^^^^^^^^^^
   |
   = 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
   = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
------------------------------------------

---- [ui] tests/ui/attributes/malformed-attrs.rs stdout end ----
---- [ui] tests/ui/malformed/malformed-regressions.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/malformed/malformed-regressions/malformed-regressions.stderr`
diff of stderr:

28    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
29    = note: requested on the command line with `-W unused-attributes`
30 
- error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(label_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
+ error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
32   --> $DIR/malformed-regressions.rs:3:1
33    |
34 LL | #[doc]


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args malformed/malformed-regressions.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/malformed/malformed-regressions.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/malformed/malformed-regressions" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0539]: malformed `link` attribute input
##[error]  --> /checkout/tests/ui/malformed/malformed-regressions.rs:8:1
   |
LL | #[link] //~ ERROR malformed
   | ^^^^^^^ expected this to be a list
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>

error[E0539]: malformed `link` attribute input
##[error]  --> /checkout/tests/ui/malformed/malformed-regressions.rs:11:1
   |
LL | #[link = ""] //~ ERROR malformed
   | ^^^^^^^----^
   |        |
   |        expected this to be a list
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>

warning: attribute should be applied to an `extern` block with non-Rust ABI
##[warning]  --> /checkout/tests/ui/malformed/malformed-regressions.rs:8:1
   |
LL | #[link] //~ ERROR malformed
   | ^^^^^^^
...
LL | fn main() {}
   | ------------ not an `extern` block
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: requested on the command line with `-W unused-attributes`

error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
##[error]  --> /checkout/tests/ui/malformed/malformed-regressions.rs:3:1
   |
LL | #[doc] //~ ERROR valid forms for the attribute are
   | ^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/malformed/malformed-regressions.rs:1:9
   |
LL | #![deny(invalid_doc_attributes)]
   |         ^^^^^^^^^^^^^^^^^^^^^^

error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
##[error]  --> /checkout/tests/ui/malformed/malformed-regressions.rs:4:1
   |
LL | #[ignore()] //~ ERROR valid forms for the attribute are
   | ^^^^^^^^^^^
   |
   = 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
   = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default

error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
##[error]  --> /checkout/tests/ui/malformed/malformed-regressions.rs:6:1
   |
LL | #[inline = ""] //~ ERROR valid forms for the attribute are
   | ^^^^^^^^^^^^^^
   |
   = 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 #57571 <https://github.com/rust-lang/rust/issues/57571>

error: aborting due to 5 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0539`.
Future incompatibility report: Future breakage diagnostic:
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
##[error]  --> /checkout/tests/ui/malformed/malformed-regressions.rs:4:1
   |
LL | #[ignore()] //~ ERROR valid forms for the attribute are
   | ^^^^^^^^^^^
   |
   = 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
   = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default

Future breakage diagnostic:
error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
##[error]  --> /checkout/tests/ui/malformed/malformed-regressions.rs:6:1
   |
LL | #[inline = ""] //~ ERROR valid forms for the attribute are
   | ^^^^^^^^^^^^^^
   |
   = 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
   = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
------------------------------------------

---- [ui] tests/ui/malformed/malformed-regressions.rs stdout end ----

failures:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-json Area: Rustdoc JSON backend 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. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants