about summary refs log tree commit diff
path: root/tests/ui/drop/recursion-check-on-erroneous-impl.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-02-08 17:33:04 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-02-08 17:33:04 +0000
commitad511ef92ed5454182c1c6b3afe0846d654af009 (patch)
tree972852ad2c42ebf8027b9605b32c4f0214d384fa /tests/ui/drop/recursion-check-on-erroneous-impl.rs
parent1280928a99ad3ef2c5735b42dc8852456ae3b974 (diff)
downloadrust-ad511ef92ed5454182c1c6b3afe0846d654af009.tar.gz
rust-ad511ef92ed5454182c1c6b3afe0846d654af009.zip
Avoid ICE in drop recursion check in case of invalid drop impls
Diffstat (limited to 'tests/ui/drop/recursion-check-on-erroneous-impl.rs')
-rw-r--r--tests/ui/drop/recursion-check-on-erroneous-impl.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/drop/recursion-check-on-erroneous-impl.rs b/tests/ui/drop/recursion-check-on-erroneous-impl.rs
new file mode 100644
index 00000000000..733c8b0b085
--- /dev/null
+++ b/tests/ui/drop/recursion-check-on-erroneous-impl.rs
@@ -0,0 +1,11 @@
+// can't use build-fail, because this also fails check-fail, but
+// the ICE from #120787 only reproduces on build-fail.
+// compile-flags: --emit=mir
+
+struct PrintOnDrop<'a>(&'a str);
+
+impl Drop for PrintOnDrop<'_> {
+    fn drop() {} //~ ERROR method `drop` has a `&mut self` declaration in the trait
+}
+
+fn main() {}