-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A small diagnostic improvement for dropping_copy_types
fixes #125189
- Loading branch information
Showing
9 changed files
with
113 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@ run-rustfix | ||
|
||
#![deny(dropping_copy_types)] | ||
|
||
fn main() { | ||
let y = 1; | ||
let _ = 3.2; //~ ERROR calls to `std::mem::drop` | ||
let _ = y; //~ ERROR calls to `std::mem::drop` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@ run-rustfix | ||
|
||
#![deny(dropping_copy_types)] | ||
|
||
fn main() { | ||
let y = 1; | ||
drop(3.2); //~ ERROR calls to `std::mem::drop` | ||
drop(y); //~ ERROR calls to `std::mem::drop` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
error: calls to `std::mem::drop` with a value that implements `Copy` does nothing | ||
--> $DIR/dropping_copy_types-issue-125189.rs:7:5 | ||
| | ||
LL | drop(3.2); | ||
| ^^^^^---^ | ||
| | | ||
| argument has type `f64` | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/dropping_copy_types-issue-125189.rs:3:9 | ||
| | ||
LL | #![deny(dropping_copy_types)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
help: use `let _ = ...` to ignore the expression or result | ||
| | ||
LL | let _ = 3.2; | ||
| ~~~~~~~~~~~ | ||
|
||
error: calls to `std::mem::drop` with a value that implements `Copy` does nothing | ||
--> $DIR/dropping_copy_types-issue-125189.rs:8:5 | ||
| | ||
LL | drop(y); | ||
| ^^^^^-^ | ||
| | | ||
| argument has type `i32` | ||
| | ||
help: use `let _ = ...` to ignore the expression or result | ||
| | ||
LL | let _ = y; | ||
| ~~~~~~~~~ | ||
|
||
error: aborting due to 2 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters