mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Rollup merge of #99714 - ouz-a:issue_57961, r=oli-obk
Fix regression introduced with #99383 Fixes #99642
This commit is contained in:
commit
91b8b9ba4b
@ -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::{ParamEnvAnd, TyCtxt};
|
||||
use rustc_span::source_map::DUMMY_SP;
|
||||
@ -16,7 +16,9 @@ fn evaluate_obligation<'tcx>(
|
||||
canonical_goal: CanonicalPredicateGoal<'tcx>,
|
||||
) -> Result<EvaluationResult, OverflowError> {
|
||||
debug!("evaluate_obligation(canonical_goal={:#?})", canonical_goal);
|
||||
tcx.infer_ctxt().enter_with_canonical(
|
||||
// HACK This bubble is required for this tests to pass:
|
||||
// impl-trait/issue99642.rs
|
||||
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).enter_with_canonical(
|
||||
DUMMY_SP,
|
||||
&canonical_goal,
|
||||
|ref infcx, goal, _canonical_inference_vars| {
|
||||
|
@ -2,7 +2,7 @@ use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_infer::infer::at::ToTrace;
|
||||
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_middle::ty::query::Providers;
|
||||
use rustc_middle::ty::subst::{GenericArg, Subst, UserSelfTy, UserSubsts};
|
||||
@ -258,10 +258,15 @@ fn type_op_prove_predicate<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, ProvePredicate<'tcx>>>,
|
||||
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
|
||||
tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |infcx, fulfill_cx, key| {
|
||||
type_op_prove_predicate_with_cause(infcx, fulfill_cx, key, ObligationCause::dummy());
|
||||
Ok(())
|
||||
})
|
||||
// HACK This bubble is required for this test to pass:
|
||||
// impl-trait/issue-99642.rs
|
||||
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());
|
||||
Ok(())
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
/// The core of the `type_op_prove_predicate` query: for diagnostics purposes in NLL HRTB errors,
|
||||
|
8
src/test/ui/impl-trait/issue-99642-2.rs
Normal file
8
src/test/ui/impl-trait/issue-99642-2.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
type Opq = impl Sized;
|
||||
fn test() -> impl Iterator<Item = Opq> {
|
||||
Box::new(0..) as Box<dyn Iterator<Item = _>>
|
||||
}
|
||||
fn main(){}
|
7
src/test/ui/impl-trait/issue-99642.rs
Normal file
7
src/test/ui/impl-trait/issue-99642.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// check-pass
|
||||
|
||||
fn test() -> impl Iterator<Item = impl Sized> {
|
||||
Box::new(0..) as Box<dyn Iterator<Item = _>>
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -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
|
||||
|
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user