Skip to content

Commit def0f54

Browse files
committed
Change Scalar to numeric cast
1 parent 5beeb53 commit def0f54

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: src/librustc/traits/error_reporting.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
424424
"_Self".to_owned(),
425425
Some(format!("[{}]", self.tcx.type_of(def.did).to_string())),
426426
));
427+
let tcx = self.tcx;
427428
if let Some(len) = len.val.try_to_scalar().and_then(|scalar| {
428-
scalar.to_u64().ok()
429+
scalar.to_usize(tcx).ok()
429430
}) {
430431
flags.push((
431432
"_Self".to_owned(),

0 commit comments

Comments
 (0)