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

Inference hazard due to lazy alias relate: Break it in the old solver? #168

Open
compiler-errors opened this issue Mar 21, 2025 · 2 comments
Labels
A-incomplete incorrectly return `NoSolution`, unsound during coherence S-breaking-change

Comments

@compiler-errors
Copy link
Member

compiler-errors commented Mar 21, 2025

Lazy alias relate causes us to no longer (incompletely) infer alias args when we don't normalize aliases to infer vars. That causes this code to (rightfully, IMO) fail:

trait Foo {
    type Assoc<'a>;
}

fn foo<'a, T: Foo>(_: <T as Foo>::Assoc<'a>) {}

fn test<'a, T: Foo>() {
    let y: fn(<T as Foo>::Assoc<'a>) = foo;
}

I'd like to prevent this from being more of an issue, but nothing comes to mind for a good scheme to weaken this inference in the old solver. Ideas?

@compiler-errors
Copy link
Member Author

(cannot remember if this is already tracked as an issue lol)

@lcnr
Copy link
Contributor

lcnr commented Mar 26, 2025

not sure 😅 doesn't really seem like it... definitely a known issue and I don't see how we can easily change this behavior in the old solver

@lcnr lcnr added S-breaking-change A-incomplete incorrectly return `NoSolution`, unsound during coherence labels Apr 4, 2025
@lcnr lcnr moved this from unknown to potentially irrelevant in -Znext-solver=globally Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incomplete incorrectly return `NoSolution`, unsound during coherence S-breaking-change
Projects
Status: potentially irrelevant
Development

No branches or pull requests

2 participants