Skip to content

Regression in nightly-2025-06-28: rustdoc --test -Zcrate-attr=feature(used_with_arg) #147276

Closed

Description

@dtolnay
#[used(linker)]
static REPRO: isize = 1;
$ rustdoc +nightly-2025-06-27 --test -Zcrate-attr='feature(used_with_arg)' lib.rs

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
$ rustdoc +nightly-2025-06-28 --test -Zcrate-attr='feature(used_with_arg)' lib.rs
error[E0658]: `#[used(linker)]` is currently unstable
 --> lib.rs:1:1
  |
1 | #[used(linker)]
  | ^^^^^^^^^^^^^^^
  |
  = note: see issue #93798 <https://github.com/rust-lang/rust/issues/93798> for more information
  = help: add `#![feature(used_with_arg)]` to the crate attributes to enable
  = note: this compiler was built on 2025-06-27; consider upgrading it if it is out of date

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0658`.

The most recent nightly (nightly-2025-10-02) remains affected.

Bisects to #142818. @JonathanBrouwer @jdonszelmann

Activity

  1. added
    C-bug
    regression-untriaged
    on Oct 2, 2025
  2. added
    needs-triage
    I-prioritize
    on Oct 2, 2025
  3. added
    T-rustdoc
    A-doctests
    on Oct 2, 2025
  4. added
    A-attributes
    F-used_with_arg
    on Oct 2, 2025
  5. JonathanBrouwer commented on Oct 2, 2025

    @JonathanBrouwer
    Member

    @rustbot claim
    Will fix

  6. added
    S-has-mcve
    S-has-bisection
    requires-nightly
    on Oct 2, 2025
  7. Urgau commented on Oct 2, 2025

    @Urgau
    Member

    Part of the issue is that rustdoc is not populating the unstable_opts (and thus -Zcrate-attr) when testing doctests.

    let sessopts = config::Options {
    sysroot: options.sysroot.clone(),
    search_paths: options.libs.clone(),
    crate_types,
    lint_opts,
    lint_cap: Some(options.lint_cap.unwrap_or(lint::Forbid)),
    cg: options.codegen_options.clone(),
    externs: options.externs.clone(),
    unstable_features: options.unstable_features,
    actually_rustdoc: true,
    edition: options.edition,
    target_triple: options.target.clone(),
    crate_name: options.crate_name.clone(),
    remap_path_prefix: options.remap_path_prefix.clone(),
    ..config::Options::default()
    };

    Adding unstable_opts: options.unstable_opts.clone() to sessopts initialization fixes the issue, but that's kind of surprising since the code around that area hasn't been touched in over a year, I wonder how that could have worked before.

  8. fmease commented on Oct 2, 2025

    @fmease
    Member

    #143930 is probably another instance of what Urgau wrote; I never got around to fixing it

  9. removed
    I-prioritize
    needs-triage
    on Oct 3, 2025
  10. Urgau commented on Oct 3, 2025

    @Urgau
    Member

    Talked with @JonathanBrouwer, I'm gonna post the above fix. @rustbot claim

  11. added a commit that references this issue on Oct 3, 2025
  12. added 2 commits that reference this issue on Oct 4, 2025
  13. added a commit that references this issue on Oct 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-attributesA-doctestsC-bugF-used_with_argS-has-bisectionS-has-mcveT-rustdocregression-untriagedrequires-nightly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions