1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
error: a dangling pointer will be produced because the temporary `CString` will be dropped
--> $DIR/calls.rs:27:29
|
LL | let ptr = cstring().as_ptr();
| --------- ^^^^^^ this pointer will immediately be invalid
| |
| 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: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
note: the lint level is defined here
--> $DIR/calls.rs:1:9
|
LL | #![deny(dangling_pointers_from_temporaries)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a dangling pointer will be produced because the temporary `CString` will be dropped
--> $DIR/calls.rs:32:29
|
LL | let ptr = cstring().as_ptr();
| --------- ^^^^^^ this pointer will immediately be invalid
| |
| 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: 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
--> $DIR/calls.rs:41:37
|
LL | let _ptr: *const u8 = cstring().as_ptr().cast();
| --------- ^^^^^^ this pointer will immediately be invalid
| |
| 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: 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
--> $DIR/calls.rs:43:41
|
LL | let _ptr: *const u8 = { cstring() }.as_ptr().cast();
| ------------- ^^^^^^ this pointer will immediately be invalid
| |
| 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: 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
--> $DIR/calls.rs:45:39
|
LL | let _ptr: *const u8 = { cstring().as_ptr() }.cast();
| --------- ^^^^^^ this pointer will immediately be invalid
| |
| 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: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
error: aborting due to 5 previous errors
|