From 7d796653b332e05fa19ac7cf80629dbd943c4f47 Mon Sep 17 00:00:00 2001 From: zakrad <49591476+zakrad@users.noreply.github.com> Date: Sun, 25 Oct 2026 02:00:44 +0330 Subject: [PATCH] Add regression test for self-referential inherent associated type ICE --- ...ential-inherent-assoc-type-issue-157774.rs | 21 +++++++++++++++++++ ...al-inherent-assoc-type-issue-157774.stderr | 15 +++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/ui/assumptions_on_binders/self-referential-inherent-assoc-type-issue-157774.rs create mode 100644 tests/ui/assumptions_on_binders/self-referential-inherent-assoc-type-issue-157774.stderr diff --git a/tests/ui/assumptions_on_binders/self-referential-inherent-assoc-type-issue-157774.rs b/tests/ui/assumptions_on_binders/self-referential-inherent-assoc-type-issue-157774.rs new file mode 100644 index 0000000000000..20ecdee0a1a4b --- /dev/null +++ b/tests/ui/assumptions_on_binders/self-referential-inherent-assoc-type-issue-157774.rs @@ -0,0 +1,21 @@ +//! Regression test for . +//! +//! A self-referential inherent associated type used to ICE with +//! `item_bounds called on` an impl item. + +//@ compile-flags: -Zassumptions-on-binders -Znext-solver=globally + +#![feature(inherent_associated_types)] +#![expect(incomplete_features)] + +struct Foo<'a> { + x: &'a (), +} + +impl<'a> Foo<'a> { + type Assoc = &'a Foo<'a>::Assoc; + //~^ ERROR overflow evaluating the requirement `Foo<'a>::Assoc == _` + //~| ERROR overflow evaluating whether `&'a Foo<'a>::Assoc` is well-formed +} + +fn main() {} diff --git a/tests/ui/assumptions_on_binders/self-referential-inherent-assoc-type-issue-157774.stderr b/tests/ui/assumptions_on_binders/self-referential-inherent-assoc-type-issue-157774.stderr new file mode 100644 index 0000000000000..cc95902b64e54 --- /dev/null +++ b/tests/ui/assumptions_on_binders/self-referential-inherent-assoc-type-issue-157774.stderr @@ -0,0 +1,15 @@ +error[E0275]: overflow evaluating the requirement `Foo<'a>::Assoc == _` + --> $DIR/self-referential-inherent-assoc-type-issue-157774.rs:16:5 + | +LL | type Assoc = &'a Foo<'a>::Assoc; + | ^^^^^^^^^^ + +error[E0275]: overflow evaluating whether `&'a Foo<'a>::Assoc` is well-formed + --> $DIR/self-referential-inherent-assoc-type-issue-157774.rs:16:5 + | +LL | type Assoc = &'a Foo<'a>::Assoc; + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0275`.