Skip to content

wfcheck: pre-normalization implied bounds are not used. #105948

Open
@aliemjay

Description

@aliemjay

Here is an inconsistency in behavior between wfcheck and borrowck:

trait Trait { type Ty; }
impl<T> Trait for T { type Ty = (); }

// borrowck is able to assume `T: 'static`:
fn pass<T>(_: <&'static T as Trait>::Ty) { None::<&'static T>; }

// ... while wfcheck can't:
fn fail<T>(_: <&'static T as Trait>::Ty) where &'static T: Sized, {}
//~^ ERROR the parameter type `T` may not live long enough

#100989 Introduced this. I think the intent was to restrict implied bounds from impl headers only, not fn signatures. Cc @lcnr.

@rustbot label C-bug T-types A-implied-bounds

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-implied-boundsArea: Implied bounds / inferred outlives-boundsC-bugCategory: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions