rust/tests/ui/lint/lint-temporary-cstring-as-p...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
263 B
Rust
Raw Normal View History

2020-09-22 04:32:28 +08:00
#![deny(temporary_cstring_as_ptr)]
use std::ffi::CString;
2020-10-27 22:10:30 +08:00
use std::os::raw::c_char;
2020-09-22 04:32:28 +08:00
2020-10-27 22:10:30 +08:00
fn some_function(data: *const c_char) {}
2020-09-22 04:32:28 +08:00
fn main() {
2020-10-27 07:19:06 +08:00
some_function(CString::new("").unwrap().as_ptr());
//~^ ERROR getting the inner pointer of a temporary `CString`
2020-09-22 04:32:28 +08:00
}