1
Fork 0
rust/compiler/rustc_mir_build/src
bors 11663cd3bf Auto merge of #134486 - compiler-errors:drop-for-lint, r=nikomatsakis
Make sure we handle `backwards_incompatible_lint` drops appropriately in drop elaboration

In #131326, a new kind of scheduled drop (`drop_kind: DropKind::Value` + `backwards_incompatible_lint: true`) was added so that we could insert a new kind of no-op MIR statement (`backward incompatible drop`) for linting purposes.

These drops were intended to have *no side-effects*, but drop elaboration code forgot to handle these drops specially and they were handled otherwise as normal drops in most of the code. This ends up being **unsound** since we insert more than one drop call for some values, which means that `Drop::drop` could be called more than once.

This PR fixes this by splitting out the `DropKind::ForLint` and adjusting the code. I'm not totally certain if all of the places I've adjusted are either reachable or correct, but I'm pretty certain that it's *more* correct than it was previously.

cc `@dingxiangfei2009`
r? nikomatsakis

Fixes #134482
2024-12-19 15:58:08 +00:00
..
builder Auto merge of #134486 - compiler-errors:drop-for-lint, r=nikomatsakis 2024-12-19 15:58:08 +00:00
thir Rename Scope.id to Scope.local_id, remove trivial accessor 2024-12-19 02:31:58 +00:00
check_tail_calls.rs simplify things using tcx.as_lang_item 2024-11-29 20:28:02 +01:00
check_unsafety.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
errors.rs Rollup merge of #134394 - dianne:clarify-pat-2024-migration, r=compiler-errors 2024-12-18 22:56:54 +08:00
lib.rs Explain why build was renamed to builder 2024-12-17 11:41:11 +11:00
lints.rs unconditional recursion, yeet TypingEnv::from_param_env 2024-11-19 18:06:20 +01:00