about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYoshitomo Nakanishi <yurayura.rounin.3@gmail.com>2021-02-27 22:46:10 +0900
committerYoshitomo Nakanishi <yurayura.rounin.3@gmail.com>2021-02-27 22:57:30 +0900
commite51bb0ee26413c8db8264abe413cc06c95bd9a13 (patch)
tree23233c7d059efd040f0f31f185f7287925f54aa7
parentbdeec5dbd6e484cec26039cb795193ab044cf4d9 (diff)
downloadrust-e51bb0ee26413c8db8264abe413cc06c95bd9a13.tar.gz
rust-e51bb0ee26413c8db8264abe413cc06c95bd9a13.zip
Add test for ICE 6793
-rw-r--r--tests/ui/crashes/ice-6793.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/crashes/ice-6793.rs b/tests/ui/crashes/ice-6793.rs
new file mode 100644
index 00000000000..12a4a0d25ef
--- /dev/null
+++ b/tests/ui/crashes/ice-6793.rs
@@ -0,0 +1,23 @@
+//! This is a reproducer for the ICE 6793: https://github.com/rust-lang/rust-clippy/issues/6793.
+//! The ICE is caused by using `TyCtxt::type_of(assoc_type_id)`, which is the same as the ICE 6792.
+
+trait Trait {
+    type Ty: 'static + Clone;
+
+    fn broken() -> Self::Ty;
+}
+
+#[derive(Clone)]
+struct MyType {
+    x: i32,
+}
+
+impl Trait for MyType {
+    type Ty = MyType;
+
+    fn broken() -> Self::Ty {
+        Self::Ty { x: 1 }
+    }
+}
+
+fn main() {}