about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-05-25 21:00:29 +0100
committervarkor <github@varkor.com>2019-05-28 21:35:20 +0100
commitf13317ca2ee16163ee121fbdf28eb2184840b6dd (patch)
tree690a5021c4e7d193dc328396db1417c73cbedafe
parentf865b7dda43cd8e453ec1ce485d9155e5591248f (diff)
downloadrust-f13317ca2ee16163ee121fbdf28eb2184840b6dd.tar.gz
rust-f13317ca2ee16163ee121fbdf28eb2184840b6dd.zip
Use Display rather than Debug printing for const mismatch
-rw-r--r--src/librustc/ty/error.rs2
-rw-r--r--src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr2
-rw-r--r--src/test/ui/consts/const-array-oob-arith.stderr4
3 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs
index 9bf1dbe2958..0a2a9472eaa 100644
--- a/src/librustc/ty/error.rs
+++ b/src/librustc/ty/error.rs
@@ -159,7 +159,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
                                        &format!("trait `{}`", values.found))
             }
             ConstMismatch(ref values) => {
-                write!(f, "expected `{:?}`, found `{:?}`", values.expected, values.found)
+                write!(f, "expected `{}`, found `{}`", values.expected, values.found)
             }
         }
     }
diff --git a/src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr b/src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr
index 094bdbf486c..fb151648f2f 100644
--- a/src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr
+++ b/src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr
@@ -14,7 +14,7 @@ error[E0308]: mismatched types
   --> $DIR/cannot-infer-type-for-const-param.rs:10:22
    |
 LL |     let _ = Foo::<3>([1, 2, 3]);
-   |                      ^^^^^^^^^ expected `Const { ty: usize, val: Unevaluated(DefId(0:18 ~ cannot_infer_type_for_const_param[317d]::main[0]::{{constant}}[0]), []) }`, found `Const { ty: usize, val: Scalar(0x0000000000000003) }`
+   |                      ^^^^^^^^^ expected `3`, found `3usize`
    |
    = note: expected type `[u8; _]`
               found type `[u8; 3]`
diff --git a/src/test/ui/consts/const-array-oob-arith.stderr b/src/test/ui/consts/const-array-oob-arith.stderr
index 745d5904041..ded8207cdef 100644
--- a/src/test/ui/consts/const-array-oob-arith.stderr
+++ b/src/test/ui/consts/const-array-oob-arith.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
   --> $DIR/const-array-oob-arith.rs:7:45
    |
 LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5];
-   |                                             ^^^ expected `Const { ty: usize, val: Scalar(0x0000000000000002) }`, found `Const { ty: usize, val: Scalar(0x0000000000000001) }`
+   |                                             ^^^ expected `2usize`, found `1usize`
    |
    = note: expected type `[i32; 2]`
               found type `[i32; 1]`
@@ -11,7 +11,7 @@ error[E0308]: mismatched types
   --> $DIR/const-array-oob-arith.rs:8:44
    |
 LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99];
-   |                                            ^^^^^^^ expected `Const { ty: usize, val: Scalar(0x0000000000000001) }`, found `Const { ty: usize, val: Scalar(0x0000000000000002) }`
+   |                                            ^^^^^^^ expected `1usize`, found `2usize`
    |
    = note: expected type `[i32; 1]`
               found type `[i32; 2]`