Rollup merge of #70957 - oli-obk:lazy_repeat_length_eval_ice, r=matthewjasper
Normalize MIR locals' types for generator layout computation. fixes #70905
This commit is contained in:
commit
eec86ba3bd
2 changed files with 14 additions and 1 deletions
|
@ -721,15 +721,18 @@ fn compute_layout<'tcx>(
|
||||||
_ => bug!(),
|
_ => bug!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let param_env = tcx.param_env(source.def_id());
|
||||||
|
|
||||||
for (local, decl) in body.local_decls.iter_enumerated() {
|
for (local, decl) in body.local_decls.iter_enumerated() {
|
||||||
// Ignore locals which are internal or not live
|
// Ignore locals which are internal or not live
|
||||||
if !live_locals.contains(local) || decl.internal {
|
if !live_locals.contains(local) || decl.internal {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
let decl_ty = tcx.normalize_erasing_regions(param_env, decl.ty);
|
||||||
|
|
||||||
// Sanity check that typeck knows about the type of locals which are
|
// Sanity check that typeck knows about the type of locals which are
|
||||||
// live across a suspension point
|
// live across a suspension point
|
||||||
if !allowed.contains(&decl.ty) && !allowed_upvars.contains(&decl.ty) {
|
if !allowed.contains(&decl_ty) && !allowed_upvars.contains(&decl_ty) {
|
||||||
span_bug!(
|
span_bug!(
|
||||||
body.span,
|
body.span,
|
||||||
"Broken MIR: generator contains type {} in MIR, \
|
"Broken MIR: generator contains type {} in MIR, \
|
||||||
|
|
10
src/test/ui/repeat_count_const_in_async_fn.rs
Normal file
10
src/test/ui/repeat_count_const_in_async_fn.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
// check-pass
|
||||||
|
// edition:2018
|
||||||
|
// compile-flags: --crate-type=lib
|
||||||
|
|
||||||
|
pub async fn test() {
|
||||||
|
const C: usize = 4;
|
||||||
|
foo(&mut [0u8; C]).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn foo(_: &mut [u8]) {}
|
Loading…
Add table
Add a link
Reference in a new issue