about summary refs log tree commit diff
path: root/tests/ui/unstable-feature-bound/unstable-impl-cannot-use-feature.rs
blob: 0da618445fd21e225d19717236e533e48d6a6d30 (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
//@ revisions: pass fail
//@[pass] check-pass

#![allow(internal_features)]
#![feature(staged_api)]
#![allow(dead_code)]
#![unstable(feature = "feat_foo", issue = "none" )]

#![cfg_attr(fail, feature(feat_foo))]

/// In staged-api crate, using an unstable impl requires
/// #[unstable_feature_bound(..)], not  #[feature(..)].

pub trait Foo {
    fn foo();
}
pub struct Bar;

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

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

fn main() {}