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

Better error if a struct defines its own 'de lifetime #893

Closed
dtolnay opened this issue Apr 22, 2017 · 1 comment
Closed

Better error if a struct defines its own 'de lifetime #893

dtolnay opened this issue Apr 22, 2017 · 1 comment
Assignees

Comments

@dtolnay
Copy link
Member

dtolnay commented Apr 22, 2017

#[macro_use]
extern crate serde_derive;

#[derive(Deserialize)]
struct S<'de, T: Deserialize<'de>> {
    t: T,
}
error[E0263]: lifetime name `'de` declared twice in the same scope
 --> src/main.rs:6:10
  |
4 | #[derive(Deserialize)]
  |          ^^^^^^^^^^^
  |          |
  |          previous declaration here
  |          declared twice

I would explicitly prefer not to support this use case (see https://github.com/Manishearth/rust-clippy/issues/1689). But it should fail with a helpful message rather than the current behavior of generating broken code.

@dtolnay
Copy link
Member Author

dtolnay commented May 8, 2018

Fixed in 7e3efaf.

@dtolnay dtolnay closed this as completed May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant