diff --git a/serde_derive_internals/src/check.rs b/serde_derive_internals/src/check.rs index 229896cd..c3df861b 100644 --- a/serde_derive_internals/src/check.rs +++ b/serde_derive_internals/src/check.rs @@ -229,7 +229,7 @@ fn check_adjacent_tag_conflict(cx: &Ctxt, cont: &Container) { if type_tag == content_tag { let message = format!( - "Enum tags `{}` for type and content conflict with each other", + "enum tags `{}` for type and content conflict with each other", type_tag ); cx.error(message); diff --git a/test_suite/tests/compile-fail/conflict/adjacent-tag.rs b/test_suite/tests/compile-fail/conflict/adjacent-tag.rs new file mode 100644 index 00000000..419afa4c --- /dev/null +++ b/test_suite/tests/compile-fail/conflict/adjacent-tag.rs @@ -0,0 +1,20 @@ +// Copyright 2018 Serde Developers +// +// Licensed under the Apache License, Version 2.0 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(Serialize)] //~ ERROR: proc-macro derive panicked +#[serde(tag = "conflict", content = "conflict")] +//~^^ HELP: enum tags `conflict` for type and content conflict with each other +enum E { + A, + B, +} + +fn main() {} diff --git a/test_suite/tests/compile-fail/conflict/internal-tag.rs b/test_suite/tests/compile-fail/conflict/internal-tag.rs new file mode 100644 index 00000000..777718bc --- /dev/null +++ b/test_suite/tests/compile-fail/conflict/internal-tag.rs @@ -0,0 +1,22 @@ +// Copyright 2018 Serde Developers +// +// Licensed under the Apache License, Version 2.0 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(Serialize)] //~ ERROR: proc-macro derive panicked +#[serde(tag = "conflict")] +//~^^ HELP: variant field name `conflict` conflicts with internal tag +enum E { + A { + #[serde(rename = "conflict")] + x: (), + }, +} + +fn main() {}