Rollup merge of #132983 - Anthony-Eid:dangling-pointers-lint, r=Urgau
Edit dangling pointers Closes: #132283
This commit is contained in:
commit
9206ba535c
10 changed files with 86 additions and 2 deletions
|
@ -209,7 +209,9 @@ lint_dangling_pointers_from_temporaries = a dangling pointer will be produced be
|
|||
.label_ptr = this pointer will immediately be invalid
|
||||
.label_temporary = this `{$ty}` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
.note = pointers do not have a lifetime; when calling `{$callee}` the `{$ty}` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
.help = for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
.help_bind = you must make sure that the variable you bind the `{$ty}` to lives at least as long as the pointer returned by the call to `{$callee}`
|
||||
.help_returned = in particular, if this pointer is returned from the current function, binding the `{$ty}` inside the function will not suffice
|
||||
.help_visit = for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
lint_default_hash_types = prefer `{$preferred}` over `{$used}`, it has better performance
|
||||
.note = a `use rustc_data_structures::fx::{$preferred}` may be necessary
|
||||
|
|
|
@ -1139,7 +1139,9 @@ pub(crate) struct IgnoredUnlessCrateSpecified<'a> {
|
|||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_dangling_pointers_from_temporaries)]
|
||||
#[note]
|
||||
#[help]
|
||||
#[help(lint_help_bind)]
|
||||
#[help(lint_help_returned)]
|
||||
#[help(lint_help_visit)]
|
||||
// FIXME: put #[primary_span] on `ptr_span` once it does not cause conflicts
|
||||
pub(crate) struct DanglingPointersFromTemporaries<'tcx> {
|
||||
pub callee: Symbol,
|
||||
|
|
|
@ -7,6 +7,8 @@ LL | dbg!(String::new().as_ptr());
|
|||
| this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/allow.rs:7:12
|
||||
|
@ -23,6 +25,8 @@ LL | dbg!(String::new().as_ptr());
|
|||
| this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/allow.rs:18:12
|
||||
|
|
|
@ -7,6 +7,8 @@ LL | let ptr = cstring().as_ptr();
|
|||
| this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `CString` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `CString` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/calls.rs:1:9
|
||||
|
@ -23,6 +25,8 @@ LL | let ptr = cstring().as_ptr();
|
|||
| this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `CString` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `CString` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `CString` will be dropped
|
||||
|
@ -34,6 +38,8 @@ LL | let _ptr: *const u8 = cstring().as_ptr().cast();
|
|||
| this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `CString` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `CString` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `CString` will be dropped
|
||||
|
@ -45,6 +51,8 @@ LL | let _ptr: *const u8 = { cstring() }.as_ptr().cast();
|
|||
| this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `CString` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `CString` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `CString` will be dropped
|
||||
|
@ -56,6 +64,8 @@ LL | let _ptr: *const u8 = { cstring().as_ptr() }.cast();
|
|||
| this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `CString` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `CString` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
|
|
@ -15,6 +15,8 @@ LL | let s = CString::new("some text").unwrap().as_ptr();
|
|||
| this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `CString` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `CString` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/cstring-as-ptr.rs:2:9
|
||||
|
@ -34,6 +36,8 @@ LL | mymacro!();
|
|||
| ---------- in this macro invocation
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `CString` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `CString` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
= note: this error originates in the macro `mymacro` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ LL | let str1 = String::with_capacity(MAX_PATH).as_mut_ptr();
|
|||
| this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_mut_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_mut_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/example-from-issue123613.rs:1:9
|
||||
|
@ -23,6 +25,8 @@ LL | let str2 = String::from("TotototototototototototototototototoT").as_ptr
|
|||
| this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
@ -7,6 +7,8 @@ LL | let _ptr1 = Vec::<u32>::new().as_ptr().dbg();
|
|||
| this `Vec<u32>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<u32>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Vec<u32>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Vec<u32>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/ext.rs:1:9
|
||||
|
@ -23,6 +25,8 @@ LL | let _ptr2 = vec![0].as_ptr().foo();
|
|||
| this `Vec<u32>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<u32>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Vec<u32>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Vec<u32>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
@ -7,6 +7,8 @@ LL | vec![0u8].as_ptr();
|
|||
| this `Vec<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Vec<u8>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Vec<u8>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/methods.rs:1:9
|
||||
|
@ -23,6 +25,8 @@ LL | vec![0u8].as_mut_ptr();
|
|||
| this `Vec<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_mut_ptr` the `Vec<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Vec<u8>` to lives at least as long as the pointer returned by the call to `as_mut_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Vec<u8>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
@ -7,6 +7,8 @@ LL | string().as_ptr();
|
|||
| this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/temporaries.rs:2:9
|
||||
|
@ -23,6 +25,8 @@ LL | "hello".to_string().as_ptr();
|
|||
| this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `String` will be dropped
|
||||
|
@ -34,6 +38,8 @@ LL | (string() + "hello").as_ptr();
|
|||
| this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `String` will be dropped
|
||||
|
@ -45,6 +51,8 @@ LL | (if true { String::new() } else { "hello".into() }).as_ptr();
|
|||
| this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `String` will be dropped
|
||||
|
@ -58,6 +66,8 @@ LL | .as_ptr();
|
|||
| ^^^^^^ this pointer will immediately be invalid
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `String` will be dropped
|
||||
|
@ -71,6 +81,8 @@ LL | .as_ptr();
|
|||
| ^^^^^^ this pointer will immediately be invalid
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `String` will be dropped
|
||||
|
@ -82,6 +94,8 @@ LL | { string() }.as_ptr();
|
|||
| this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Vec<u8>` will be dropped
|
||||
|
@ -93,6 +107,8 @@ LL | vec![0u8].as_ptr();
|
|||
| this `Vec<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Vec<u8>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Vec<u8>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
|
|
@ -7,6 +7,8 @@ LL | declval::<CString>().as_ptr();
|
|||
| this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `CString` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `CString` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/types.rs:1:9
|
||||
|
@ -23,6 +25,8 @@ LL | declval::<String>().as_ptr();
|
|||
| this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `String` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `String` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Vec<u8>` will be dropped
|
||||
|
@ -34,6 +38,8 @@ LL | declval::<Vec<u8>>().as_ptr();
|
|||
| this `Vec<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Vec<u8>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Vec<u8>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Box<CString>` will be dropped
|
||||
|
@ -45,6 +51,8 @@ LL | declval::<Box<CString>>().as_ptr();
|
|||
| this `Box<CString>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Box<CString>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Box<CString>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Box<CString>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Box<[u8]>` will be dropped
|
||||
|
@ -56,6 +64,8 @@ LL | declval::<Box<[u8]>>().as_ptr();
|
|||
| this `Box<[u8]>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Box<[u8]>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Box<[u8]>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Box<[u8]>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Box<str>` will be dropped
|
||||
|
@ -67,6 +77,8 @@ LL | declval::<Box<str>>().as_ptr();
|
|||
| this `Box<str>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Box<str>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Box<str>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Box<str>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Box<CStr>` will be dropped
|
||||
|
@ -78,6 +90,8 @@ LL | declval::<Box<CStr>>().as_ptr();
|
|||
| this `Box<CStr>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Box<CStr>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Box<CStr>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Box<CStr>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `[u8; 10]` will be dropped
|
||||
|
@ -89,6 +103,8 @@ LL | declval::<[u8; 10]>().as_ptr();
|
|||
| this `[u8; 10]` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `[u8; 10]` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `[u8; 10]` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `[u8; 10]` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Box<[u8; 10]>` will be dropped
|
||||
|
@ -100,6 +116,8 @@ LL | declval::<Box<[u8; 10]>>().as_ptr();
|
|||
| this `Box<[u8; 10]>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Box<[u8; 10]>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Box<[u8; 10]>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Box<[u8; 10]>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Box<Vec<u8>>` will be dropped
|
||||
|
@ -111,6 +129,8 @@ LL | declval::<Box<Vec<u8>>>().as_ptr();
|
|||
| this `Box<Vec<u8>>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Box<Vec<u8>>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Box<Vec<u8>>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Box<Vec<u8>>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Box<String>` will be dropped
|
||||
|
@ -122,6 +142,8 @@ LL | declval::<Box<String>>().as_ptr();
|
|||
| this `Box<String>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Box<String>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Box<String>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Box<String>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Box<Box<Box<Box<[u8]>>>>` will be dropped
|
||||
|
@ -133,6 +155,8 @@ LL | declval::<Box<Box<Box<Box<[u8]>>>>>().as_ptr();
|
|||
| this `Box<Box<Box<Box<[u8]>>>>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Box<Box<Box<Box<[u8]>>>>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Box<Box<Box<Box<[u8]>>>>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Box<Box<Box<Box<[u8]>>>>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Cell<u8>` will be dropped
|
||||
|
@ -144,6 +168,8 @@ LL | declval::<Cell<u8>>().as_ptr();
|
|||
| this `Cell<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Cell<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Cell<u8>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Cell<u8>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `MaybeUninit<u8>` will be dropped
|
||||
|
@ -155,6 +181,8 @@ LL | declval::<MaybeUninit<u8>>().as_ptr();
|
|||
| this `MaybeUninit<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `MaybeUninit<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `MaybeUninit<u8>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `MaybeUninit<u8>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `Vec<AsPtrFake>` will be dropped
|
||||
|
@ -166,6 +194,8 @@ LL | declval::<Vec<AsPtrFake>>().as_ptr();
|
|||
| this `Vec<AsPtrFake>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<AsPtrFake>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `Vec<AsPtrFake>` to lives at least as long as the pointer returned by the call to `as_ptr`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `Vec<AsPtrFake>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `UnsafeCell<u8>` will be dropped
|
||||
|
@ -177,6 +207,8 @@ LL | declval::<UnsafeCell<u8>>().get();
|
|||
| this `UnsafeCell<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `get` the `UnsafeCell<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `UnsafeCell<u8>` to lives at least as long as the pointer returned by the call to `get`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `UnsafeCell<u8>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: a dangling pointer will be produced because the temporary `SyncUnsafeCell<u8>` will be dropped
|
||||
|
@ -188,6 +220,8 @@ LL | declval::<SyncUnsafeCell<u8>>().get();
|
|||
| this `SyncUnsafeCell<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
||||
|
|
||||
= note: pointers do not have a lifetime; when calling `get` the `SyncUnsafeCell<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
|
||||
= help: you must make sure that the variable you bind the `SyncUnsafeCell<u8>` to lives at least as long as the pointer returned by the call to `get`
|
||||
= help: in particular, if this pointer is returned from the current function, binding the `SyncUnsafeCell<u8>` inside the function will not suffice
|
||||
= help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
|
||||
|
||||
error: aborting due to 17 previous errors
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue