Skip to content
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

Compile fails on Rust 1.38 and 1.39 #35

Closed
taiki-e opened this issue Nov 19, 2020 · 1 comment · Fixed by #36
Closed

Compile fails on Rust 1.38 and 1.39 #35

taiki-e opened this issue Nov 19, 2020 · 1 comment · Fixed by #36

Comments

@taiki-e
Copy link
Contributor

taiki-e commented Nov 19, 2020

cfg(doctest) implemented in Rust 1.38 as an unstable feature, and stabilized in Rust 1.40. It compiles fine on Rust 1.37 and older, but fails on Rust 1.38 and 1.39, where this feature existed as an unstable feature.

termcolor/src/lib.rs

Lines 122 to 125 in b052b61

#[cfg(doctest)]
use doc_comment::doctest;
#[cfg(doctest)]
doctest!("../README.md");

Error:

$ cargo +1.39.0 check
    Checking termcolor v1.1.1 (/Users/taiki/projects/termcolor)
error[E0658]: `cfg(doctest)` is experimental and subject to change
   --> src/lib.rs:122:7
    |
122 | #[cfg(doctest)]
    |       ^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/62210

cc #31
Related: rust-lang/regex#685

taiki-e added a commit to taiki-e/termcolor that referenced this issue Nov 19, 2020
@taiki-e
Copy link
Contributor Author

taiki-e commented Nov 19, 2020

Filed #36 to fix this.

BurntSushi pushed a commit that referenced this issue Nov 19, 2020
Regrettably, the use of doctest fails on Rust 1.38 and Rust 1.39, but not on any
other Rust version. It works on older versions because older versions didn't
recognize the 'doctest' cfg item. But newer versions did and flagged it as a
nightly-only feature.

Fixes #35
bors bot added a commit to taiki-e/cargo-hack that referenced this issue Dec 5, 2020
102: Add --version-range option r=taiki-e a=taiki-e

Closes #93
> This may be useful for catching issues like BurntSushi/termcolor#35, rust-lang/regex#685, rayon-rs/rayon#761 (comment), rust-lang/rust-clippy#6324.

```text
--version-range <START>..[END]
    Perform commands on a specified (inclusive) range of Rust versions.

    If the given range is unclosed, the latest stable compiler is treated as the upper bound.

    Note that ranges are always inclusive ranges.

--version-step <NUM>
    Specify the version interval of --version-range.
```


Note: Ranges are always **inclusive** ranges. (`start..=end`)

```console
$ cargo hack check --version-range 1.46..1.47
info: running `cargo +1.46 check` on cargo-hack (1/2)
    Finished dev [unoptimized + debuginfo] target(s) in 0.28s
info: running `cargo +1.47 check` on cargo-hack (2/2)
    Finished dev [unoptimized + debuginfo] target(s) in 0.23s
```

If the given range is unclosed, the latest stable compiler is treated as the upper bound.

```console
$ cargo hack check --version-range 1.46..
info: running `cargo +1.46 check` on cargo-hack (1/3)
    Finished dev [unoptimized + debuginfo] target(s) in 0.28s
info: running `cargo +1.47 check` on cargo-hack (2/3)
    Finished dev [unoptimized + debuginfo] target(s) in 0.23s
info: running `cargo +1.48 check` on cargo-hack (3/3)
    Finished dev [unoptimized + debuginfo] target(s) in 0.28
```

You can also specify the version interval by using `--version-step`. (`(start..=end).step_by(step)`)

```console
$ cargo hack check --version-range 1.45.. --version-step 2
info: running `cargo +1.45 check` on cargo-hack (1/2)
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
info: running `cargo +1.47 check` on cargo-hack (2/2)
    Finished dev [unoptimized + debuginfo] target(s) in 0.25s
```

Co-authored-by: Taiki Endo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant