Skip to content

Commit 1abe42d

Browse files
committed
Add test for multiple unstable_feature_bound attr
1 parent b0d03a7 commit 1abe42d

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#![allow(internal_features)]
2+
#![feature(staged_api)]
3+
#![allow(dead_code)]
4+
#![unstable(feature = "feat_bar", issue = "none" )]
5+
6+
7+
/// Test the behaviour of multiple unstable_feature_bound attribute.
8+
9+
trait Foo {
10+
fn foo();
11+
}
12+
struct Bar;
13+
14+
#[unstable_feature_bound(feat_bar, feat_koo)]
15+
#[unstable_feature_bound(feat_foo, feat_moo)]
16+
impl Foo for Bar {
17+
fn foo(){}
18+
}
19+
20+
#[unstable_feature_bound(feat_bar, feat_koo)]
21+
#[unstable_feature_bound(feat_foo, feat_moo)]
22+
fn moo() {
23+
Bar::foo();
24+
}
25+
26+
#[unstable_feature_bound(feat_bar, feat_koo, feat_foo, feat_moo)]
27+
fn koo() {
28+
Bar::foo();
29+
}
30+
31+
#[unstable_feature_bound(feat_koo, feat_foo, feat_moo)]
32+
fn boo() {
33+
Bar::foo();
34+
//~^ ERROR: type annotations needed: cannot satisfy `unstable feature: `feat_bar``
35+
}
36+
37+
fn main() {}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error[E0284]: type annotations needed: cannot satisfy `unstable feature: `feat_bar``
2+
--> $DIR/unstable_feature_bound_multi_attr.rs:33:5
3+
|
4+
LL | Bar::foo();
5+
| ^^^ cannot satisfy `unstable feature: `feat_bar``
6+
|
7+
note: required for `Bar` to implement `Foo`
8+
--> $DIR/unstable_feature_bound_multi_attr.rs:16:6
9+
|
10+
LL | #[unstable_feature_bound(feat_bar, feat_koo)]
11+
| --------------------------------------------- unsatisfied trait bound introduced here
12+
LL | #[unstable_feature_bound(feat_foo, feat_moo)]
13+
LL | impl Foo for Bar {
14+
| ^^^ ^^^
15+
16+
error: aborting due to 1 previous error
17+
18+
For more information about this error, try `rustc --explain E0284`.

0 commit comments

Comments
 (0)