Skip to content

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

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

Closed
jhjourdan opened this issue Mar 13, 2017 · 4 comments
Closed

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

jhjourdan opened this issue Mar 13, 2017 · 4 comments
Labels
A-type-system Area: Type system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jhjourdan
Copy link
Contributor

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 ?
}
@steveklabnik steveklabnik added A-type-system Area: Type system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 13, 2017
@eddyb
Copy link
Member

eddyb commented Mar 13, 2017

cc @nikomatsakis

@petrochenkov
Copy link
Contributor

Same as #23051

@eddyb
Copy link
Member

eddyb commented Mar 13, 2017

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

@jhjourdan
Copy link
Contributor Author

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
Labels
A-type-system Area: Type system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants