2019-07-26 21:54:25 +00:00
|
|
|
//@ run-pass
|
|
|
|
|
2018-09-17 09:18:35 +00:00
|
|
|
#![allow(unused_variables)]
|
2019-07-26 23:07:23 +00:00
|
|
|
//@ aux-build:lifetimes-rpass.rs
|
2018-05-13 21:01:56 +00:00
|
|
|
|
2019-07-26 23:07:23 +00:00
|
|
|
extern crate lifetimes_rpass as lifetimes;
|
2018-05-13 21:01:56 +00: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 };
|
|
|
|
}
|