2018-02-02 03:26:48 +00:00
|
|
|
// Test cases where we put various lifetime constraints on trait
|
|
|
|
// associated constants.
|
|
|
|
|
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
|
|
|
|
use std::option::Option;
|
|
|
|
|
|
|
|
trait Anything<'a: 'b, 'b> {
|
|
|
|
const AC: Option<&'b str>;
|
|
|
|
}
|
|
|
|
|
2019-03-12 22:33:27 +00:00
|
|
|
struct OKStruct1 { }
|
2018-02-02 03:26:48 +00:00
|
|
|
|
2019-03-12 22:33:27 +00:00
|
|
|
impl<'a: 'b, 'b> Anything<'a, 'b> for OKStruct1 {
|
2018-02-02 03:26:48 +00:00
|
|
|
const AC: Option<&'b str> = None;
|
|
|
|
}
|
|
|
|
|
2019-03-12 22:33:27 +00:00
|
|
|
struct FailStruct { }
|
2018-02-02 03:26:48 +00:00
|
|
|
|
2019-03-12 22:33:27 +00:00
|
|
|
impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct {
|
2018-02-02 03:26:48 +00:00
|
|
|
const AC: Option<&'c str> = None;
|
2022-07-24 19:33:26 +00:00
|
|
|
//~^ ERROR: const not compatible with trait
|
2018-02-02 03:26:48 +00:00
|
|
|
}
|
|
|
|
|
2019-03-12 22:33:27 +00:00
|
|
|
struct OKStruct2 { }
|
2018-02-02 03:26:48 +00:00
|
|
|
|
2019-03-12 22:33:27 +00:00
|
|
|
impl<'a: 'b, 'b> Anything<'a, 'b> for OKStruct2 {
|
2018-02-02 03:26:48 +00:00
|
|
|
const AC: Option<&'a str> = None;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|