update overflow handling for norm, add test
This commit is contained in:
parent
28e5c9505c
commit
442e112d17
3 changed files with 24 additions and 2 deletions
|
@ -352,7 +352,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
||||||
let &ty::Alias(_, projection_ty) = goal.predicate.self_ty().kind() else { return };
|
let &ty::Alias(_, projection_ty) = goal.predicate.self_ty().kind() else { return };
|
||||||
|
|
||||||
candidates.extend(self.probe(|_| ProbeKind::NormalizedSelfTyAssembly).enter(|ecx| {
|
candidates.extend(self.probe(|_| ProbeKind::NormalizedSelfTyAssembly).enter(|ecx| {
|
||||||
if num_steps < ecx.local_overflow_limit() {
|
if tcx.recursion_limit().value_within_limit(num_steps) {
|
||||||
let normalized_ty = ecx.next_ty_infer();
|
let normalized_ty = ecx.next_ty_infer();
|
||||||
let normalizes_to_goal = goal.with(
|
let normalizes_to_goal = goal.with(
|
||||||
tcx,
|
tcx,
|
||||||
|
|
|
@ -310,7 +310,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
||||||
depth: usize,
|
depth: usize,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
) -> Option<Ty<'tcx>> {
|
) -> Option<Ty<'tcx>> {
|
||||||
if depth >= self.local_overflow_limit() {
|
if !self.tcx().recursion_limit().value_within_limit(depth) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
// check-pass
|
||||||
|
// compile-flags: -Ztrait-solver=next
|
||||||
|
// regression test for trait-system-refactor-initiative#68
|
||||||
|
trait Identity {
|
||||||
|
type Assoc: ?Sized;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized> Identity for T {
|
||||||
|
type Assoc = T;
|
||||||
|
}
|
||||||
|
|
||||||
|
type Id<T> = <T as Identity>::Assoc;
|
||||||
|
|
||||||
|
type Five<T> = Id<Id<Id<Id<Id<T>>>>>;
|
||||||
|
type Ty<T> = Five<Five<Five<Five<Five<T>>>>>;
|
||||||
|
|
||||||
|
trait Trait<T> {}
|
||||||
|
|
||||||
|
impl<T> Trait<T> for Ty<T> {}
|
||||||
|
impl Trait<u32> for Ty<i32> {}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue