rust/compiler
Guillaume Gomez 81aca633bb
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
2024-08-23 12:32:16 +02:00
..
rustc Link std statically in rustc_driver 2024-08-11 04:16:53 +02:00
rustc_abi interpret: simplify pointer arithmetic logic 2024-08-01 14:25:19 +02:00
rustc_arena Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_ast Use more slice patterns inside the compiler 2024-08-07 13:37:52 +02:00
rustc_ast_ir Use dep: for crate dependencies 2024-07-15 12:40:10 -04:00
rustc_ast_lowering Rollup merge of #129345 - compiler-errors:scratch4, r=jieyouxu 2024-08-21 18:15:06 +02:00
rustc_ast_passes Rollup merge of #129345 - compiler-errors:scratch4, r=jieyouxu 2024-08-21 18:15:06 +02:00
rustc_ast_pretty Use more slice patterns inside the compiler 2024-08-07 13:37:52 +02:00
rustc_attr Use bool in favor of Option<()> for diagnostics 2024-08-21 01:31:11 -04:00
rustc_baked_icu_data
rustc_borrowck rename AddressOf -> RawBorrow inside the compiler 2024-08-18 19:46:53 +02:00
rustc_builtin_macros Auto merge of #128771 - carbotaniuman:stabilize_unsafe_attr, r=nnethercote 2024-08-17 22:48:42 +00:00
rustc_codegen_cranelift rename AddressOf -> RawBorrow inside the compiler 2024-08-18 19:46:53 +02:00
rustc_codegen_gcc stabilize raw_ref_op 2024-08-18 19:46:53 +02:00
rustc_codegen_llvm Add missing module flags for CFI and KCFI sanitizers 2024-08-21 20:23:56 +00:00
rustc_codegen_ssa Auto merge of #129257 - ChrisDenton:rename-null-descriptor, r=jieyouxu 2024-08-22 15:53:02 +00:00
rustc_const_eval Rollup merge of #129344 - compiler-errors:less-option-unit-diagnostics, r=jieyouxu 2024-08-21 18:15:05 +02:00
rustc_data_structures Update indexmap and use IndexMap::append 2024-08-13 16:16:57 -07:00
rustc_driver
rustc_driver_impl Rollup merge of #128762 - fmease:use-more-slice-pats, r=compiler-errors 2024-08-11 07:51:51 +02:00
rustc_error_codes stabilize raw_ref_op 2024-08-18 19:46:53 +02:00
rustc_error_messages Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_errors Update annotate-snippets to 0.11 2024-08-19 20:22:07 +00:00
rustc_expand Use bool in favor of Option<()> for diagnostics 2024-08-21 01:31:11 -04:00
rustc_feature Auto merge of #127672 - compiler-errors:precise-capturing, r=spastorino 2024-08-20 10:42:55 +00:00
rustc_fluent_macro Update annotate-snippets to 0.11 2024-08-19 20:22:07 +00:00
rustc_fs_util Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_graphviz Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_hir Auto merge of #127672 - compiler-errors:precise-capturing, r=spastorino 2024-08-20 10:42:55 +00:00
rustc_hir_analysis Auto merge of #129365 - matthiaskrgr:rollup-ebwx6ya, r=matthiaskrgr 2024-08-22 05:17:27 +00:00
rustc_hir_pretty Use FnSig instead of raw FnDecl for ForeignItemKind::Fn 2024-08-16 14:10:06 -04:00
rustc_hir_typeck Rollup merge of #129345 - compiler-errors:scratch4, r=jieyouxu 2024-08-21 18:15:06 +02:00
rustc_incremental Rollup merge of #129345 - compiler-errors:scratch4, r=jieyouxu 2024-08-21 18:15:06 +02:00
rustc_index Add and use IndexVec::append 2024-08-13 13:40:05 -07:00
rustc_index_macros Remove usage of specialization from newtype_index! 2024-06-30 16:42:53 +00:00
rustc_infer Point at explicit 'static obligations on a trait 2024-08-21 16:40:15 +00:00
rustc_interface Stabilize std:🧵:Builder::spawn_unchecked 2024-08-16 10:43:47 -07:00
rustc_lexer Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_lint Rollup merge of #129408 - Urgau:macro-arg-drop_copy, r=compiler-errors 2024-08-23 12:32:16 +02:00
rustc_lint_defs Rollup merge of #128727 - RalfJung:conflicting-repr-future-incompat, r=lcnr 2024-08-21 21:58:27 +02:00
rustc_llvm llvm-wrapper: adapt for LLVM 20 API changes 2024-08-21 16:27:31 +00:00
rustc_log Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_macros Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_metadata Simplify some redundant field names 2024-08-21 01:31:42 -04:00
rustc_middle Rollup merge of #129395 - fmease:pp-dyn-w-gat, r=compiler-errors 2024-08-22 08:17:23 +02:00
rustc_mir_build Rollup merge of #129345 - compiler-errors:scratch4, r=jieyouxu 2024-08-21 18:15:06 +02:00
rustc_mir_dataflow rename AddressOf -> RawBorrow inside the compiler 2024-08-18 19:46:53 +02:00
rustc_mir_transform Simplify some redundant field names 2024-08-21 01:31:42 -04:00
rustc_monomorphize Use bool in favor of Option<()> for diagnostics 2024-08-21 01:31:11 -04:00
rustc_next_trait_solver Rollup merge of #128828 - lcnr:search-graph-11, r=compiler-errors 2024-08-14 21:43:07 +08:00
rustc_parse Use bool in favor of Option<()> for diagnostics 2024-08-21 01:31:11 -04:00
rustc_parse_format Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_passes Use bool in favor of Option<()> for diagnostics 2024-08-21 01:31:11 -04:00
rustc_pattern_analysis Rollup merge of #128965 - Zalathar:no-pat, r=Nadrieril 2024-08-15 18:44:16 -07:00
rustc_privacy Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_query_impl Simplify some redundant field names 2024-08-21 01:31:42 -04:00
rustc_query_system fix: simple typo in compiler directory 2024-08-20 20:50:32 +08:00
rustc_resolve Rollup merge of #129345 - compiler-errors:scratch4, r=jieyouxu 2024-08-21 18:15:06 +02:00
rustc_sanitizers Rollup merge of #129345 - compiler-errors:scratch4, r=jieyouxu 2024-08-21 18:15:06 +02:00
rustc_serialize Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_session Rollup merge of #128348 - dingxiangfei2009:allow-shadow-call-stack-sanitizer, r=tmandry 2024-08-15 19:32:35 +02:00
rustc_smir Simplify some redundant field names 2024-08-21 01:31:42 -04:00
rustc_span Rollup merge of #127279 - bvanjoi:fix-112680, r=petrochenkov 2024-08-21 19:35:10 +02:00
rustc_symbol_mangling Shrink TyKind::FnPtr. 2024-08-09 14:33:25 +10:00
rustc_target Make ArgAbi::make_indirect_force more specific 2024-08-21 02:43:12 +01:00
rustc_trait_selection Auto merge of #129398 - matthiaskrgr:rollup-50l01ry, r=matthiaskrgr 2024-08-22 08:20:49 +00:00
rustc_traits Remove redundant type ops 2024-08-14 14:18:17 -04:00
rustc_transmute safe transmute: gracefully bubble-up layout errors 2024-08-21 18:06:02 +00:00
rustc_ty_utils Use bool in favor of Option<()> for diagnostics 2024-08-21 01:31:11 -04:00
rustc_type_ir Rollup merge of #128828 - lcnr:search-graph-11, r=compiler-errors 2024-08-14 21:43:07 +08:00
rustc_type_ir_macros Reformat use declarations. 2024-07-29 08:26:52 +10:00
stable_mir Reformat use declarations. 2024-07-29 08:26:52 +10:00