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

Can't put lifetime annotation on parameterized type #4290

Closed
stevenblenkinsop opened this issue Dec 25, 2012 · 1 comment
Closed

Can't put lifetime annotation on parameterized type #4290

stevenblenkinsop opened this issue Dec 25, 2012 · 1 comment
Labels
A-lifetimes Area: Lifetimes / regions
Milestone

Comments

@stevenblenkinsop
Copy link

This code fails to compile:

enum E1 = ∫

fn f1(v: &r/int) -> E1/&r { E1(v) }

enum E2<T> = &T;

fn f2<T>(v: &r/T) -> E2<T>/&r { E2(v) }

fn main() {
        let v = &5;
        io::println(fmt!("%d", **f1(v)));
        io::println(fmt!("%d", **f2(v)));
}

test.rs:7:26: 7:27 error: expected { but found /
test.rs:7 fn f2<T>(v: &r/T) -> E2<T>/&r { E2(v) }

@stevenblenkinsop
Copy link
Author

Found out syntax for this was E2/&r<T> from @nikomatsakis' blog post. Probably needs to be documented somewhere at some point, but that's issue #3886 (which seems to have been closed on the basis that &r/T is already documented, when the issue was about T/&r...).

oli-obk pushed a commit to oli-obk/rust that referenced this issue May 2, 2020
When checking for functions that are potential candidates for trait
implementations check the function header to make sure modifiers like
asyncness, constness and safety match before triggering the lint.

Fixes rust-lang#5413, rust-lang#4290
oli-obk pushed a commit to oli-obk/rust that referenced this issue May 2, 2020
Check fn header along with decl when suggesting to implement trait

When checking for functions that are potential candidates for trait
implementations check the function header to make sure modifiers like
asyncness, constness and safety match before triggering the lint.

Fixes rust-lang#5413, rust-lang#4290

changelog: check fn header along with decl for should_implement_trait
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