Skip to content

rustdoc seems to ignore edition2018 attribute #58875

Closed
@Alexander-N

Description

@Alexander-N

Running

rustdoc -L target/debug/deps --test test.md

with the following content of test.md

```edition2018
// extern crate clap;
use clap::Arg;
```

gives me

running 1 test
test test.md -  (line 1) ... FAILED

failures:

---- test.md -  (line 1) stdout ----
error[E0432]: unresolved import `clap`
 --> test.md:3:5
  |
4 | use clap::Arg;
  |     ^^^^ use of undeclared type or module `clap`

thread 'test.md -  (line 1)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:351:13
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

The test passes when I uncomment extern crate clap.

This is a problem when code blocks in the documentation should get tested, see amethyst/amethyst#1364 (comment) for an example.

Meta

rustdoc --version --verbose:
rustdoc 1.34.0-nightly (aadbc45 2019-02-23)
binary: rustdoc
commit-hash: aadbc45
commit-date: 2019-02-23
host: x86_64-unknown-linux-gnu
release: 1.34.0-nightly
LLVM version: 8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-doctestsArea: Documentation tests, run by rustdocT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions