Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#129408 - Urgau:macro-arg-drop_copy, r=compi…
…ler-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
- Loading branch information