|
| 1 | +error: getting a pointer from a temporary `CString` will result in a dangling pointer |
| 2 | + --> $DIR/instantly-dangling-pointer-types.rs:20:26 |
| 3 | + | |
| 4 | +LL | declval::<CString>().as_ptr(); |
| 5 | + | -------------------- ^^^^^^ this pointer will immediately be invalid |
| 6 | + | | |
| 7 | + | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 8 | + | |
| 9 | + = 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 |
| 10 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 11 | +note: the lint level is defined here |
| 12 | + --> $DIR/instantly-dangling-pointer-types.rs:1:9 |
| 13 | + | |
| 14 | +LL | #![deny(instantly_dangling_pointer)] |
| 15 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 16 | + |
| 17 | +error: getting a pointer from a temporary `String` will result in a dangling pointer |
| 18 | + --> $DIR/instantly-dangling-pointer-types.rs:21:25 |
| 19 | + | |
| 20 | +LL | declval::<String>().as_ptr(); |
| 21 | + | ------------------- ^^^^^^ this pointer will immediately be invalid |
| 22 | + | | |
| 23 | + | this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 24 | + | |
| 25 | + = 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 |
| 26 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 27 | + |
| 28 | +error: getting a pointer from a temporary `Vec<u8>` will result in a dangling pointer |
| 29 | + --> $DIR/instantly-dangling-pointer-types.rs:22:26 |
| 30 | + | |
| 31 | +LL | declval::<Vec<u8>>().as_ptr(); |
| 32 | + | -------------------- ^^^^^^ this pointer will immediately be invalid |
| 33 | + | | |
| 34 | + | this `Vec<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 35 | + | |
| 36 | + = 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 |
| 37 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 38 | + |
| 39 | +error: getting a pointer from a temporary `Box<CString>` will result in a dangling pointer |
| 40 | + --> $DIR/instantly-dangling-pointer-types.rs:23:31 |
| 41 | + | |
| 42 | +LL | declval::<Box<CString>>().as_ptr(); |
| 43 | + | ------------------------- ^^^^^^ this pointer will immediately be invalid |
| 44 | + | | |
| 45 | + | this `Box<CString>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 46 | + | |
| 47 | + = 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 |
| 48 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 49 | + |
| 50 | +error: getting a pointer from a temporary `Box<[u8]>` will result in a dangling pointer |
| 51 | + --> $DIR/instantly-dangling-pointer-types.rs:24:28 |
| 52 | + | |
| 53 | +LL | declval::<Box<[u8]>>().as_ptr(); |
| 54 | + | ---------------------- ^^^^^^ this pointer will immediately be invalid |
| 55 | + | | |
| 56 | + | this `Box<[u8]>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 57 | + | |
| 58 | + = 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 |
| 59 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 60 | + |
| 61 | +error: getting a pointer from a temporary `Box<str>` will result in a dangling pointer |
| 62 | + --> $DIR/instantly-dangling-pointer-types.rs:25:27 |
| 63 | + | |
| 64 | +LL | declval::<Box<str>>().as_ptr(); |
| 65 | + | --------------------- ^^^^^^ this pointer will immediately be invalid |
| 66 | + | | |
| 67 | + | this `Box<str>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 68 | + | |
| 69 | + = 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 |
| 70 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 71 | + |
| 72 | +error: getting a pointer from a temporary `Box<CStr>` will result in a dangling pointer |
| 73 | + --> $DIR/instantly-dangling-pointer-types.rs:26:28 |
| 74 | + | |
| 75 | +LL | declval::<Box<CStr>>().as_ptr(); |
| 76 | + | ---------------------- ^^^^^^ this pointer will immediately be invalid |
| 77 | + | | |
| 78 | + | this `Box<CStr>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 79 | + | |
| 80 | + = 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 |
| 81 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 82 | + |
| 83 | +error: getting a pointer from a temporary `[u8; 10]` will result in a dangling pointer |
| 84 | + --> $DIR/instantly-dangling-pointer-types.rs:27:27 |
| 85 | + | |
| 86 | +LL | declval::<[u8; 10]>().as_ptr(); |
| 87 | + | --------------------- ^^^^^^ this pointer will immediately be invalid |
| 88 | + | | |
| 89 | + | this `[u8; 10]` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 90 | + | |
| 91 | + = 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 |
| 92 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 93 | + |
| 94 | +error: getting a pointer from a temporary `Box<[u8; 10]>` will result in a dangling pointer |
| 95 | + --> $DIR/instantly-dangling-pointer-types.rs:28:32 |
| 96 | + | |
| 97 | +LL | declval::<Box<[u8; 10]>>().as_ptr(); |
| 98 | + | -------------------------- ^^^^^^ this pointer will immediately be invalid |
| 99 | + | | |
| 100 | + | this `Box<[u8; 10]>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 101 | + | |
| 102 | + = 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 |
| 103 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 104 | + |
| 105 | +error: getting a pointer from a temporary `Box<Vec<u8>>` will result in a dangling pointer |
| 106 | + --> $DIR/instantly-dangling-pointer-types.rs:29:31 |
| 107 | + | |
| 108 | +LL | declval::<Box<Vec<u8>>>().as_ptr(); |
| 109 | + | ------------------------- ^^^^^^ this pointer will immediately be invalid |
| 110 | + | | |
| 111 | + | this `Box<Vec<u8>>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 112 | + | |
| 113 | + = 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 |
| 114 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 115 | + |
| 116 | +error: getting a pointer from a temporary `Box<String>` will result in a dangling pointer |
| 117 | + --> $DIR/instantly-dangling-pointer-types.rs:30:30 |
| 118 | + | |
| 119 | +LL | declval::<Box<String>>().as_ptr(); |
| 120 | + | ------------------------ ^^^^^^ this pointer will immediately be invalid |
| 121 | + | | |
| 122 | + | this `Box<String>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 123 | + | |
| 124 | + = 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 |
| 125 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 126 | + |
| 127 | +error: getting a pointer from a temporary `Box<Box<Box<Box<[u8]>>>>` will result in a dangling pointer |
| 128 | + --> $DIR/instantly-dangling-pointer-types.rs:31:43 |
| 129 | + | |
| 130 | +LL | declval::<Box<Box<Box<Box<[u8]>>>>>().as_ptr(); |
| 131 | + | ------------------------------------- ^^^^^^ this pointer will immediately be invalid |
| 132 | + | | |
| 133 | + | this `Box<Box<Box<Box<[u8]>>>>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 134 | + | |
| 135 | + = 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 |
| 136 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 137 | + |
| 138 | +error: getting a pointer from a temporary `Cell<u8>` will result in a dangling pointer |
| 139 | + --> $DIR/instantly-dangling-pointer-types.rs:32:27 |
| 140 | + | |
| 141 | +LL | declval::<Cell<u8>>().as_ptr(); |
| 142 | + | --------------------- ^^^^^^ this pointer will immediately be invalid |
| 143 | + | | |
| 144 | + | this `Cell<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 145 | + | |
| 146 | + = 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 |
| 147 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 148 | + |
| 149 | +error: getting a pointer from a temporary `MaybeUninit<u8>` will result in a dangling pointer |
| 150 | + --> $DIR/instantly-dangling-pointer-types.rs:33:34 |
| 151 | + | |
| 152 | +LL | declval::<MaybeUninit<u8>>().as_ptr(); |
| 153 | + | ---------------------------- ^^^^^^ this pointer will immediately be invalid |
| 154 | + | | |
| 155 | + | this `MaybeUninit<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 156 | + | |
| 157 | + = 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 |
| 158 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 159 | + |
| 160 | +error: getting a pointer from a temporary `Vec<AsPtrFake>` will result in a dangling pointer |
| 161 | + --> $DIR/instantly-dangling-pointer-types.rs:34:33 |
| 162 | + | |
| 163 | +LL | declval::<Vec<AsPtrFake>>().as_ptr(); |
| 164 | + | --------------------------- ^^^^^^ this pointer will immediately be invalid |
| 165 | + | | |
| 166 | + | this `Vec<AsPtrFake>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime |
| 167 | + | |
| 168 | + = 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 |
| 169 | + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html |
| 170 | + |
| 171 | +error: aborting due to 15 previous errors |
| 172 | + |
0 commit comments