Skip to content

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

Closed
Closed

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 ?
}

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Mar 13, 2017
  2. eddyb commented on Mar 13, 2017

    @eddyb
    Contributor
  3. petrochenkov commented on Mar 13, 2017

    @petrochenkov
    Contributor

    Same as #23051

  4. eddyb commented on Mar 13, 2017

    @eddyb
    Contributor

    @petrochenkov Ahh I tried looking for an existing issue but I couldn't (wrong keywords used), thanks!

  5. jhjourdan commented on Mar 13, 2017

    @jhjourdan
    ContributorAuthor

    Ah, indeed. Sorry for the noise. Closing.

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

    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