Created
October 26, 2014 16:31
-
-
Save globin/d9c6e9ac12906b929fc2 to your computer and use it in GitHub Desktop.
struct_gen.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8:21: 8:33 error: cannot borrow immutable field as mutable | |
8 s_def.fields.push(Spanned { | |
^~~~~~~~~~~~ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mut strukt = (quote_item!(cx, | |
#[deriving(Show)] | |
struct $name; | |
)).unwrap(); | |
strukt.map(|mut s| { | |
match s.node { | |
ItemStruct(ref mut s_def, _) => { | |
s_def.fields.push(Spanned { | |
node: StructField_ { | |
kind: NamedField(r.columns[0].name, Public), | |
id: ast::DUMMY_NODE_ID, | |
ty: quote_ty!(cx, uint), | |
attrs: vec![] | |
}, | |
span: sp | |
}) | |
} | |
_ => () | |
}; | |
s | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment