about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDominik Stolz <d.stolz@tum.de>2022-06-28 22:35:48 +0200
committerDominik Stolz <d.stolz@tum.de>2022-06-28 22:38:32 +0200
commitcd88bb332c40deda6db2c18c0bc03cfd0da42055 (patch)
treea8c6e05321adf47e899a2b44f233ff270ff4fecc /src
parent94e93749ab00539a11e90426ea87382c433530a8 (diff)
downloadrust-cd88bb332c40deda6db2c18c0bc03cfd0da42055.tar.gz
rust-cd88bb332c40deda6db2c18c0bc03cfd0da42055.zip
Improve pretty printing of valtrees for references
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/const-generics/issue-66451.rs28
-rw-r--r--src/test/ui/const-generics/issue-66451.stderr20
2 files changed, 48 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/issue-66451.rs b/src/test/ui/const-generics/issue-66451.rs
new file mode 100644
index 00000000000..76505d18875
--- /dev/null
+++ b/src/test/ui/const-generics/issue-66451.rs
@@ -0,0 +1,28 @@
+#![feature(adt_const_params)]
+#![allow(incomplete_features)]
+
+#[derive(Debug, PartialEq, Eq)]
+struct Foo {
+    value: i32,
+    nested: &'static Bar<i32>,
+}
+
+#[derive(Debug, PartialEq, Eq)]
+struct Bar<T>(T);
+
+struct Test<const F: Foo>;
+
+fn main() {
+    let x: Test<{
+        Foo {
+            value: 3,
+            nested: &Bar(4),
+        }  
+    }> = Test;
+    let y: Test<{
+        Foo {
+            value: 3,
+            nested: &Bar(5),
+        }
+    }> = x; //~ ERROR mismatched types
+}
diff --git a/src/test/ui/const-generics/issue-66451.stderr b/src/test/ui/const-generics/issue-66451.stderr
new file mode 100644
index 00000000000..b691eac4f2d
--- /dev/null
+++ b/src/test/ui/const-generics/issue-66451.stderr
@@ -0,0 +1,20 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-66451.rs:27:10
+   |
+LL |       let y: Test<{
+   |  ____________-
+LL | |         Foo {
+LL | |             value: 3,
+LL | |             nested: &Bar(5),
+LL | |         }
+LL | |     }> = x;
+   | |      -   ^ expected `Foo { value: 3_i32, nested: &Bar::<i32>(5_i32) }`, found `Foo { value: 3_i32, nested: &Bar::<i32>(4_i32) }`
+   | |______|
+   |        expected due to this
+   |
+   = note: expected struct `Test<Foo { value: 3_i32, nested: &Bar::<i32>(5_i32) }>`
+              found struct `Test<Foo { value: 3_i32, nested: &Bar::<i32>(4_i32) }>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.