2019-07-27 00:54:25 +03:00
|
|
|
//@ run-pass
|
|
|
|
|
|
2018-09-17 11:18:35 +02:00
|
|
|
#![allow(unused_variables)]
|
2024-11-24 17:37:25 -08:00
|
|
|
//@ proc-macro: lifetimes-rpass.rs
|
2025-09-26 13:59:06 +02:00
|
|
|
//@ ignore-backends: gcc
|
2018-05-14 00:01:56 +03:00
|
|
|
|
2019-07-27 02:07:23 +03:00
|
|
|
extern crate lifetimes_rpass as lifetimes;
|
2018-05-14 00:01:56 +03: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 };
|
|
|
|
|
}
|