Skip to content

Bounds in for<...> are ignored #40486

Closed
Closed
@jhjourdan

Description

@jhjourdan

When writing for<'a : 'b> fn(...) -> ..., the constraint 'a : 'b is completely ignored by borrowcheck.

This makes it possible to write the following function, which is weird:

fn g<'b>(f : for<'c : 'b> fn(&'c mut i32) -> &'b mut i32) -> &'b mut i32 {
    let f2 : for<'c> fn(&'c mut i32) -> &'b mut i32 =
      f ; // WTF, we are dropping the constraint 'c : 'b ?
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemT-compilerRelevant to the compiler 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