Skip to content

Commit f5b423f

Browse files
committed
Auto merge of #153736 - cyrgani:incomplete-2, r=fmease
add test that an incomplete feature emits a warning Related to rust-lang/compiler-team#974, this PR adds a new test to specifically check that a dummy incomplete feature triggers the `incomplete_features` lint. (since this seemed to be the favored approach on Zulip) Alternative to #153706. r? fmease
2 parents d1ee5e5 + c909ae5 commit f5b423f

4 files changed

Lines changed: 30 additions & 0 deletions

File tree

compiler/rustc_feature/src/unstable.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ declare_features! (
257257
(internal, rustc_attrs, "1.0.0", None),
258258
/// Allows using the `#[stable]` and `#[unstable]` attributes.
259259
(internal, staged_api, "1.0.0", None),
260+
/// Perma-unstable, only used to test the `incomplete_features` lint.
261+
(incomplete, test_incomplete_feature, "CURRENT_RUSTC_VERSION", None),
260262
/// Added for testing unstable lints; perma-unstable.
261263
(internal, test_unstable_lint, "1.60.0", None),
262264
/// Use for stable + negative coherence and strict coherence depending on trait's

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,7 @@ symbols! {
20062006
test_2018_feature,
20072007
test_accepted_feature,
20082008
test_case,
2009+
test_incomplete_feature,
20092010
test_removed_feature,
20102011
test_runner,
20112012
test_unstable_lint,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//! Make sure that incomplete features emit the `incomplete_features` lint.
2+
3+
// gate-test-test_incomplete_feature
4+
5+
//@ check-pass
6+
//@ revisions: warn expect
7+
8+
#![cfg_attr(warn, warn(incomplete_features))]
9+
#![cfg_attr(expect, expect(incomplete_features))]
10+
11+
#![feature(test_incomplete_feature)] //[warn]~ WARN the feature `test_incomplete_feature` is incomplete
12+
13+
fn main() {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
warning: the feature `test_incomplete_feature` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/incomplete-features.rs:11:12
3+
|
4+
LL | #![feature(test_incomplete_feature)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/incomplete-features.rs:8:24
9+
|
10+
LL | #![cfg_attr(warn, warn(incomplete_features))]
11+
| ^^^^^^^^^^^^^^^^^^^
12+
13+
warning: 1 warning emitted
14+

0 commit comments

Comments
 (0)