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`.