From f13317ca2ee16163ee121fbdf28eb2184840b6dd Mon Sep 17 00:00:00 2001 From: varkor Date: Sat, 25 May 2019 21:00:29 +0100 Subject: [PATCH] Use Display rather than Debug printing for const mismatch --- src/librustc/ty/error.rs | 2 +- .../const-generics/cannot-infer-type-for-const-param.stderr | 2 +- src/test/ui/consts/const-array-oob-arith.stderr | 4 ++-- 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 @@ fn report_maybe_different(f: &mut fmt::Formatter<'_>, &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]`