Auto merge of #5261 - matthiaskrgr:qmark, r=flip1995
use question mark operator changelog: none
This commit is contained in:
commit
e4d688c10a
@ -231,13 +231,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
|
||||
ExprKind::Tup(ref tup) => self.multi(tup).map(Constant::Tuple),
|
||||
ExprKind::Repeat(ref value, _) => {
|
||||
let n = match self.tables.expr_ty(e).kind {
|
||||
ty::Array(_, n) => {
|
||||
if let Some(n) = n.try_eval_usize(self.lcx.tcx, self.lcx.param_env) {
|
||||
n
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
},
|
||||
ty::Array(_, n) => n.try_eval_usize(self.lcx.tcx, self.lcx.param_env)?,
|
||||
_ => span_bug!(e.span, "typeck error"),
|
||||
};
|
||||
self.expr(value).map(|v| Constant::Repeat(Box::new(v), n))
|
||||
|
Loading…
x
Reference in New Issue
Block a user