Skip to content

Commit d794313

Browse files
committed
Allow inference regions when relating consts
Fixes #73050
1 parent 3d5d0f8 commit d794313

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/librustc_middle/ty/relate.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -508,16 +508,7 @@ pub fn super_relate_consts<R: TypeRelation<'tcx>>(
508508
debug!("{}.super_relate_consts(a = {:?}, b = {:?})", relation.tag(), a, b);
509509
let tcx = relation.tcx();
510510

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

522513
// FIXME(eddyb) doesn't look like everything below checks that `a.ty == b.ty`.
523514
// We could probably always assert it early, as `const` generic parameters
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// check-pass
2+
// edition:2018
3+
4+
#[allow(unused)]
5+
async fn foo<'a>() {
6+
let _data = &mut [0u8; { 1 + 4 }];
7+
bar().await
8+
}
9+
10+
async fn bar() {}
11+
12+
fn main() {}

0 commit comments

Comments
 (0)