Rollup merge of #105694 - ouz-a:issue_105689, r=estebank
Don't create dummy if val has escaping bounds var Skips creating/pushing obligations if val has escaping bounds vars. Fixes #105689
This commit is contained in:
commit
24e584b991
2 changed files with 28 additions and 12 deletions
|
@ -451,19 +451,21 @@ impl<'tcx> WfPredicates<'tcx> {
|
|||
GenericArgKind::Const(ct) => {
|
||||
match ct.kind() {
|
||||
ty::ConstKind::Unevaluated(uv) => {
|
||||
let obligations = self.nominal_obligations(uv.def.did, uv.substs);
|
||||
self.out.extend(obligations);
|
||||
if !ct.has_escaping_bound_vars() {
|
||||
let obligations = self.nominal_obligations(uv.def.did, uv.substs);
|
||||
self.out.extend(obligations);
|
||||
|
||||
let predicate =
|
||||
ty::Binder::dummy(ty::PredicateKind::ConstEvaluatable(ct));
|
||||
let cause = self.cause(traits::WellFormed(None));
|
||||
self.out.push(traits::Obligation::with_depth(
|
||||
self.tcx(),
|
||||
cause,
|
||||
self.recursion_depth,
|
||||
self.param_env,
|
||||
predicate,
|
||||
));
|
||||
let predicate =
|
||||
ty::Binder::dummy(ty::PredicateKind::ConstEvaluatable(ct));
|
||||
let cause = self.cause(traits::WellFormed(None));
|
||||
self.out.push(traits::Obligation::with_depth(
|
||||
self.tcx(),
|
||||
cause,
|
||||
self.recursion_depth,
|
||||
self.param_env,
|
||||
predicate,
|
||||
));
|
||||
}
|
||||
}
|
||||
ty::ConstKind::Infer(_) => {
|
||||
let cause = self.cause(traits::WellFormed(None));
|
||||
|
|
14
src/test/ui/const-generics/issue-105689.rs
Normal file
14
src/test/ui/const-generics/issue-105689.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// check-pass
|
||||
// edition:2021
|
||||
#![feature(generic_const_exprs)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
#[allow(unused)]
|
||||
async fn foo<'a>() {
|
||||
let _data = &mut [0u8; { 1 + 4 }];
|
||||
bar().await
|
||||
}
|
||||
|
||||
async fn bar() {}
|
||||
|
||||
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue