Files
rust/compiler/rustc_mir_transform
Roland Xu d0f47c836d Rollup merge of #160097 - Rachit2323:const-mutation-needs-drop, r=jackh726
fix const_item_mutation lint to use needs_drop instead of has_dtor

Description:
The const_item_mutation lint was only checking if the outer type has a direct Drop impl (has_dtor). But if a field inside the type has a Drop impl, that drop logic can also observe the mutation — so the warning should be suppressed in that case too.

This fixes a false positive where the lint would warn on code like:

```O.inner.val = 42;```

even when Inner has a Drop impl that prints the value — meaning the mutation IS observable and the warning is wrong.

Fix: replace has_dtor check with needs_drop, which checks the whole type including all fields inside it.
2026-09-20 09:23:34 +08:00
..
2026-08-21 10:33:56 +02:00