summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving
AgeCommit message (Collapse)AuthorLines
2014-03-31vec: convert `append` and `append_one` to methodsDaniel Micay-3/+1
These were only free functions on `~[T]` because taking self by-value used to be broken.
2014-03-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-35/+39
2014-03-27serialize: use ResultSean McArthur-15/+55
All of Decoder and Encoder's methods now return a Result. Encodable.encode() and Decodable.decode() return a Result as well. fixes #12292
2014-03-26auto merge of #13145 : alexcrichton/rust/flip-some-defaults, r=brsonbors-3/+3
This change prepares `rustc` to accept private fields by default. These changes will have to go through a snapshot before the rest of the changes can happen.
2014-03-26syntax: Permit visibility on tuple fieldsAlex Crichton-3/+3
This change is in preparation for #8122. Nothing is currently done with these visibility qualifiers, they are just parsed and accepted by the compiler. RFC: 0004-private-fields
2014-03-25Changed `iter::Extendable` and `iter::FromIterator` to take a `Iterator` by ↵Marvin Löbel-2/+2
value
2014-03-23std: remove the `equals` method from `TotalEq`.Huon Wilson-7/+16
`TotalEq` is now just an assertion about the `Eq` impl of a type (i.e. `==` is a total equality if a type implements `TotalEq`) so the extra method is just confusing. Also, a new method magically appeared as a hack to allow deriving to assert that the contents of a struct/enum are also TotalEq, because the deriving infrastructure makes it very hard to do anything but create a trait method. (You didn't hear about this horrible work-around from me :(.)
2014-03-22Migrate all users of opt_vec to owned_slice, delete opt_vec.Huon Wilson-15/+14
syntax::opt_vec is now entirely unused, and so can go.
2014-03-21syntax: make OptVec immutable.Huon Wilson-10/+15
This is the first step to replacing OptVec with a new representation: remove all mutability. Any mutations have to go via `Vec` and then make to `OptVec`. Many of the uses of OptVec are unnecessary now that Vec has no-alloc emptiness (and have been converted to Vec): the only ones that really need it are the AST and sty's (and so on) where there are a *lot* of instances of them, and they're (mostly) immutable.
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-27/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-17/+17
Closes #12771
2014-03-18Docify std::vec_ngSteven Fackler-3/+3
I also removed a couple of methods that were silly and added sort.
2014-03-15Tag derived impls with #[automatically_derived]Steven Fackler-8/+4
This will enable rustdoc to treat them specially.
2014-03-12syntax: change the #[deriving(Hash)] typaram variable nameErick Tryzelaar-3/+3
2014-03-12Changed lists of lifetimes in ast and ty to use Vec instead of OptVec.Felix S. Klock II-7/+6
There is a broader revision (that does this across the board) pending in #12675, but that is awaiting the arrival of more data (to decide whether to keep OptVec alive by using a non-Vec internally). For this code, the representation of lifetime lists needs to be the same in both ScopeChain and in the ast and ty structures. So it seemed cleanest to just use `vec_ng::Vec`, now that it has a cheaper empty representation than the current `vec` code.
2014-03-12Update users for the std::rand -> librand move.Huon Wilson-1/+1
2014-03-12std: Move rand to librand.Huon Wilson-4/+3
This functionality is not super-core and so doesn't need to be included in std. It's possible that std may need rand (it does a little bit now, for io::test) in which case the functionality required could be moved to a secret hidden module and reexposed by librand. Unfortunately, using #[deprecated] here is hard: there's too much to mock to make it feasible, since we have to ensure that programs still typecheck to reach the linting phase.
2014-03-08Removed DeepClone. Issue #12698.Michael Darakananda-31/+0
2014-03-06syntax: Conditionally deriving(Hash) with WritersAlex Crichton-4/+16
If #[feature(default_type_parameters)] is enabled for a crate, then deriving(Hash) will expand with Hash<W: Writer> instead of Hash<SipState> so more hash algorithms can be used.
2014-03-03syntax: make match arms store the expr directly.Huon Wilson-2/+2
Previously `ast::Arm` was always storing a single `ast::Expr` wrapped in an `ast::Block` (for historical reasons, AIUI), so we might as just store that expr directly. Closes #3085.
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-30/+76
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-240/+232
2014-02-28syntax: Expand format!() deterministicallyAlex Crichton-1/+2
Previously, format!("{a}{b}", a=foo(), b=bar()) has foo() and bar() run in a nondeterminisc order. This is clearly a non-desirable property, so this commit uses iteration over a list instead of iteration over a hash map to provide deterministic code generation of these format arguments.
2014-02-27Fix syntax::ext::deriving{,::*} docs formatting.Chris Morgan-15/+17
The most significant fix is for `syntax::ext::deriving::encodable`, where one of the blocks of code, auspiciously containing `<S>` (recall that Markdown allows arbitrary HTML to be contained inside it), was not formatted as a code block, with a fun but messy effect.
2014-02-24Gate default type parameter overrides.Eduard Burtescu-16/+4
Fixes #12423.
2014-02-24Remove deriving(ToStr)Alex Crichton-134/+0
This has been superseded by deriving(Show). cc #9806
2014-02-24Update rustc/syntax docs now that rustdoc lexes all non-`notrust` code blocks.Huon Wilson-12/+12
This includes blocks made by indentation, so they need to be changed to explicitly have ```notrust ... ``` fences..
2014-02-24Transition to new `Hash`, removing IterBytes and std::to_bytes.Huon Wilson-102/+0
2014-02-23Move std::{trie, hashmap} to libcollectionsAlex Crichton-1/+1
These two containers are indeed collections, so their place is in libcollections, not in libstd. There will always be a hash map as part of the standard distribution of Rust, but by moving it out of the standard library it makes libstd that much more portable to more platforms and environments. This conveniently also removes the stuttering of 'std::hashmap::HashMap', although 'collections::HashMap' is only one character shorter.
2014-02-22auto merge of #12451 : edwardw/rust/ident-2-name, r=cmrbors-4/+4
Closes #7743.
2014-02-21std: rewrite Hash to make it more genericErick Tryzelaar-6/+105
This patch merges IterBytes and Hash traits, which clears up the confusion of using `#[deriving(IterBytes)]` to support hashing. Instead, it now is much easier to use the new `#[deriving(Hash)]` for making a type hashable with a stream hash. Furthermore, it supports custom non-stream-based hashers, such as if a value's hash was cached in a database. This does not yet replace the old IterBytes-hash with this new version.
2014-02-21syntax: Allow syntax extensions to have attributesErick Tryzelaar-8/+26
2014-02-22Represent lifetimes as Names instead of IdentsEdward Wang-4/+4
Closes #7743.
2014-02-19librustc: Remove unique vector patterns from the language.Patrick Walton-43/+45
Preparatory work for removing unique vectors from the language, which is itself preparatory work for dynamically sized types.
2014-02-14Fix all code examplesAlex Crichton-12/+20
2014-02-14auto merge of #12234 : sfackler/rust/restructure-item-decorator, r=huonwbors-65/+67
The old method of building up a list of items and threading it through all of the decorators was unwieldy and not really scalable as non-deriving ItemDecorators become possible. The API is now that the decorator gets an immutable reference to the item it's attached to, and a callback that it can pass new items to. If we want to add syntax extensions that can modify the item they're attached to, we can add that later, but I think it'll have to be separate from ItemDecorator to avoid strange ordering issues. @huonw
2014-02-14Refactored ast_map and friends, mainly to have Paths without storing them.Eduard Burtescu-22/+18
2014-02-13Tweak ItemDecorator APISteven Fackler-65/+67
The old method of building up a list of items and threading it through all of the decorators was unwieldy and not really scalable as non-deriving ItemDecorators become possible. The API is now that the decorator gets an immutable reference to the item it's attached to, and a callback that it can pass new items to. If we want to add syntax extensions that can modify the item they're attached to, we can add that later, but I think it'll have to be separate from ItemDecorator to avoid strange ordering issues.
2014-02-11libsyntax -- fix unsafe sharing in closuresNiko Matsakis-9/+12
2014-02-11to_str -- update to contain scope of closureNiko Matsakis-20/+21
2014-02-08Update deriving to pass around the `cx` linearlyNiko Matsakis-132/+157
2014-02-08Fixed error starting with uppercasemr.Shu-16/+16
Error messages cleaned in librustc/middle Error messages cleaned in libsyntax Error messages cleaned in libsyntax more agressively Error messages cleaned in librustc more aggressively Fixed affected tests Fixed other failing tests Last failing tests fixed
2014-02-08Implement `#[deriving(Show)]`.Huon Wilson-0/+140
2014-02-08syntax: convert deriving to take &mut ExtCtxt.Huon Wilson-62/+62
2014-02-08syntax: remove some dead code.Huon Wilson-15/+1
2014-02-07Removed @self and @Trait.Eduard Burtescu-7/+2
2014-02-05pull extra::{serialize, ebml} into a separate libserialize crateJeff Olson-8/+7
- `extra::json` didn't make the cut, because of `extra::json` required dep on `extra::TreeMap`. If/when `extra::TreeMap` moves out of `extra`, then `extra::json` could move into `serialize` - `libextra`, `libsyntax` and `librustc` depend on the newly created `libserialize` - The extensions to various `extra` types like `DList`, `RingBuf`, `TreeMap` and `TreeSet` for `Encodable`/`Decodable` were moved into the respective modules in `extra` - There is some trickery, evident in `src/libextra/lib.rs` where a stub of `extra::serialize` is set up (in `src/libextra/serialize.rs`) for use in the stage0 build, where the snapshot rustc is still making deriving for `Encodable` and `Decodable` point at extra. Big props to @huonw for help working out the re-export solution for this extra: inline extra::serialize stub fix stuff clobbered in rebase + don't reexport serialize::serialize no more globs in libserialize syntax: fix import of libserialize traits librustc: fix bad imports in encoder/decoder add serialize dep to librustdoc fix failing run-pass tests w/ serialize dep adjust uuid dep more rebase de-clobbering for libserialize fixing tests, pushing libextra dep into cfg(test) fix doc code in extra::json adjust index.md links to serialize and uuid library
2014-02-02librustc: De-`@str` `NameAndSpan`Patrick Walton-1/+1
2014-02-02librustc: Fix merge fallout.Patrick Walton-4/+7
2014-02-02libsyntax: De-`@str` literal strings in the ASTPatrick Walton-41/+100