Skip to content

Commit 51fd129

Browse files
committed
Auto merge of rust-lang#86689 - rylev:future-compat-lint-group, r=nikomatsakis
Only include lint in future_incompatible lint group if not an edition lint A follow up to rust-lang#86330 - this only includes lints annotated with `FutureIncompatibleInfo` in the `future_incompatibile` lint group if the future compatibility is not tied to an edition. We probably want to rename `FutureIncompatibleInfo` to something else since this type is now used to indicate future breakages of all kinds (even those that happen in editions). I'd prefer to do that in a separate PR though. r? `@nikomatsakis`
2 parents 9af4bde + f0d7280 commit 51fd129

File tree

3 files changed

+43
-19
lines changed

3 files changed

+43
-19
lines changed

compiler/rustc_lint/src/context.rs

+13-10
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,20 @@ impl LintStore {
220220
})
221221
.lint_ids
222222
.push(id);
223+
} else {
224+
// Lints belonging to the `future_incompatible` lint group are lints where a
225+
// future version of rustc will cause existing code to stop compiling.
226+
// Lints tied to an edition don't count because they are opt-in.
227+
self.lint_groups
228+
.entry("future_incompatible")
229+
.or_insert(LintGroup {
230+
lint_ids: vec![],
231+
from_plugin: lint.is_plugin,
232+
depr: None,
233+
})
234+
.lint_ids
235+
.push(id);
223236
}
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);
234237
}
235238
}
236239
}
+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() {}
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)