Skip to content

Unsound associated type outlives bound due to lazy norm #59

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
compiler-errors opened this issue Aug 14, 2023 · 1 comment
Open

Unsound associated type outlives bound due to lazy norm #59

compiler-errors opened this issue Aug 14, 2023 · 1 comment
Labels
not-blocking-coherence An issue we can resolve after stabilizing the new solver during coherence

Comments

@compiler-errors
Copy link
Member

trait StaticTy {
    type Item<'a>: 'static;
}

impl StaticTy for () {
    type Item<'a> = &'a ();
    //~^ ERROR  the type `&'a ()` does not fulfill the required lifetime
}

fn main() {}

This code passes with -Ztrait-solver=next in check_type_bounds since we don't normalize the types that show up in type-outlives bounds, so we end up seeing a ty::Alias during process_registered_region_obligations and end up using the item bounds :/

We might need to pass a normalization fn down to process_registered_region_obligations like we do for trait_ref_is_knowable?

@lcnr lcnr added the not-blocking-coherence An issue we can resolve after stabilizing the new solver during coherence label Sep 14, 2023
@compiler-errors
Copy link
Member Author

This is because we register the item bounds without actually replacing the self type in check_type_bounds. I don't think we should be replacing the self type, I also don't know what we could do to fix this honestly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-blocking-coherence An issue we can resolve after stabilizing the new solver during coherence
Projects
None yet
Development

No branches or pull requests

2 participants