about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFabian Wolff <fabian.wolff@alumni.ethz.ch>2021-07-27 22:24:43 +0200
committerFabian Wolff <fabian.wolff@alumni.ethz.ch>2021-07-28 01:41:52 +0200
commitdbd0fd2c2a6c0c5ea649dfb4d2a1b3d09e725ca0 (patch)
tree94d4d48ddbd3ee9929868c7017eed7e6136ed3ea /src
parent70f74719a92ef52bc28610ba04b7e98ada035ec9 (diff)
downloadrust-dbd0fd2c2a6c0c5ea649dfb4d2a1b3d09e725ca0.tar.gz
rust-dbd0fd2c2a6c0c5ea649dfb4d2a1b3d09e725ca0.zip
Fix ICE in `diagnostic_hir_wf_check`
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/wf/issue-87495.rs8
-rw-r--r--src/test/ui/wf/issue-87495.stderr18
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/wf/issue-87495.rs b/src/test/ui/wf/issue-87495.rs
new file mode 100644
index 00000000000..5aab7431134
--- /dev/null
+++ b/src/test/ui/wf/issue-87495.rs
@@ -0,0 +1,8 @@
+// Regression test for the ICE described in #87495.
+
+trait T {
+    const CONST: (bool, dyn T);
+    //~^ ERROR: the trait `T` cannot be made into an object [E0038]
+}
+
+fn main() {}
diff --git a/src/test/ui/wf/issue-87495.stderr b/src/test/ui/wf/issue-87495.stderr
new file mode 100644
index 00000000000..010200b5ded
--- /dev/null
+++ b/src/test/ui/wf/issue-87495.stderr
@@ -0,0 +1,18 @@
+error[E0038]: the trait `T` cannot be made into an object
+  --> $DIR/issue-87495.rs:4:25
+   |
+LL |     const CONST: (bool, dyn T);
+   |                         ^^^^^ `T` cannot be made into an object
+   |
+   = help: consider moving `CONST` to another trait
+note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+  --> $DIR/issue-87495.rs:4:11
+   |
+LL | trait T {
+   |       - this trait cannot be made into an object...
+LL |     const CONST: (bool, dyn T);
+   |           ^^^^^ ...because it contains this associated `const`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.