about summary refs log tree commit diff
path: root/tests/ui/unstable-feature-bound/unstable-feature-bound-no-effect.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/unstable-feature-bound/unstable-feature-bound-no-effect.rs')
-rw-r--r--tests/ui/unstable-feature-bound/unstable-feature-bound-no-effect.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/ui/unstable-feature-bound/unstable-feature-bound-no-effect.rs b/tests/ui/unstable-feature-bound/unstable-feature-bound-no-effect.rs
new file mode 100644
index 00000000000..99501893ae0
--- /dev/null
+++ b/tests/ui/unstable-feature-bound/unstable-feature-bound-no-effect.rs
@@ -0,0 +1,35 @@
+#![allow(internal_features)]
+#![feature(staged_api)]
+#![allow(dead_code)]
+#![stable(feature = "a", since = "1.1.1" )]
+
+/// If #[unstable(..)] and #[unstable_feature_name(..)] have the same feature name,
+/// the error should not be thrown as it can effectively mark an impl as unstable.
+///
+/// If the feature name in #[feature] does not exist in #[unstable_feature_bound(..)]
+/// an error should still be thrown because that feature will not be unstable.
+
+#[stable(feature = "a", since = "1.1.1")]
+trait Moo {}
+#[stable(feature = "a", since = "1.1.1")]
+trait Foo {}
+#[stable(feature = "a", since = "1.1.1")]
+trait Boo {}
+#[stable(feature = "a", since = "1.1.1")]
+pub struct Bar;
+
+
+#[unstable(feature = "feat_moo", issue = "none")]
+#[unstable_feature_bound(feat_foo)] //~^ ERROR: an `#[unstable]` annotation here has no effect
+impl Moo for Bar {}
+
+#[unstable(feature = "feat_foo", issue = "none")]
+#[unstable_feature_bound(feat_foo)]
+impl Foo for Bar {}
+
+
+#[unstable(feature = "feat_foo", issue = "none")]
+#[unstable_feature_bound(feat_foo, feat_bar)]
+impl Boo for Bar {}
+
+fn main() {}