about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-04-06 17:15:31 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-04-06 17:15:31 +0530
commitaf7b00b68fc7960e98fb914be52d9a6a16fe2224 (patch)
tree13260050b5b5463c491ae61c941f60477421fdc0 /src/libsyntax/ext
parent772c600d4d6f39daa6d07d1a60ee0df3d3426978 (diff)
parent8fe4290f1cf87bf7b0a0661e6bbe84f3319e614d (diff)
downloadrust-af7b00b68fc7960e98fb914be52d9a6a16fe2224.tar.gz
rust-af7b00b68fc7960e98fb914be52d9a6a16fe2224.zip
Rollup merge of #32682 - petrochenkov:field3, r=Manishearth
 The AST part of https://github.com/rust-lang/rust/pull/31937

Unlike HIR, AST still uses `Option` for field names because parser can't know field indexes reliably due to constructions like
```
struct S(#[cfg(false)] u8, u8); // The index of the second field changes from 1 during parsing to 0 after expansion.
```
and I wouldn't like to put the burden of renaming fields on expansion passes and syntax extensions.

plugin-[breaking-change] cc https://github.com/rust-lang/rust/issues/31645
r? @Manishearth
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/build.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 0eb42f17f68..a4e5b68277d 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -1007,12 +1007,14 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
 
     fn variant(&self, span: Span, name: Ident, tys: Vec<P<ast::Ty>> ) -> ast::Variant {
         let fields: Vec<_> = tys.into_iter().map(|ty| {
-            Spanned { span: ty.span, node: ast::StructField_ {
+            ast::StructField {
+                span: ty.span,
                 ty: ty,
-                kind: ast::UnnamedField(ast::Visibility::Inherited),
+                ident: None,
+                vis: ast::Visibility::Inherited,
                 attrs: Vec::new(),
                 id: ast::DUMMY_NODE_ID,
-            }}
+            }
         }).collect();
 
         let vdata = if fields.is_empty() {