add test that an incomplete feature emits a warning

This commit is contained in:
cyrgani
2026-03-11 18:26:49 +00:00
parent 0c68443b0a
commit c909ae5a35
4 changed files with 30 additions and 0 deletions
+2
View File
@@ -257,6 +257,8 @@ pub fn internal(&self, feature: Symbol) -> bool {
(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
+1
View File
@@ -2005,6 +2005,7 @@
test_2018_feature,
test_accepted_feature,
test_case,
test_incomplete_feature,
test_removed_feature,
test_runner,
test_unstable_lint,
@@ -0,0 +1,13 @@
//! Make sure that incomplete features emit the `incomplete_features` lint.
// gate-test-test_incomplete_feature
//@ 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() {}
@@ -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