about summary refs log tree commit diff
path: root/tests/ui/traits/const-traits/syntactical-unstable.rs
blob: 5c542d327f1514eee7645537c0c35a9efefc9cb3 (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
//@ aux-build:staged-api.rs

// Ensure that we enforce const stability of traits in `[const]`/`const` bounds.

#![feature(const_trait_impl)]

use std::ops::Deref;

extern crate staged_api;
use staged_api::MyTrait;

#[const_trait]
trait Foo: [const] MyTrait {
    //~^ ERROR use of unstable const library feature `unstable`
    type Item: [const] MyTrait;
    //~^ ERROR use of unstable const library feature `unstable`
}

const fn where_clause<T>() where T: [const] MyTrait {}
//~^ ERROR use of unstable const library feature `unstable`

const fn nested<T>() where T: Deref<Target: [const] MyTrait> {}
//~^ ERROR use of unstable const library feature `unstable`

const fn rpit() -> impl [const] MyTrait { Local }
//~^ ERROR use of unstable const library feature `unstable`

struct Local;
impl const MyTrait for Local {
//~^ ERROR use of unstable const library feature `unstable`
    fn func() {}
}

fn main() {}