2020-05-20 17:58:41 +00:00
|
|
|
#![crate_type = "lib"]
|
2018-11-30 15:53:44 +00:00
|
|
|
#![no_std]
|
|
|
|
#![feature(c_variadic)]
|
|
|
|
|
2019-03-25 21:28:03 +00:00
|
|
|
use core::ffi::{VaList, VaListImpl};
|
2018-11-30 15:53:44 +00:00
|
|
|
|
2019-03-25 21:28:03 +00:00
|
|
|
pub unsafe extern "C" fn no_escape0<'f>(_: usize, ap: ...) -> VaListImpl<'f> {
|
2020-05-20 17:58:41 +00:00
|
|
|
ap
|
|
|
|
//~^ ERROR: lifetime may not live long enough
|
|
|
|
//~| ERROR: lifetime may not live long enough
|
2018-11-30 15:53:44 +00:00
|
|
|
}
|
|
|
|
|
2019-03-25 21:28:03 +00:00
|
|
|
pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaListImpl<'static> {
|
2020-05-20 17:58:41 +00:00
|
|
|
ap //~ ERROR: lifetime may not live long enough
|
2018-11-30 15:53:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub unsafe extern "C" fn no_escape2(_: usize, ap: ...) {
|
2020-05-20 17:58:41 +00:00
|
|
|
let _ = ap.with_copy(|ap| ap); //~ ERROR: lifetime may not live long enough
|
2018-11-30 15:53:44 +00:00
|
|
|
}
|
|
|
|
|
2019-03-25 21:28:03 +00:00
|
|
|
pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
|
2020-05-20 17:58:41 +00:00
|
|
|
*ap0 = ap1;
|
|
|
|
//~^ ERROR: lifetime may not live long enough
|
|
|
|
//~| ERROR: lifetime may not live long enough
|
2018-11-30 15:53:44 +00:00
|
|
|
}
|
|
|
|
|
2020-05-20 17:58:41 +00:00
|
|
|
pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
|
2018-11-30 15:53:44 +00:00
|
|
|
ap0 = &mut ap1;
|
2020-05-20 17:58:41 +00:00
|
|
|
//~^ ERROR: `ap1` does not live long enough
|
|
|
|
//~| ERROR: lifetime may not live long enough
|
|
|
|
//~| ERROR: lifetime may not live long enough
|
2018-11-30 15:53:44 +00:00
|
|
|
}
|
2019-03-25 21:28:03 +00:00
|
|
|
|
|
|
|
pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
|
2020-05-20 17:58:41 +00:00
|
|
|
*ap0 = ap1.clone();
|
|
|
|
//~^ ERROR: lifetime may not live long enough
|
|
|
|
//~| ERROR: lifetime may not live long enough
|
2019-03-25 21:28:03 +00:00
|
|
|
}
|