2019-07-26 16:54:25 -05:00
|
|
|
// run-pass
|
|
|
|
|
2018-09-17 04:18:35 -05:00
|
|
|
#![allow(unused_variables)]
|
2019-07-26 18:07:23 -05:00
|
|
|
// aux-build:lifetimes-rpass.rs
|
2018-05-13 16:01:56 -05:00
|
|
|
|
2019-07-26 18:07:23 -05:00
|
|
|
extern crate lifetimes_rpass as lifetimes;
|
2018-05-13 16:01:56 -05:00
|
|
|
use lifetimes::*;
|
|
|
|
|
|
|
|
lifetimes_bang! {
|
|
|
|
fn bang<'a>() -> &'a u8 { &0 }
|
|
|
|
}
|
|
|
|
|
|
|
|
#[lifetimes_attr]
|
|
|
|
fn attr<'a>() -> &'a u8 { &1 }
|
|
|
|
|
|
|
|
#[derive(Lifetimes)]
|
|
|
|
pub struct Lifetimes<'a> {
|
|
|
|
pub field: &'a u8,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(bang::<'static>(), &0);
|
|
|
|
assert_eq!(attr::<'static>(), &1);
|
|
|
|
let l1 = Lifetimes { field: &0 };
|
|
|
|
let l2 = m::Lifetimes { field: &1 };
|
|
|
|
}
|