Skip to content

Rustdoc macro visibility regression  #98743

Closed as not planned
Closed as not planned
@i509VCB

Description

@i509VCB

Code

When updating the clippy lints in Smithay I found that one of the doc tests no longer compiles in CI: https://github.com/Smithay/smithay/runs/7139965884?check_suite_focus=true

A minimal example also reproduces this:

I tried this code and ran cargo test:

/// ```
/// println!("{}", rule_of_life!());
/// ```
macro_rules! rule_of_life {
    () => {
        42usize
    };
}

I expected to see this happen:

Test completes successfully.

Instead, this happened:

running 1 test
test src/lib.rs - rule_of_life (line 3) ... FAILED

failures:

---- src/lib.rs - rule_of_life (line 3) stdout ----
error: cannot find macro `rule_of_life` in this scope
 --> src/lib.rs:4:16
  |
3 | println!("{}", rule_of_life!());
  |                ^^^^^^^^^^^^

error: aborting due to previous error

Couldn't compile the test.

Version it worked on

It most recently worked on: Rust 1.61.0

Version with regression

rustc --version --verbose:

rustc 1.62.0 (a8314ef7d 2022-06-27)
binary: rustc
commit-hash: a8314ef7d0ec7b75c336af2c9857bfaf43002bfc
commit-date: 2022-06-27
host: x86_64-unknown-linux-gnu
release: 1.62.0
LLVM version: 14.0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.regression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions