about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-02-13 18:59:59 +0000
committerbors <bors@rust-lang.org>2021-02-13 18:59:59 +0000
commit5f611ceef7d11c906cf063ac6acc2189d769eab5 (patch)
tree2155b28284841fc3f1840910445db158b4864670
parent51aefbdd914800b3d1b1e1748a37e8f3e1cae426 (diff)
parent87109bb4f599bb8ac7b1c3a970337ac92cb3031c (diff)
downloadrust-5f611ceef7d11c906cf063ac6acc2189d769eab5.tar.gz
rust-5f611ceef7d11c906cf063ac6acc2189d769eab5.zip
Auto merge of #6736 - Y-Nak:reproducer-for-use_self-ice, r=flip1995
Add a minimal reproducer for the ICE in #6179

This PR is an auxiliary PR for #6179, just add a minimal reproducer for the ICE discussed in #6179.
See #6179 for more details.

changelog: none
-rw-r--r--tests/ui/crashes/ice-6179.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/crashes/ice-6179.rs b/tests/ui/crashes/ice-6179.rs
new file mode 100644
index 00000000000..f8c866a49aa
--- /dev/null
+++ b/tests/ui/crashes/ice-6179.rs
@@ -0,0 +1,21 @@
+//! This is a minimal reproducer for the ICE in https://github.com/rust-lang/rust-clippy/pull/6179.
+//! The ICE is mainly caused by using `hir_ty_to_ty`. See the discussion in the PR for details.
+
+#![warn(clippy::use_self)]
+#![allow(dead_code)]
+
+struct Foo {}
+
+impl Foo {
+    fn foo() -> Self {
+        impl Foo {
+            fn bar() {}
+        }
+
+        let _: _ = 1;
+
+        Self {}
+    }
+}
+
+fn main() {}