]> git.lizzy.rs Git - rust.git/commit
auto merge of #7142 : alexcrichton/rust/deriving-zero, r=pcwalton
authorbors <bors@rust-lang.org>
Sun, 16 Jun 2013 08:52:09 +0000 (01:52 -0700)
committerbors <bors@rust-lang.org>
Sun, 16 Jun 2013 08:52:09 +0000 (01:52 -0700)
commit08c1155a223eb79960e7a5dbb0ea6276ef9754ea
treefdbb9cbe16c75d9cb615fc651a3946fb6391ed17
parentd1927d295013e19e57a9773c37ded698e89392eb
parent893c70d7bc670054ef646b71d4d503298cc50d76
auto merge of #7142 : alexcrichton/rust/deriving-zero, r=pcwalton

This allows mass-initialization of large structs without having to specify all the fields.

I'm a bit hesitant, but I wanted to get this out there. I don't really like using the `Zero` trait, because it doesn't really make sense for a type like `HashMap` to use `Zero` as the 'blank allocation' trait. In theory there'd be a new trait, but then that's adding cruft to the language which may not necessarily need to be there.

I do think that this can be useful, but I only implemented `Zero` on the basic types where I thought it made sense, so it may not be all that usable yet. (opinions?)
src/libstd/str.rs
src/libstd/vec.rs
src/libsyntax/ext/deriving/mod.rs