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

deduce_closure_signature bails on aliases referencing self #138

Closed
lcnr opened this issue Jan 21, 2025 · 1 comment · Fixed by rust-lang/rust#135892
Closed

deduce_closure_signature bails on aliases referencing self #138

lcnr opened this issue Jan 21, 2025 · 1 comment · Fixed by rust-lang/rust#135892

Comments

@lcnr
Copy link
Contributor

lcnr commented Jan 21, 2025

pub trait Fn0: Fn(i32) -> Self::Out {
    type Out;
}

impl<F: Fn(i32) -> ()> Fn0 for F {
    type Out = ();
}

pub fn closure_typer(_: impl Fn0) {}

fn main() {
    closure_typer(move |x| {
        let _: i64 = x.into();
    });
}

affected tests

  • tests/ui/closures/supertrait-hint-references-assoc-ty.rs
  • tests/ui/borrowck/issue-103095.rs
@lcnr lcnr changed the title deduce_closure_signature bails on aliases references self deduce_closure_signature bails on aliases referencing self Jan 21, 2025
@lcnr
Copy link
Contributor Author

lcnr commented Jan 21, 2025

this is similar to the occurs check: we should instead try to normalize these aliases

@BoxyUwU BoxyUwU self-assigned this Jan 22, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 28, 2025
…malized, r=lcnr

-Znext-solver: "normalize" signature before checking it mentions self in `deduce_closure_signature`

Fixes rust-lang/trait-system-refactor-initiative#138

r? `@lcnr`

Tbh I wrote so much comments I don't feel like writing it all again but as a description.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 28, 2025
…malized, r=lcnr

-Znext-solver: "normalize" signature before checking it mentions self in `deduce_closure_signature`

Fixes rust-lang/trait-system-refactor-initiative#138

r? `@lcnr`

Tbh I wrote so much comments I don't feel like writing it all again but as a description.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 28, 2025
…malized, r=lcnr

-Znext-solver: "normalize" signature before checking it mentions self in `deduce_closure_signature`

Fixes rust-lang/trait-system-refactor-initiative#138

r? ``@lcnr``

Tbh I wrote so much comments I don't feel like writing it all again but as a description.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 28, 2025
Rollup merge of rust-lang#135892 - BoxyUwU:next_solver_deduce_sig_normalized, r=lcnr

-Znext-solver: "normalize" signature before checking it mentions self in `deduce_closure_signature`

Fixes rust-lang/trait-system-refactor-initiative#138

r? ``@lcnr``

Tbh I wrote so much comments I don't feel like writing it all again but as a description.
@lcnr lcnr closed this as completed Jan 29, 2025
@lcnr lcnr moved this to done in -Znext-solver=globally Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2 participants