about summary refs log tree commit diff
path: root/tests/ui/unstable-feature-bound/unstable_feature_bound_on_trait.rs
blob: 0ee00d5e7fb3f36ae5bc6c0acccaab8c34458db3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//@ revisions: pass fail
//@[pass] check-pass

#![allow(internal_features)]
#![feature(staged_api)]
#![stable(feature = "a", since = "1.1.1" )]

/// Test the behaviour of marking a trait with #[unstable_feature_bound].
/// In this testcase, even though the trait method `bar` and the `struct Foo` are
/// both stable, #[unstable_feature_bound] is still needed at the call site of Foo::bar().

#[stable(feature = "a", since = "1.1.1" )]
struct Foo;

#[unstable(feature = "foo", issue = "none" )]
#[unstable_feature_bound(foo)]
trait Bar {
    #[stable(feature = "a", since = "1.1.1" )]
    fn bar() {}
}

#[unstable_feature_bound(foo)]
impl Bar for Foo {
}

#[cfg_attr(pass, unstable_feature_bound(foo))]
fn moo() {
    Foo::bar();
    //[fail]~^ ERROR: unstable feature `foo` is used without being enabled.
}


fn main() {}