Skip to content

Commit 110b71a

Browse files
authored
Rollup merge of rust-lang#52926 - alexcrichton:trim-idioms-lints, r=oli-obk
rustc: Trim down the `rust_2018_idioms` lint group These migration lints aren't all up to par in terms of a good migration experience. Some, like `unreachable_pub`, hit bugs like rust-lang#52665 and unprepared macros to be handled enough of the time. Others like linting against `#[macro_use]` are swimming upstream in an ecosystem that's not quite ready (and slightly buggy pending a few current PRs). The general idea is that we will continue to recommend the `rust_2018_idioms` lint group as part of the transition guide (as an optional step) but we'll be much more selective about which lints make it into this group. Only those with a strong track record of not causing too much churn will make the cut. cc rust-lang#52679
2 parents b40b899 + 27b3cb5 commit 110b71a

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

src/librustc_lint/lib.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ use rustc::lint::{LateContext, LateLintPass, LintPass, LintArray};
4545
use rustc::lint::builtin::{
4646
BARE_TRAIT_OBJECTS,
4747
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
48-
MACRO_USE_EXTERN_CRATE,
4948
ELIDED_LIFETIMES_IN_PATHS,
5049
parser::QUESTION_MARK_MACRO_SEP
5150
};
@@ -195,11 +194,18 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
195194
add_lint_group!(sess,
196195
"rust_2018_idioms",
197196
BARE_TRAIT_OBJECTS,
198-
UNREACHABLE_PUB,
199197
UNUSED_EXTERN_CRATES,
200-
MACRO_USE_EXTERN_CRATE,
201-
ELIDED_LIFETIMES_IN_PATHS,
202-
ELLIPSIS_INCLUSIVE_RANGE_PATTERNS);
198+
ELLIPSIS_INCLUSIVE_RANGE_PATTERNS,
199+
ELIDED_LIFETIMES_IN_PATHS
200+
201+
// FIXME(#52665, #47816) not always applicable and not all
202+
// macros are ready for this yet.
203+
// UNREACHABLE_PUB,
204+
205+
// FIXME macro crates are not up for this yet, too much
206+
// breakage is seen if we try to encourage this lint.
207+
// MACRO_USE_EXTERN_CRATE,
208+
);
203209

204210
// Guidelines for creating a future incompatibility lint:
205211
//

src/test/ui/rust-2018/macro-use-warned-against.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// aux-build:macro-use-warned-against2.rs
1313
// compile-pass
1414

15-
#![warn(rust_2018_idioms, unused)]
15+
#![warn(macro_use_extern_crate, unused)]
1616
#![feature(use_extern_macros)]
1717

1818
#[macro_use] //~ WARN should be replaced at use sites with a `use` statement

src/test/ui/rust-2018/macro-use-warned-against.stderr

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ LL | #[macro_use] //~ WARN should be replaced at use sites with a `use` statemen
77
note: lint level defined here
88
--> $DIR/macro-use-warned-against.rs:15:9
99
|
10-
LL | #![warn(rust_2018_idioms, unused)]
11-
| ^^^^^^^^^^^^^^^^
12-
= note: #[warn(macro_use_extern_crate)] implied by #[warn(rust_2018_idioms)]
10+
LL | #![warn(macro_use_extern_crate, unused)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^
1312

1413
warning: unused `#[macro_use]` import
1514
--> $DIR/macro-use-warned-against.rs:20:1
@@ -18,9 +17,9 @@ LL | #[macro_use] //~ WARN unused `#[macro_use]`
1817
| ^^^^^^^^^^^^
1918
|
2019
note: lint level defined here
21-
--> $DIR/macro-use-warned-against.rs:15:27
20+
--> $DIR/macro-use-warned-against.rs:15:33
2221
|
23-
LL | #![warn(rust_2018_idioms, unused)]
24-
| ^^^^^^
22+
LL | #![warn(macro_use_extern_crate, unused)]
23+
| ^^^^^^
2524
= note: #[warn(unused_imports)] implied by #[warn(unused)]
2625

0 commit comments

Comments
 (0)