summary refs log tree commit diff
path: root/src/test/pretty/struct-pattern.rs
diff options
context:
space:
mode:
authorKevin Mehall <km@kevinmehall.net>2014-10-27 00:11:26 -0700
committerKevin Mehall <km@kevinmehall.net>2014-10-27 00:35:35 -0700
commite5f709079a2f9c5227e10f5f4cd0371a2fd76ae3 (patch)
treea60a4c92c4f9b906cb74846b79b17bafad7f2a7a /src/test/pretty/struct-pattern.rs
parentf037452447f5f46deb26e1c483fe88fb51a19198 (diff)
downloadrust-e5f709079a2f9c5227e10f5f4cd0371a2fd76ae3.tar.gz
rust-e5f709079a2f9c5227e10f5f4cd0371a2fd76ae3.zip
Preserve struct field pattern shorthand in the prettyprinter.
Use the `is_shorthand` field introduced by #17813 (ead6c4b) to make the
prettyprinter output the shorthand form. Fixes a few places that set
`is_shorthand: true` when the pattern is not a PatIdent with the same
name as the field.
Diffstat (limited to 'src/test/pretty/struct-pattern.rs')
-rw-r--r--src/test/pretty/struct-pattern.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/pretty/struct-pattern.rs b/src/test/pretty/struct-pattern.rs
new file mode 100644
index 00000000000..b0795bb08f3
--- /dev/null
+++ b/src/test/pretty/struct-pattern.rs
@@ -0,0 +1,15 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// pp-exact
+// pretty-compare-only
+// Testing that shorthand struct patterns are preserved
+
+fn main() { let Foo { a, ref b, mut c, x: y, z: z } = foo; }