diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 8288a45ad636b..fc34a71f39221 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -424,8 +424,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { "_Self".to_owned(), Some(format!("[{}]", self.tcx.type_of(def.did).to_string())), )); + let tcx = self.tcx; if let Some(len) = len.val.try_to_scalar().and_then(|scalar| { - scalar.to_u64().ok() + scalar.to_usize(tcx).ok() }) { flags.push(( "_Self".to_owned(),