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) => {
|
GenericArgKind::Const(ct) => {
|
||||||
match ct.kind() {
|
match ct.kind() {
|
||||||
ty::ConstKind::Unevaluated(uv) => {
|
ty::ConstKind::Unevaluated(uv) => {
|
||||||
let obligations = self.nominal_obligations(uv.def.did, uv.substs);
|
if !ct.has_escaping_bound_vars() {
|
||||||
self.out.extend(obligations);
|
let obligations = self.nominal_obligations(uv.def.did, uv.substs);
|
||||||
|
self.out.extend(obligations);
|
||||||
|
|
||||||
let predicate =
|
let predicate =
|
||||||
ty::Binder::dummy(ty::PredicateKind::ConstEvaluatable(ct));
|
ty::Binder::dummy(ty::PredicateKind::ConstEvaluatable(ct));
|
||||||
let cause = self.cause(traits::WellFormed(None));
|
let cause = self.cause(traits::WellFormed(None));
|
||||||
self.out.push(traits::Obligation::with_depth(
|
self.out.push(traits::Obligation::with_depth(
|
||||||
self.tcx(),
|
self.tcx(),
|
||||||
cause,
|
cause,
|
||||||
self.recursion_depth,
|
self.recursion_depth,
|
||||||
self.param_env,
|
self.param_env,
|
||||||
predicate,
|
predicate,
|
||||||
));
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ty::ConstKind::Infer(_) => {
|
ty::ConstKind::Infer(_) => {
|
||||||
let cause = self.cause(traits::WellFormed(None));
|
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