From 7e3efaf6c5c3ba5f28dcc8854ae1e551664c09f8 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 7 May 2018 21:15:21 -0700 Subject: [PATCH] Improve error when a 'de lifetime parameter already exists --- serde_derive/src/de.rs | 16 ++++++++++++++++ .../precondition/deserialize_de_lifetime.rs | 15 +++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 test_suite/tests/compile-fail/precondition/deserialize_de_lifetime.rs diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs index e88d1dd8..73c15b02 100644 --- a/serde_derive/src/de.rs +++ b/serde_derive/src/de.rs @@ -82,6 +82,11 @@ pub fn expand_derive_deserialize(input: &syn::DeriveInput) -> Result or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[macro_use] +extern crate serde_derive; + +#[derive(Deserialize)] //~ ERROR: proc-macro derive panicked +struct S<'de> { + s: &'de str, //~^^ HELP: cannot deserialize when there is a lifetime parameter called 'de +}