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

strange rust_2018_idioms warning on code comment in clippy codebase #51881

Open
Tracked by #54910
matthiaskrgr opened this issue Jun 28, 2018 · 5 comments
Open
Tracked by #54910
Labels
A-edition-2018-lints Area: lints supporting the 2018 edition A-rust-2018-preview Area: The 2018 edition preview C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jun 28, 2018

git clone http://github.com/rust-lang-nursery/rust-clippy/
cd rust-clippy
git checkout 656b26ea4f2b330ea5b9cb3cb38545587eac8f7f
cargo check --all-targets --all-features 

=>

....
warning: `extern crate` is not idiomatic in the new edition
 --> src/lib.rs:1:1
  |
1 | // error-pattern:cargo-clippy
  | ^ help: convert it to a `use`
  |
note: lint level defined here
 --> src/lib.rs:8:9
  |
8 | #![warn(rust_2018_idioms)]
  |         ^^^^^^^^^^^^^^^^
  = note: #[warn(unused_extern_crates)] implied by #[warn(rust_2018_idioms)]

this is confusing because the highlighted line is a code comment and seems unrelated to the extern crate keyword.

rustc 1.28.0-nightly (cd494c1 2018-06-27)

link to file: https://github.com/rust-lang-nursery/rust-clippy/blob/656b26ea4f2b330ea5b9cb3cb38545587eac8f7f/src/lib.rs

@oli-obk
Copy link
Contributor

oli-obk commented Jun 29, 2018

I'd assume this is the 2015 prelude's extern crate std; item.

@oli-obk oli-obk added the A-rust-2018-preview Area: The 2018 edition preview label Jun 29, 2018
@najamelan
Copy link
Contributor

I get this warning consistently from RLS-preview in crates that don't have extern crate. I have edition = 2018 in cargo.toml. I do not get this warning when compiling from the command line with cargo build.

@Mark-Simulacrum Mark-Simulacrum added this to the Rust 2018 Release milestone Jul 24, 2018
@Mark-Simulacrum
Copy link
Member

cc @nrc for the change between RLS and CLI behavior

@nikomatsakis nikomatsakis added the A-edition-2018-lints Area: lints supporting the 2018 edition label Nov 13, 2018
@nikomatsakis
Copy link
Contributor

Removing from the release milestone, as functional Idiom Lints are not part of our Rust 2018 release goals. But we oughta' fix this =)

@Enselic
Copy link
Member

Enselic commented Nov 18, 2023

Triage: The reproducer does not work any longer with Rust 1.74, but I get a bunch of other errors, so hard to say if the reported problem has been fixed. Here is the current output:

Click to expand
$ cargo check --all-targets --all-features
warning: the cargo feature `edition` has been stabilized in the 1.31 release and is no longer necessary to be listed in the manifest
  See https://doc.rust-lang.org/cargo/reference/manifest.html#the-edition-field for more information about using this feature.
    Updating crates.io index
   Compiling proc-macro2 v1.0.69
   Compiling unicode-ident v1.0.12
   Compiling libc v0.2.150
   Compiling serde v1.0.192
    Checking memchr v2.6.4
   Compiling serde_json v1.0.108
    Checking gimli v0.28.0
    Checking adler v1.0.2
    Checking cfg-if v1.0.0
   Compiling semver-parser v0.7.0
    Checking rustc-demangle v0.1.23
   Compiling pulldown-cmark v0.1.2
    Checking ryu v1.0.15
    Checking itoa v1.0.9
   Compiling syn v1.0.109
    Checking tinyvec_macros v0.1.1
    Checking unicode-width v0.1.11
    Checking unicode-bidi v0.3.13
    Checking matches v0.1.10
   Compiling ansi_term v0.11.0
    Checking regex-syntax v0.8.2
   Compiling unicode-xid v0.2.4
    Checking percent-encoding v1.0.1
    Checking tinyvec v1.6.0
   Compiling failure_derive v0.1.8
    Checking miniz_oxide v0.7.1
    Checking either v1.9.0
    Checking bitflags v0.9.1
    Checking getopts v0.2.21
    Checking itertools v0.7.11
    Checking cfg-if v0.1.10
    Checking if_chain v0.1.3
    Checking lazy_static v1.4.0
    Checking regex-syntax v0.6.29
    Checking quine-mc_cluskey v0.2.4
    Checking log v0.4.20
   Compiling compiletest_rs v0.3.26
    Checking diff v0.1.13
   Compiling clippy-mini-macro-test v0.2.0 (/home/martin/src/rust-clippy/mini-macro)
error[E0557]: feature has been removed
 --> mini-macro/src/lib.rs:1:24
  |
1 | #![feature(proc_macro, proc_macro_non_items)]
  |                        ^^^^^^^^^^^^^^^^^^^^ feature has been removed
  |
  = note: subsumed by `#![feature(proc_macro_hygiene)]`

error[E0658]: use of unstable library feature 'proc_macro_quote'
 --> mini-macro/src/lib.rs:8:5
  |
8 |     quote!(
  |     ^^^^^
  |
  = note: see issue #54722 <https://github.com/rust-lang/rust/issues/54722> for more information

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> mini-macro/src/lib.rs:1:1
  |
1 | #![feature(proc_macro, proc_macro_non_items)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: the feature `proc_macro` has been stable since `1.29.0` and no longer requires an attribute to enable

error[E0658]: use of unstable library feature 'proc_macro_quote'
 --> mini-macro/src/lib.rs:4:31
  |
4 | use proc_macro::{TokenStream, quote};
  |                               ^^^^^
  |
  = note: see issue #54722 <https://github.com/rust-lang/rust/issues/54722> for more information

warning: the feature `proc_macro` has been stable since 1.29.0 and no longer requires an attribute to enable
 --> mini-macro/src/lib.rs:1:12
  |
1 | #![feature(proc_macro, proc_macro_non_items)]
  |            ^^^^^^^^^^
  |
  = note: `#[warn(stable_features)]` on by default

Some errors have detailed explanations: E0554, E0557, E0658.
For more information about an error, try `rustc --explain E0554`.
warning: `clippy-mini-macro-test` (lib) generated 1 warning
error: could not compile `clippy-mini-macro-test` (lib) due to 4 previous errors; 1 warning emitted
warning: build failed, waiting for other jobs to finish...

@Enselic Enselic added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2018-lints Area: lints supporting the 2018 edition A-rust-2018-preview Area: The 2018 edition preview C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants