Skip to content
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

Lifetime arguments are completely ignored in method calls #42403

Closed
petrochenkov opened this issue Jun 3, 2017 · 1 comment
Closed

Lifetime arguments are completely ignored in method calls #42403

petrochenkov opened this issue Jun 3, 2017 · 1 comment
Labels
A-lifetimes Area: Lifetimes / regions

Comments

@petrochenkov
Copy link
Contributor

petrochenkov commented Jun 3, 2017

This snippet successfully compiles despite f not having lifetime parameters and even 'a, 'b, 'c being non-existent.

struct S;

impl S {
    fn f(self) {}   
}

fn main() {
    S.f::<'a, 'b, 'c>();
}

The parser parses lifetime arguments, but doesn't store them anywhere, so they don't present in AST/HIR.
The issue exists since Rust 1.0.

@petrochenkov petrochenkov added the A-lifetimes Area: Lifetimes / regions label Jun 3, 2017
@petrochenkov
Copy link
Contributor Author

Supposedly they should be stored and then treated exactly like arguments in the UFCS form S::f::<'a, 'b, 'c>.

bors added a commit that referenced this issue Jul 18, 2017
Support generic lifetime arguments in method calls

Fixes #42403
Fixes #42115
Lifetimes in a method call `x.f::<'a, 'b, T, U>()` are treated exactly like lifetimes in the equivalent UFCS call `X::f::<'a, 'b, T, U>`.
In addition, if the method has late bound lifetime parameters (explicit or implicit), then explicitly specifying lifetime arguments is not permitted (guarded by a compatibility lint).
[breaking-change] because previously lifetimes in method calls were accepted unconditionally.

r? @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: Lifetimes / regions
Projects
None yet
Development

No branches or pull requests

1 participant