Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unconstrained RPIT cause ambiguity errors instead of falling back to () #144

Open
lcnr opened this issue Jan 21, 2025 · 1 comment
Open

Comments

@lcnr
Copy link
Contributor

lcnr commented Jan 21, 2025

  • affected tests
    • tests/ui/impl-trait/recursive-impl-trait-type-direct.rs
    • tests/ui/impl-trait/issue-103599.rs
trait T {}

fn wrap(x: impl T) -> impl T {
    //~^ WARN function cannot return without recursing
    wrap(wrap(x))
}

fn main() {}
@lcnr lcnr changed the title unconstrained RPIT types error instead of falling back to () unconstrained RPIT error instead of falling back to () Jan 21, 2025
@lcnr lcnr changed the title unconstrained RPIT error instead of falling back to () unconstrained RPIT cause ambiguity errors instead of falling back to () Jan 21, 2025
@compiler-errors
Copy link
Member

compiler-errors commented Jan 22, 2025

The root cause of this is probably a combination of
(1.) we can rely on opaques's item bounds holding in the defining scope even if we don't know the hidden type.
(2.) an opaque can be defined to its own opaque type, which we special-case in writeback and ultimately ignore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: unknown
Development

No branches or pull requests

2 participants