From d794313c41609e01c661cf29122a620ad583af9d Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Wed, 10 Jun 2020 17:08:22 -0700 Subject: [PATCH] Allow inference regions when relating consts Fixes #73050 --- src/librustc_middle/ty/relate.rs | 11 +---------- src/test/ui/async-await/issue-73050.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 src/test/ui/async-await/issue-73050.rs diff --git a/src/librustc_middle/ty/relate.rs b/src/librustc_middle/ty/relate.rs index d507fcbc19404..aeb3a0716fb42 100644 --- a/src/librustc_middle/ty/relate.rs +++ b/src/librustc_middle/ty/relate.rs @@ -508,16 +508,7 @@ pub fn super_relate_consts>( 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 diff --git a/src/test/ui/async-await/issue-73050.rs b/src/test/ui/async-await/issue-73050.rs new file mode 100644 index 0000000000000..790f24a230b7e --- /dev/null +++ b/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() {}