|
| 1 | +error: assignment via raw pointer always executes destructor |
| 2 | + --> tests/ui/raw_assign_to_drop.rs:5:10 |
| 3 | + | |
| 4 | +LL | *r = "foo".to_owned(); |
| 5 | + | ^ this place may be uninitialized, causing Undefined Behavior when the destructor executes |
| 6 | + | |
| 7 | + = note: the destructor defined by `std::string::String` is executed during assignment of the new value |
| 8 | + = help: use `std::ptr::write()` to overwrite a (possibly uninitialized) place |
| 9 | + = help: use `std::ptr::drop_in_place()` to drop the previous value if such value exists |
| 10 | + = note: `-D clippy::raw-assign-to-drop` implied by `-D warnings` |
| 11 | + = help: to override `-D warnings` add `#[allow(clippy::raw_assign_to_drop)]` |
| 12 | + |
| 13 | +error: assignment via raw pointer always executes destructor |
| 14 | + --> tests/ui/raw_assign_to_drop.rs:10:11 |
| 15 | + | |
| 16 | +LL | (*r, *r) = ("foo".to_owned(), "bar".to_owned()); |
| 17 | + | ^ this place may be uninitialized, causing Undefined Behavior when the destructor executes |
| 18 | + | |
| 19 | + = note: the destructor defined by `std::string::String` is executed during assignment of the new value |
| 20 | + = help: use `std::ptr::write()` to overwrite a (possibly uninitialized) place |
| 21 | + = help: use `std::ptr::drop_in_place()` to drop the previous value if such value exists |
| 22 | + |
| 23 | +error: assignment via raw pointer always executes destructor |
| 24 | + --> tests/ui/raw_assign_to_drop.rs:10:15 |
| 25 | + | |
| 26 | +LL | (*r, *r) = ("foo".to_owned(), "bar".to_owned()); |
| 27 | + | ^ this place may be uninitialized, causing Undefined Behavior when the destructor executes |
| 28 | + | |
| 29 | + = note: the destructor defined by `std::string::String` is executed during assignment of the new value |
| 30 | + = help: use `std::ptr::write()` to overwrite a (possibly uninitialized) place |
| 31 | + = help: use `std::ptr::drop_in_place()` to drop the previous value if such value exists |
| 32 | + |
| 33 | +error: assignment via raw pointer always executes destructor |
| 34 | + --> tests/ui/raw_assign_to_drop.rs:12:11 |
| 35 | + | |
| 36 | +LL | (*r, *i) = ("foo".to_owned(), 47); |
| 37 | + | ^ this place may be uninitialized, causing Undefined Behavior when the destructor executes |
| 38 | + | |
| 39 | + = note: the destructor defined by `std::string::String` is executed during assignment of the new value |
| 40 | + = help: use `std::ptr::write()` to overwrite a (possibly uninitialized) place |
| 41 | + = help: use `std::ptr::drop_in_place()` to drop the previous value if such value exists |
| 42 | + |
| 43 | +error: assignment via raw pointer always executes destructor |
| 44 | + --> tests/ui/raw_assign_to_drop.rs:15:10 |
| 45 | + | |
| 46 | +LL | *(&mut x as *mut _) = "Foo".to_owned(); |
| 47 | + | ^^^^^^^^^^^^^^^^^^ this place may be uninitialized, causing Undefined Behavior when the destructor executes |
| 48 | + | |
| 49 | + = note: the destructor defined by `std::string::String` is executed during assignment of the new value |
| 50 | + = help: use `std::ptr::write()` to overwrite a (possibly uninitialized) place |
| 51 | + = help: use `std::ptr::drop_in_place()` to drop the previous value if such value exists |
| 52 | + |
| 53 | +error: assignment via raw pointer always executes destructor |
| 54 | + --> tests/ui/raw_assign_to_drop.rs:21:10 |
| 55 | + | |
| 56 | +LL | *v.as_mut_ptr() = Default::default(); |
| 57 | + | ^^^^^^^^^^^^^^ this place may be uninitialized, causing Undefined Behavior when the destructor executes |
| 58 | + | |
| 59 | + = note: the destructor defined by `std::string::String` is executed during assignment of the new value |
| 60 | + = help: use `std::ptr::write()` to overwrite a (possibly uninitialized) place |
| 61 | + = help: use `std::ptr::drop_in_place()` to drop the previous value if such value exists |
| 62 | + |
| 63 | +error: aborting due to 6 previous errors |
| 64 | + |
0 commit comments