Skip to content

Commit

Permalink
Allow inference regions when relating consts
Browse files Browse the repository at this point in the history
Fixes #73050
  • Loading branch information
tmandry committed Jun 11, 2020
1 parent 3d5d0f8 commit d794313
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 1 addition & 10 deletions src/librustc_middle/ty/relate.rs
Expand Up @@ -508,16 +508,7 @@ pub fn super_relate_consts<R: TypeRelation<'tcx>>(
debug!("{}.super_relate_consts(a = {:?}, b = {:?})", relation.tag(), a, b);
let tcx = relation.tcx();

let eagerly_eval = |x: &'tcx ty::Const<'tcx>| {
// FIXME(eddyb) this doesn't account for lifetime inference variables
// being erased by `eval`, *nor* for the polymorphic aspect of `eval`.
// That is, we could always use `eval` and it will just return the
// old value back if it doesn't succeed.
if !x.val.needs_infer() {
return x.eval(tcx, relation.param_env()).val;
}
x.val
};
let eagerly_eval = |x: &'tcx ty::Const<'tcx>| x.eval(tcx, relation.param_env()).val;

// FIXME(eddyb) doesn't look like everything below checks that `a.ty == b.ty`.
// We could probably always assert it early, as `const` generic parameters
Expand Down
12 changes: 12 additions & 0 deletions src/test/ui/async-await/issue-73050.rs
@@ -0,0 +1,12 @@
// check-pass
// edition:2018

#[allow(unused)]
async fn foo<'a>() {
let _data = &mut [0u8; { 1 + 4 }];
bar().await
}

async fn bar() {}

fn main() {}

0 comments on commit d794313

Please sign in to comment.