Skip to content

Unsound associated type outlives bound due to lazy norm #59

@compiler-errors

Description

@compiler-errors
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?

Activity

added
not-blocking-coherenceAn issue we can resolve after stabilizing the new solver during coherence
on Sep 14, 2023
compiler-errors

compiler-errors commented on Sep 20, 2023

@compiler-errors
MemberAuthor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    not-blocking-coherenceAn issue we can resolve after stabilizing the new solver during coherence

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @compiler-errors@lcnr

        Issue actions

          Unsound associated type outlives bound due to lazy norm · Issue #59 · rust-lang/trait-system-refactor-initiative