Rollup merge of #91907 - lcnr:const-arg-infer, r=BoxyUwU
Allow `_` as the length of array types and repeat expressions r? `@BoxyUwU` cc `@varkor`
This commit is contained in:
commit
ac7a867715
28 changed files with 268 additions and 85 deletions
|
@ -583,9 +583,12 @@ impl<'tcx> Cx<'tcx> {
|
|||
ExprKind::ConstBlock { value }
|
||||
}
|
||||
// Now comes the rote stuff:
|
||||
hir::ExprKind::Repeat(ref v, ref count) => {
|
||||
let count_def_id = self.tcx.hir().local_def_id(count.hir_id);
|
||||
let count = ty::Const::from_anon_const(self.tcx, count_def_id);
|
||||
hir::ExprKind::Repeat(ref v, _) => {
|
||||
let ty = self.typeck_results().expr_ty(expr);
|
||||
let count = match ty.kind() {
|
||||
ty::Array(_, ct) => ct,
|
||||
_ => span_bug!(expr.span, "unexpected repeat expr ty: {:?}", ty),
|
||||
};
|
||||
|
||||
ExprKind::Repeat { value: self.mirror_expr(v), count }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue