Rollup merge of #90901 - rukai:improve_manuallydrop_help, r=estebank

Improve ManuallyDrop suggestion

closes https://github.com/rust-lang/rust/issues/90585
* Fixes the recommended change to use ManuallyDrop as per the issue
* Changes the note to a help
* improves the span so it only points at the type.
This commit is contained in:
Matthias Krüger 2021-11-17 15:58:06 +01:00 committed by GitHub
commit 469faa2b66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 43 deletions

View file

@ -13,11 +13,10 @@ error[E0740]: unions may not contain fields that need dropping
LL | a: String,
| ^^^^^^^^^
|
note: `std::mem::ManuallyDrop` can be used to wrap the type
--> $DIR/feature-gate-untagged_unions.rs:16:5
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
LL | a: String,
| ^^^^^^^^^
LL | a: std::mem::ManuallyDrop<String>,
| +++++++++++++++++++++++ +
error[E0740]: unions may not contain fields that need dropping
--> $DIR/feature-gate-untagged_unions.rs:24:5
@ -25,11 +24,10 @@ error[E0740]: unions may not contain fields that need dropping
LL | a: T,
| ^^^^
|
note: `std::mem::ManuallyDrop` can be used to wrap the type
--> $DIR/feature-gate-untagged_unions.rs:24:5
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
LL | a: T,
| ^^^^
LL | a: std::mem::ManuallyDrop<T>,
| +++++++++++++++++++++++ +
error: aborting due to 3 previous errors

View file

@ -4,11 +4,10 @@ error[E0740]: unions may not contain fields that need dropping
LL | a: A,
| ^^^^
|
note: `std::mem::ManuallyDrop` can be used to wrap the type
--> $DIR/issue-41073.rs:4:5
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
LL | a: A,
| ^^^^
LL | a: std::mem::ManuallyDrop<A>,
| +++++++++++++++++++++++ +
error: aborting due to previous error

View file

@ -4,11 +4,10 @@ error[E0740]: unions may not contain fields that need dropping
LL | bar: Bar,
| ^^^^^^^^
|
note: `std::mem::ManuallyDrop` can be used to wrap the type
--> $DIR/union-custom-drop.rs:7:5
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
LL | bar: Bar,
| ^^^^^^^^
LL | bar: std::mem::ManuallyDrop<Bar>,
| +++++++++++++++++++++++ +
error: aborting due to previous error

View file

@ -4,11 +4,10 @@ error[E0740]: unions may not contain fields that need dropping
LL | a: String,
| ^^^^^^^^^
|
note: `std::mem::ManuallyDrop` can be used to wrap the type
--> $DIR/union-with-drop-fields.rs:11:5
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
LL | a: String,
| ^^^^^^^^^
LL | a: std::mem::ManuallyDrop<String>,
| +++++++++++++++++++++++ +
error[E0740]: unions may not contain fields that need dropping
--> $DIR/union-with-drop-fields.rs:19:5
@ -16,11 +15,10 @@ error[E0740]: unions may not contain fields that need dropping
LL | a: S,
| ^^^^
|
note: `std::mem::ManuallyDrop` can be used to wrap the type
--> $DIR/union-with-drop-fields.rs:19:5
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
LL | a: S,
| ^^^^
LL | a: std::mem::ManuallyDrop<S>,
| +++++++++++++++++++++++ +
error[E0740]: unions may not contain fields that need dropping
--> $DIR/union-with-drop-fields.rs:24:5
@ -28,11 +26,10 @@ error[E0740]: unions may not contain fields that need dropping
LL | a: T,
| ^^^^
|
note: `std::mem::ManuallyDrop` can be used to wrap the type
--> $DIR/union-with-drop-fields.rs:24:5
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
LL | a: T,
| ^^^^
LL | a: std::mem::ManuallyDrop<T>,
| +++++++++++++++++++++++ +
error: aborting due to 3 previous errors

View file

@ -4,11 +4,10 @@ error[E0740]: unions may not contain fields that need dropping
LL | a: String,
| ^^^^^^^^^
|
note: `std::mem::ManuallyDrop` can be used to wrap the type
--> $DIR/union-with-drop-fields.rs:11:5
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
LL | a: String,
| ^^^^^^^^^
LL | a: std::mem::ManuallyDrop<String>,
| +++++++++++++++++++++++ +
error[E0740]: unions may not contain fields that need dropping
--> $DIR/union-with-drop-fields.rs:19:5
@ -16,11 +15,10 @@ error[E0740]: unions may not contain fields that need dropping
LL | a: S,
| ^^^^
|
note: `std::mem::ManuallyDrop` can be used to wrap the type
--> $DIR/union-with-drop-fields.rs:19:5
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
LL | a: S,
| ^^^^
LL | a: std::mem::ManuallyDrop<S>,
| +++++++++++++++++++++++ +
error[E0740]: unions may not contain fields that need dropping
--> $DIR/union-with-drop-fields.rs:24:5
@ -28,11 +26,10 @@ error[E0740]: unions may not contain fields that need dropping
LL | a: T,
| ^^^^
|
note: `std::mem::ManuallyDrop` can be used to wrap the type
--> $DIR/union-with-drop-fields.rs:24:5
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
LL | a: T,
| ^^^^
LL | a: std::mem::ManuallyDrop<T>,
| +++++++++++++++++++++++ +
error: aborting due to 3 previous errors