Use Display rather than Debug printing for const mismatch

This commit is contained in:
varkor 2019-05-25 21:00:29 +01:00
parent f865b7dda4
commit f13317ca2e
3 changed files with 4 additions and 4 deletions

View File

@ -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)
}
}
}

View File

@ -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]`

View File

@ -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]`