Skip to content

opaque type auto trait leakage is used even when item bounds would be sufficient #158

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

Open
lcnr opened this issue Jan 29, 2025 · 0 comments · Fixed by rust-lang/rust#139789

Comments

@lcnr
Copy link
Contributor

lcnr commented Jan 29, 2025

fn foo() -> impl Send {
    bar()
}

fn is_send<T: Send>(_: T) {} 

fn bar() -> impl Send {
    if false {
        is_send(foo()); // failure in new solver only
    }
}

also affects the following RPITIT test:

  • tests/ui/impl-trait/in-trait/refine-cycle.rs

We could stop auto trait leakage if the auto trait is part of the item bounds of the opaque. Lets wait until we encounter this issue in practice, even if I consider that change desirable regardless

@lcnr lcnr moved this to potentially irrelevant in -Znext-solver=globally Jan 29, 2025
Zalathar added a commit to Zalathar/rust that referenced this issue Apr 15, 2025
…=compiler-errors

do not unnecessarily leak auto traits in item bounds

fixes rust-lang/trait-system-refactor-initiative#158

Not a fix for rust-lang/trait-system-refactor-initiative#173 as you may have realized/tried yourself, cc rust-lang#139788. However, fixing this feels desirable regardless and I don't see any reason not to.

r? `@compiler-errors`
jieyouxu added a commit to jieyouxu/rust that referenced this issue Apr 15, 2025
…=compiler-errors

do not unnecessarily leak auto traits in item bounds

fixes rust-lang/trait-system-refactor-initiative#158

Not a fix for rust-lang/trait-system-refactor-initiative#173 as you may have realized/tried yourself, cc rust-lang#139788. However, fixing this feels desirable regardless and I don't see any reason not to.

r? ``@compiler-errors``
Zalathar added a commit to Zalathar/rust that referenced this issue Apr 15, 2025
…=compiler-errors

do not unnecessarily leak auto traits in item bounds

fixes rust-lang/trait-system-refactor-initiative#158

Not a fix for rust-lang/trait-system-refactor-initiative#173 as you may have realized/tried yourself, cc rust-lang#139788. However, fixing this feels desirable regardless and I don't see any reason not to.

r? ```@compiler-errors```
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 15, 2025
Rollup merge of rust-lang#139789 - lcnr:opaques-auto-trait-leakage, r=compiler-errors

do not unnecessarily leak auto traits in item bounds

fixes rust-lang/trait-system-refactor-initiative#158

Not a fix for rust-lang/trait-system-refactor-initiative#173 as you may have realized/tried yourself, cc rust-lang#139788. However, fixing this feels desirable regardless and I don't see any reason not to.

r? ```@compiler-errors```
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this issue Apr 17, 2025
…-errors

do not unnecessarily leak auto traits in item bounds

fixes rust-lang/trait-system-refactor-initiative#158

Not a fix for rust-lang/trait-system-refactor-initiative#173 as you may have realized/tried yourself, cc #139788. However, fixing this feels desirable regardless and I don't see any reason not to.

r? ```@compiler-errors```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: potentially irrelevant
Development

Successfully merging a pull request may close this issue.

1 participant