about summary refs log tree commit diff
path: root/tests/ui/unstable-feature-bound/unstable_feature_bound_free_fn.rs
blob: 30e2ab3d65ef257c1c542c575c55e1d1a610efeb (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
34
35
36
37
38
39
40
//@ revisions: pass fail
//@[pass] check-pass

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

/// When a free function with #[unstable_feature_bound(feat_bar)] is called by another
/// free function, that function should be annotated with
/// #[unstable_feature_bound(feat_bar)] too.

#[stable(feature = "a", since = "1.1.1")]
trait Foo {
    #[stable(feature = "a", since = "1.1.1")]
    fn foo() {
    }
}
#[stable(feature = "a", since = "1.1.1")]
pub struct Bar;

#[unstable_feature_bound(feat_bar)]
#[unstable(feature = "feat_bar", issue = "none" )]
impl Foo for Bar {
    fn foo() {}
}


#[unstable_feature_bound(feat_bar)]
fn bar() {
    Bar::foo();
}

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

fn main() {}