From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../tests/source/struct-field-attributes.rs | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/tools/rustfmt/tests/source/struct-field-attributes.rs (limited to 'src/tools/rustfmt/tests/source/struct-field-attributes.rs') diff --git a/src/tools/rustfmt/tests/source/struct-field-attributes.rs b/src/tools/rustfmt/tests/source/struct-field-attributes.rs new file mode 100644 index 000000000..76d6eda88 --- /dev/null +++ b/src/tools/rustfmt/tests/source/struct-field-attributes.rs @@ -0,0 +1,52 @@ +// #1535 +#![feature(struct_field_attributes)] + +struct Foo { + bar: u64, + + #[cfg(test)] + qux: u64, +} + +fn do_something() -> Foo { + Foo { + bar: 0, + + #[cfg(test)] + qux: 1, + } +} + +fn main() { + do_something(); +} + +// #1462 +struct Foo { + foo: usize, + #[cfg(feature="include-bar")] + bar: usize, +} + +fn new_foo() -> Foo { + Foo { + foo: 0, + #[cfg(feature="include-bar")] + bar: 0, + } +} + +// #2044 +pub enum State { + Closure(#[cfg_attr(feature = "serde_derive", serde(state_with = "::serialization::closure"))] GcPtr), +} + +struct Fields( + #[cfg_attr(feature = "serde_derive", serde(state_with = "::base::serialization::shared"))] Arc>, +); + +// #2309 +pub struct A { +#[doc="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"] +pub foos:Vec +} -- cgit v1.2.3