Change Scalar to numeric cast

This commit is contained in:
Esteban Küber 2018-10-15 10:12:29 -07:00
parent 5beeb535e1
commit def0f544a3

View File

@ -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(),