Skip to content

Commit 0e28575

Browse files
committed
Only include lint in future_incompatible lint group if not an edition lint
1 parent 451e98e commit 0e28575

File tree

3 files changed

+40
-19
lines changed

3 files changed

+40
-19
lines changed

Diff for: compiler/rustc_lint/src/context.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,17 @@ impl LintStore {
220220
})
221221
.lint_ids
222222
.push(id);
223+
} else {
224+
self.lint_groups
225+
.entry("future_incompatible")
226+
.or_insert(LintGroup {
227+
lint_ids: vec![],
228+
from_plugin: lint.is_plugin,
229+
depr: None,
230+
})
231+
.lint_ids
232+
.push(id);
223233
}
224-
225-
self.lint_groups
226-
.entry("future_incompatible")
227-
.or_insert(LintGroup {
228-
lint_ids: vec![],
229-
from_plugin: lint.is_plugin,
230-
depr: None,
231-
})
232-
.lint_ids
233-
.push(id);
234234
}
235235
}
236236
}

Diff for: src/test/ui/future-incompatible-lint-group.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
// Ensure that the future_incompatible lint group only includes
2+
// lints for changes that are not tied to an edition
13
#![deny(future_incompatible)]
24

35
trait Tr {
4-
fn f(u8) {} //~ ERROR anonymous parameters are deprecated
5-
//~^ WARN this is accepted in the current edition
6+
// Warn only since this is not a `future_incompatible` lint
7+
fn f(u8) {} //~ WARN anonymous parameters are deprecated
8+
//~| WARN this is accepted in the current edition
9+
}
10+
11+
pub mod submodule {
12+
// Error since this is a `future_incompatible` lint
13+
#![doc(test(some_test))]
14+
//~^ ERROR this attribute can only be applied at the crate level
15+
//~| WARN this was previously accepted by the compiler
616
}
717

818
fn main() {}

Diff for: src/test/ui/future-incompatible-lint-group.stderr

+18-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
error: anonymous parameters are deprecated and will be removed in the next edition.
2-
--> $DIR/future-incompatible-lint-group.rs:4:10
1+
warning: anonymous parameters are deprecated and will be removed in the next edition.
2+
--> $DIR/future-incompatible-lint-group.rs:7:10
33
|
44
LL | fn f(u8) {}
55
| ^^ help: try naming the parameter or explicitly ignoring it: `_: u8`
66
|
7+
= note: `#[warn(anonymous_parameters)]` on by default
8+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
9+
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
10+
11+
error: this attribute can only be applied at the crate level
12+
--> $DIR/future-incompatible-lint-group.rs:13:12
13+
|
14+
LL | #![doc(test(some_test))]
15+
| ^^^^^^^^^^^^^^^
16+
|
717
note: the lint level is defined here
8-
--> $DIR/future-incompatible-lint-group.rs:1:9
18+
--> $DIR/future-incompatible-lint-group.rs:3:9
919
|
1020
LL | #![deny(future_incompatible)]
1121
| ^^^^^^^^^^^^^^^^^^^
12-
= note: `#[deny(anonymous_parameters)]` implied by `#[deny(future_incompatible)]`
13-
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
14-
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
22+
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(future_incompatible)]`
23+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
24+
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
25+
= note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level for more information
1526

16-
error: aborting due to previous error
27+
error: aborting due to previous error; 1 warning emitted
1728

0 commit comments

Comments
 (0)