Skip to content

Commit f13317c

Browse files
committed
Use Display rather than Debug printing for const mismatch
1 parent f865b7d commit f13317c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/librustc/ty/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
159159
&format!("trait `{}`", values.found))
160160
}
161161
ConstMismatch(ref values) => {
162-
write!(f, "expected `{:?}`, found `{:?}`", values.expected, values.found)
162+
write!(f, "expected `{}`, found `{}`", values.expected, values.found)
163163
}
164164
}
165165
}

src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ error[E0308]: mismatched types
1414
--> $DIR/cannot-infer-type-for-const-param.rs:10:22
1515
|
1616
LL | let _ = Foo::<3>([1, 2, 3]);
17-
| ^^^^^^^^^ 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) }`
17+
| ^^^^^^^^^ expected `3`, found `3usize`
1818
|
1919
= note: expected type `[u8; _]`
2020
found type `[u8; 3]`

src/test/ui/consts/const-array-oob-arith.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
22
--> $DIR/const-array-oob-arith.rs:7:45
33
|
44
LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5];
5-
| ^^^ expected `Const { ty: usize, val: Scalar(0x0000000000000002) }`, found `Const { ty: usize, val: Scalar(0x0000000000000001) }`
5+
| ^^^ expected `2usize`, found `1usize`
66
|
77
= note: expected type `[i32; 2]`
88
found type `[i32; 1]`
@@ -11,7 +11,7 @@ error[E0308]: mismatched types
1111
--> $DIR/const-array-oob-arith.rs:8:44
1212
|
1313
LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99];
14-
| ^^^^^^^ expected `Const { ty: usize, val: Scalar(0x0000000000000001) }`, found `Const { ty: usize, val: Scalar(0x0000000000000002) }`
14+
| ^^^^^^^ expected `1usize`, found `2usize`
1515
|
1616
= note: expected type `[i32; 1]`
1717
found type `[i32; 2]`

0 commit comments

Comments
 (0)