diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-08-23 12:32:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-23 12:32:16 +0200 |
| commit | 81aca633bbae94b3d7856ba52380d46824fa2e97 (patch) | |
| tree | bf9296d953ddd95cfad6a7bf6f2bd273722f9818 /compiler/rustc_pattern_analysis/src | |
| parent | 1bbb8d51833b1b8e73d70a47e028c583559b0264 (diff) | |
| parent | 6a878a9630945cd6a61ad5e83ec5c543c6e8dab7 (diff) | |
| download | rust-81aca633bbae94b3d7856ba52380d46824fa2e97.tar.gz rust-81aca633bbae94b3d7856ba52380d46824fa2e97.zip | |
Rollup merge of #129408 - Urgau:macro-arg-drop_copy, r=compiler-errors
Fix handling of macro arguments within the `dropping_copy_types` lint
This PR fixes the handling of spans with different context (aka macro arguments) than the primary expression within the different `{drop,forget}ing_copy_types` and `{drop,forget}ing_references` lints.
<details>
<summary>Before</summary>
```
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
--> drop_writeln.rs:5:5
|
5 | drop(writeln!(&mut msg, "test"));
| ^^^^^--------------------------^
| |
| argument has type `Result<(), std::fmt::Error>`
|
= note: `#[warn(dropping_copy_types)]` on by default
help: use `let _ = ...` to ignore the expression or result
--> /home/[..]/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/macros/mod.rs:688:9
|
68| let _ =
| ~~~~~~~
```
</details>
<details>
<summary>With this PR</summary>
```
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
--> drop_writeln.rs:5:5
|
5 | drop(writeln!(&mut msg, "test"));
| ^^^^^--------------------------^
| |
| argument has type `Result<(), std::fmt::Error>`
|
= note: `#[warn(dropping_copy_types)]` on by default
help: use `let _ = ...` to ignore the expression or result
|
5 - drop(writeln!(&mut msg, "test"));
5 + let _ = writeln!(&mut msg, "test");
|
```
</details>
``````@rustbot`````` label +L-dropping_copy_types
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions
