about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-01-22 20:37:23 +0100
committerGitHub <noreply@github.com>2025-01-22 20:37:23 +0100
commit9206ba535c28d13ae00a78dc2a425fe7c75bc0ec (patch)
treed3f55a4531c63476016aac02ff8329f741d3876d /tests
parentdee7d0e730a3a3ed98c89dd33c4ac16edc82de8a (diff)
parent12214db74bfa1513cd8a8ffdc21ad83e1b2d7844 (diff)
downloadrust-9206ba535c28d13ae00a78dc2a425fe7c75bc0ec.tar.gz
rust-9206ba535c28d13ae00a78dc2a425fe7c75bc0ec.zip
Rollup merge of #132983 - Anthony-Eid:dangling-pointers-lint, r=Urgau
Edit dangling pointers

Closes: #132283
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/lint/dangling-pointers-from-temporaries/allow.stderr4
-rw-r--r--tests/ui/lint/dangling-pointers-from-temporaries/calls.stderr10
-rw-r--r--tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.stderr4
-rw-r--r--tests/ui/lint/dangling-pointers-from-temporaries/example-from-issue123613.stderr4
-rw-r--r--tests/ui/lint/dangling-pointers-from-temporaries/ext.stderr4
-rw-r--r--tests/ui/lint/dangling-pointers-from-temporaries/methods.stderr4
-rw-r--r--tests/ui/lint/dangling-pointers-from-temporaries/temporaries.stderr16
-rw-r--r--tests/ui/lint/dangling-pointers-from-temporaries/types.stderr34
8 files changed, 80 insertions, 0 deletions
diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/allow.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/allow.stderr
index fd434eacf3d..e1c12cfd1a5 100644
--- a/tests/ui/lint/dangling-pointers-from-temporaries/allow.stderr
+++ b/tests/ui/lint/dangling-pointers-from-temporaries/allow.stderr
@@ -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
diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/calls.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/calls.stderr
index d1615b76d82..41c6cdd0e3e 100644
--- a/tests/ui/lint/dangling-pointers-from-temporaries/calls.stderr
+++ b/tests/ui/lint/dangling-pointers-from-temporaries/calls.stderr
@@ -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
diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.stderr
index 5289fbb8723..d4126ba231f 100644
--- a/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.stderr
+++ b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.stderr
@@ -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)
 
diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/example-from-issue123613.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/example-from-issue123613.stderr
index 0de794f6ae2..aace55e92cf 100644
--- a/tests/ui/lint/dangling-pointers-from-temporaries/example-from-issue123613.stderr
+++ b/tests/ui/lint/dangling-pointers-from-temporaries/example-from-issue123613.stderr
@@ -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
diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/ext.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/ext.stderr
index 5d401c89c0c..976334ddef9 100644
--- a/tests/ui/lint/dangling-pointers-from-temporaries/ext.stderr
+++ b/tests/ui/lint/dangling-pointers-from-temporaries/ext.stderr
@@ -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
diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/methods.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/methods.stderr
index 11c052c158e..a86a69bc39a 100644
--- a/tests/ui/lint/dangling-pointers-from-temporaries/methods.stderr
+++ b/tests/ui/lint/dangling-pointers-from-temporaries/methods.stderr
@@ -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
diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/temporaries.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/temporaries.stderr
index d2e9ac8c4e9..e8994703cab 100644
--- a/tests/ui/lint/dangling-pointers-from-temporaries/temporaries.stderr
+++ b/tests/ui/lint/dangling-pointers-from-temporaries/temporaries.stderr
@@ -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
diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/types.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/types.stderr
index 250ed6dc9e3..fab2459b53f 100644
--- a/tests/ui/lint/dangling-pointers-from-temporaries/types.stderr
+++ b/tests/ui/lint/dangling-pointers-from-temporaries/types.stderr
@@ -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