about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_middle/src/ty/diagnostics.rs2
-rw-r--r--src/test/ui/const-generics/defaults/mismatch.full.stderr8
-rw-r--r--src/test/ui/const-generics/defaults/mismatch.min.stderr8
-rw-r--r--src/test/ui/const-generics/defaults/mismatch.rs2
4 files changed, 15 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs
index 982c8a354b4..866df2958a0 100644
--- a/compiler/rustc_middle/src/ty/diagnostics.rs
+++ b/compiler/rustc_middle/src/ty/diagnostics.rs
@@ -54,7 +54,7 @@ impl<'tcx> TyS<'tcx> {
     /// ADTs with no type arguments.
     pub fn is_simple_text(&self) -> bool {
         match self.kind() {
-            Adt(_, substs) => substs.types().next().is_none(),
+            Adt(_, substs) => substs.types().next().is_none() && substs.consts().next().is_none(),
             Ref(_, ty, _) => ty.is_simple_text(),
             _ => self.is_simple_ty(),
         }
diff --git a/src/test/ui/const-generics/defaults/mismatch.full.stderr b/src/test/ui/const-generics/defaults/mismatch.full.stderr
index be4f364d8ee..741137afe45 100644
--- a/src/test/ui/const-generics/defaults/mismatch.full.stderr
+++ b/src/test/ui/const-generics/defaults/mismatch.full.stderr
@@ -5,6 +5,9 @@ LL |     let e: Example::<13> = ();
    |            -------------   ^^ expected struct `Example`, found `()`
    |            |
    |            expected due to this
+   |
+   = note: expected struct `Example`
+           found unit type `()`
 
 error[E0308]: mismatched types
   --> $DIR/mismatch.rs:14:34
@@ -40,12 +43,15 @@ LL |     let e: Example3::<7> = ();
            found unit type `()`
 
 error[E0308]: mismatched types
-  --> $DIR/mismatch.rs:22:28
+  --> $DIR/mismatch.rs:20:28
    |
 LL |     let e: Example4::<7> = ();
    |            -------------   ^^ expected struct `Example4`, found `()`
    |            |
    |            expected due to this
+   |
+   = note: expected struct `Example4<7_usize>`
+           found unit type `()`
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/const-generics/defaults/mismatch.min.stderr b/src/test/ui/const-generics/defaults/mismatch.min.stderr
index be4f364d8ee..741137afe45 100644
--- a/src/test/ui/const-generics/defaults/mismatch.min.stderr
+++ b/src/test/ui/const-generics/defaults/mismatch.min.stderr
@@ -5,6 +5,9 @@ LL |     let e: Example::<13> = ();
    |            -------------   ^^ expected struct `Example`, found `()`
    |            |
    |            expected due to this
+   |
+   = note: expected struct `Example`
+           found unit type `()`
 
 error[E0308]: mismatched types
   --> $DIR/mismatch.rs:14:34
@@ -40,12 +43,15 @@ LL |     let e: Example3::<7> = ();
            found unit type `()`
 
 error[E0308]: mismatched types
-  --> $DIR/mismatch.rs:22:28
+  --> $DIR/mismatch.rs:20:28
    |
 LL |     let e: Example4::<7> = ();
    |            -------------   ^^ expected struct `Example4`, found `()`
    |            |
    |            expected due to this
+   |
+   = note: expected struct `Example4<7_usize>`
+           found unit type `()`
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/const-generics/defaults/mismatch.rs b/src/test/ui/const-generics/defaults/mismatch.rs
index 68a640c0a08..cfc8594f17c 100644
--- a/src/test/ui/const-generics/defaults/mismatch.rs
+++ b/src/test/ui/const-generics/defaults/mismatch.rs
@@ -17,8 +17,6 @@ fn main() {
     //~^ Error: mismatched types
     let e: Example3::<7> = ();
     //~^ Error: mismatched types
-    // FIXME(const_generics_defaults): There should be a note for the error below, but it is
-    // missing.
     let e: Example4::<7> = ();
     //~^ Error: mismatched types
 }