blob: 57e64737d0faa53ae4f203234006c37f9761ab9b (
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
|
#![feature(staged_api)]
#![feature(const_trait_impl)]
#![stable(feature = "stable", since = "1.0.0")]
#[stable(feature = "stable", since = "1.0.0")]
pub const fn foo() {} //~ ERROR function has missing const stability attribute
#[unstable(feature = "unstable", issue = "none")]
pub const fn bar() {} // ok because function is unstable
#[stable(feature = "stable", since = "1.0.0")]
pub struct Foo;
impl Foo {
#[stable(feature = "stable", since = "1.0.0")]
pub const fn foo() {} //~ ERROR associated function has missing const stability attribute
#[unstable(feature = "unstable", issue = "none")]
pub const fn bar() {} // ok because function is unstable
}
// FIXME Once #![feature(const_trait_impl)] is allowed to be stable, add a test
// for const trait impls. Right now, a "trait methods cannot be stable const fn"
// error is emitted. This occurs prior to the lint being tested here, such that
// the lint cannot currently be tested on this use case.
fn main() {}
|