about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/unstable-feature-bound/unstable_feature_bound_incompatible_stability.rs14
-rw-r--r--tests/ui/unstable-feature-bound/unstable_feature_bound_incompatible_stability.stderr10
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/unstable-feature-bound/unstable_feature_bound_incompatible_stability.rs b/tests/ui/unstable-feature-bound/unstable_feature_bound_incompatible_stability.rs
new file mode 100644
index 00000000000..1a9652c1023
--- /dev/null
+++ b/tests/ui/unstable-feature-bound/unstable_feature_bound_incompatible_stability.rs
@@ -0,0 +1,14 @@
+#![allow(internal_features)]
+#![feature(staged_api)]
+#![allow(dead_code)]
+#![stable(feature = "a", since = "1.1.1" )]
+
+// Lint against the usage of both #[unstable_feature_bound] and #[stable] on the
+// same item.
+
+#[stable(feature = "a", since = "1.1.1")]
+#[unstable_feature_bound(feat_bar)]
+fn bar() {}
+//~^ ERROR Item annotated with `#[unstable_feature_bound]` should not be stable
+
+fn main() {}
diff --git a/tests/ui/unstable-feature-bound/unstable_feature_bound_incompatible_stability.stderr b/tests/ui/unstable-feature-bound/unstable_feature_bound_incompatible_stability.stderr
new file mode 100644
index 00000000000..9cb6a181bef
--- /dev/null
+++ b/tests/ui/unstable-feature-bound/unstable_feature_bound_incompatible_stability.stderr
@@ -0,0 +1,10 @@
+error: Item annotated with `#[unstable_feature_bound]` should not be stable
+  --> $DIR/unstable_feature_bound_incompatible_stability.rs:11:1
+   |
+LL | fn bar() {}
+   | ^^^^^^^^^^^
+   |
+   = help: If this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`
+
+error: aborting due to 1 previous error
+