2024-10-16 19:19:56 +00:00
|
|
|
//@ check-pass
|
|
|
|
|
2020-09-21 20:32:28 +00:00
|
|
|
#![deny(temporary_cstring_as_ptr)]
|
2024-10-16 19:19:56 +00:00
|
|
|
//~^ WARNING lint `temporary_cstring_as_ptr` has been renamed to `dangling_pointers_from_temporaries`
|
2020-09-21 20:32:28 +00:00
|
|
|
|
|
|
|
use std::ffi::CString;
|
2020-10-27 14:10:30 +00:00
|
|
|
use std::os::raw::c_char;
|
2020-09-21 20:32:28 +00:00
|
|
|
|
2020-10-27 14:10:30 +00:00
|
|
|
fn some_function(data: *const c_char) {}
|
2020-09-21 20:32:28 +00:00
|
|
|
|
|
|
|
fn main() {
|
2020-10-26 23:19:06 +00:00
|
|
|
some_function(CString::new("").unwrap().as_ptr());
|
2020-09-21 20:32:28 +00:00
|
|
|
}
|