Bubble up obligations
This commit is contained in:
parent
64dc377a10
commit
4a0473c0f5
3 changed files with 13 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
use rustc_infer::infer::TyCtxtInferExt;
|
use rustc_infer::infer::{DefiningAnchor, TyCtxtInferExt};
|
||||||
use rustc_middle::ty::query::Providers;
|
use rustc_middle::ty::query::Providers;
|
||||||
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
|
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
|
||||||
use rustc_span::source_map::DUMMY_SP;
|
use rustc_span::source_map::DUMMY_SP;
|
||||||
|
@ -16,7 +16,7 @@ fn evaluate_obligation<'tcx>(
|
||||||
canonical_goal: CanonicalPredicateGoal<'tcx>,
|
canonical_goal: CanonicalPredicateGoal<'tcx>,
|
||||||
) -> Result<EvaluationResult, OverflowError> {
|
) -> Result<EvaluationResult, OverflowError> {
|
||||||
debug!("evaluate_obligation(canonical_goal={:#?})", canonical_goal);
|
debug!("evaluate_obligation(canonical_goal={:#?})", canonical_goal);
|
||||||
tcx.infer_ctxt().enter_with_canonical(
|
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).enter_with_canonical(
|
||||||
DUMMY_SP,
|
DUMMY_SP,
|
||||||
&canonical_goal,
|
&canonical_goal,
|
||||||
|ref infcx, goal, _canonical_inference_vars| {
|
|ref infcx, goal, _canonical_inference_vars| {
|
||||||
|
|
|
@ -2,7 +2,7 @@ use rustc_hir as hir;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_infer::infer::at::ToTrace;
|
use rustc_infer::infer::at::ToTrace;
|
||||||
use rustc_infer::infer::canonical::{Canonical, QueryResponse};
|
use rustc_infer::infer::canonical::{Canonical, QueryResponse};
|
||||||
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
|
use rustc_infer::infer::{DefiningAnchor, InferCtxt, TyCtxtInferExt};
|
||||||
use rustc_infer::traits::TraitEngineExt as _;
|
use rustc_infer::traits::TraitEngineExt as _;
|
||||||
use rustc_middle::ty::query::Providers;
|
use rustc_middle::ty::query::Providers;
|
||||||
use rustc_middle::ty::subst::{GenericArg, Subst, UserSelfTy, UserSubsts};
|
use rustc_middle::ty::subst::{GenericArg, Subst, UserSelfTy, UserSubsts};
|
||||||
|
@ -258,10 +258,13 @@ fn type_op_prove_predicate<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, ProvePredicate<'tcx>>>,
|
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, ProvePredicate<'tcx>>>,
|
||||||
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
|
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
|
||||||
tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |infcx, fulfill_cx, key| {
|
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).enter_canonical_trait_query(
|
||||||
|
&canonicalized,
|
||||||
|
|infcx, fulfill_cx, key| {
|
||||||
type_op_prove_predicate_with_cause(infcx, fulfill_cx, key, ObligationCause::dummy());
|
type_op_prove_predicate_with_cause(infcx, fulfill_cx, key, ObligationCause::dummy());
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The core of the `type_op_prove_predicate` query: for diagnostics purposes in NLL HRTB errors,
|
/// The core of the `type_op_prove_predicate` query: for diagnostics purposes in NLL HRTB errors,
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
error[E0275]: overflow evaluating the requirement `<fn() -> Foo {foo} as FnOnce<()>>::Output == fn() -> Foo {foo}`
|
error[E0275]: overflow evaluating the requirement `fn() -> Foo {foo}: Sized`
|
||||||
--> $DIR/issue-53398-cyclic-types.rs:5:13
|
--> $DIR/issue-53398-cyclic-types.rs:5:13
|
||||||
|
|
|
|
||||||
LL | fn foo() -> Foo {
|
LL | fn foo() -> Foo {
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
||||||
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_53398_cyclic_types`)
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue