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

opaque auto trait leakage in coherence #65

Closed
Tracked by #114862
lcnr opened this issue Oct 2, 2023 · 2 comments
Closed
Tracked by #114862

opaque auto trait leakage in coherence #65

lcnr opened this issue Oct 2, 2023 · 2 comments

Comments

@lcnr
Copy link
Contributor

lcnr commented Oct 2, 2023

we should add tests that we don't leak auto traits of opaques in coherence and update the impl to make sure that we don't

@compiler-errors
Copy link
Member

compiler-errors commented Oct 2, 2023

This can never happen currently because we always hit ambiguity when normalizing a TAIT during candidate assembly. We probably should protect against it regardless, but I don't think we have any tests that are unsound currently.

I couldn't think of a more creative test than this tho:

#![feature(type_alias_impl_trait)]

mod foo {
    type Tait = impl Sized;

    pub struct Wrapper(Tait);

    fn test() -> Tait { std::ptr::null_mut::<()>() }
}

trait Foo {}

impl<T: Send> Foo for T {}

impl Foo for foo::Wrapper {}
//~^ ERROR conflict implementations of trait `Foo` for type `Wrapper`

@lcnr
Copy link
Contributor Author

lcnr commented Oct 13, 2023

closing due to rust-lang/rust#116689

@lcnr lcnr closed this as completed Oct 13, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 14, 2023
…compiler-errors

explicitly handle auto trait leakage in coherence

does not impact behavior but may avoid weird bugs in the future, cc rust-lang/trait-system-refactor-initiative#65

r? `@compiler-errors`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 14, 2023
…compiler-errors

explicitly handle auto trait leakage in coherence

does not impact behavior but may avoid weird bugs in the future, cc rust-lang/trait-system-refactor-initiative#65

r? ``@compiler-errors``
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 14, 2023
Rollup merge of rust-lang#116689 - lcnr:auto-trait-hidden-ty-leak, r=compiler-errors

explicitly handle auto trait leakage in coherence

does not impact behavior but may avoid weird bugs in the future, cc rust-lang/trait-system-refactor-initiative#65

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
None yet
Development

No branches or pull requests

2 participants