From 3ca0597a7e8b11f8a652419440701ef8a7a2c2f3 Mon Sep 17 00:00:00 2001 From: toidiu Date: Thu, 12 Jul 2018 17:12:27 -0400 Subject: [PATCH] test borrowing untagged enum --- .../tests/run-pass/untagged-and-borrow.rs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test_suite/tests/run-pass/untagged-and-borrow.rs diff --git a/test_suite/tests/run-pass/untagged-and-borrow.rs b/test_suite/tests/run-pass/untagged-and-borrow.rs new file mode 100644 index 00000000..9cc1027a --- /dev/null +++ b/test_suite/tests/run-pass/untagged-and-borrow.rs @@ -0,0 +1,25 @@ +// Copyright 2017 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(Deserialize)] +#[serde(untagged)] +enum RelData<'a> { + Single(#[serde(borrow)] RelObject<'a>), + Many(#[serde(borrow)] Vec>), +} + +#[derive(Deserialize)] +struct RelObject<'a> { + ty: &'a str, + id: String, +} + +fn main() {}