Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ declare_features! (
(internal, rustc_attrs, "1.0.0", None),
/// Allows using the `#[stable]` and `#[unstable]` attributes.
(internal, staged_api, "1.0.0", None),
/// Perma-unstable, only used to test the `incomplete_features` lint.
(incomplete, test_incomplete_feature, "CURRENT_RUSTC_VERSION", None),
/// Added for testing unstable lints; perma-unstable.
(internal, test_unstable_lint, "1.60.0", None),
/// Use for stable + negative coherence and strict coherence depending on trait's
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2005,6 +2005,7 @@ symbols! {
test_2018_feature,
test_accepted_feature,
test_case,
test_incomplete_feature,
test_removed_feature,
test_runner,
test_unstable_lint,
Expand Down
13 changes: 13 additions & 0 deletions tests/ui/feature-gates/incomplete-features.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//! Make sure that incomplete features emit the `incomplete_features` lint.

// gate-test-test_incomplete_feature
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is obviously not your usual feature gate test (where #[feature] is absent) but that's fine since there's no real alternative.


//@ check-pass
//@ revisions: warn expect

#![cfg_attr(warn, warn(incomplete_features))]
#![cfg_attr(expect, expect(incomplete_features))]

#![feature(test_incomplete_feature)] //[warn]~ WARN the feature `test_incomplete_feature` is incomplete

fn main() {}
14 changes: 14 additions & 0 deletions tests/ui/feature-gates/incomplete-features.warn.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
warning: the feature `test_incomplete_feature` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/incomplete-features.rs:11:12
|
LL | #![feature(test_incomplete_feature)]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/incomplete-features.rs:8:24
|
LL | #![cfg_attr(warn, warn(incomplete_features))]
| ^^^^^^^^^^^^^^^^^^^

warning: 1 warning emitted

Loading