]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/trait-associated-constant.rs
Rollup merge of #103146 - joboet:cleanup_pthread_condvar, r=Mark-Simulacrum
[rust.git] / src / test / ui / nll / trait-associated-constant.rs
1 // Test cases where we put various lifetime constraints on trait
2 // associated constants.
3
4 #![feature(rustc_attrs)]
5
6 use std::option::Option;
7
8 trait Anything<'a: 'b, 'b> {
9     const AC: Option<&'b str>;
10 }
11
12 struct OKStruct1 { }
13
14 impl<'a: 'b, 'b> Anything<'a, 'b> for OKStruct1 {
15     const AC: Option<&'b str> = None;
16 }
17
18 struct FailStruct { }
19
20 impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct {
21     const AC: Option<&'c str> = None;
22     //~^ ERROR: const not compatible with trait
23 }
24
25 struct OKStruct2 { }
26
27 impl<'a: 'b, 'b> Anything<'a, 'b> for OKStruct2 {
28     const AC: Option<&'a str> = None;
29 }
30
31 fn main() {}