From c32e2fe1796feb6c8c0cd3f0008bc4c3efc9106f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 27 Apr 2024 14:26:43 +0200 Subject: [PATCH] add test for https://github.com/rust-lang/rust/issues/109812 --- tests/crashes/109812.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/crashes/109812.rs diff --git a/tests/crashes/109812.rs b/tests/crashes/109812.rs new file mode 100644 index 00000000000..c29b8746521 --- /dev/null +++ b/tests/crashes/109812.rs @@ -0,0 +1,22 @@ +//@ known-bug: #109812 + +#![warn(rust_2021_incompatible_closure_captures)] + +enum Either { + One(X), + Two(X), +} + +struct X(Y); + +struct Y; + +fn move_into_fnmut() { + let x = X(Y); + + consume_fnmut(|| { + let Either::Two(ref mut _t) = x; + + let X(mut _t) = x; + }); +}