summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2014-02-24Remove deriving(ToStr)Alex Crichton-136/+2
This has been superseded by deriving(Show). cc #9806
2014-02-23Remove all ToStr impls, add Show implsAlex Crichton-49/+63
This commit changes the ToStr trait to: impl<T: fmt::Show> ToStr for T { fn to_str(&self) -> ~str { format!("{}", *self) } } The ToStr trait has been on the chopping block for quite awhile now, and this is the final nail in its coffin. The trait and the corresponding method are not being removed as part of this commit, but rather any implementations of the `ToStr` trait are being forbidden because of the generic impl. The new way to get the `to_str()` method to work is to implement `fmt::Show`. Formatting into a `&mut Writer` (as `format!` does) is much more efficient than `ToStr` when building up large strings. The `ToStr` trait forces many intermediate allocations to be made while the `fmt::Show` trait allows incremental buildup in the same heap allocated buffer. Additionally, the `fmt::Show` trait is much more extensible in terms of interoperation with other `Writer` instances and in more situations. By design the `ToStr` trait requires at least one allocation whereas the `fmt::Show` trait does not require any allocations. Closes #8242 Closes #9806
2014-02-23auto merge of #12328 : nick29581/rust/abi, r=alexcrichtonbors-4/+5
2014-02-23auto merge of #12510 : huonw/rust/fix-compiler-docs, r=alexcrichtonbors-12/+12
This includes blocks made by indentation, so they need to be changed to explicitly have ```notrust ... ``` fences..
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-24All uses of `extern fn` should mean `extern "C" fn`. Closes #9309.Nick Cameron-4/+5
2014-02-23auto merge of #12338 : edwardw/rust/hygienic-break-continue, r=cmrbors-17/+68
Makes labelled loops hygiene by performing renaming of the labels defined in e.g. `'x: loop { ... }` and then used in break and continue statements within loop body so that they act hygienically when used with macros. Closes #12262.
2014-02-24Transition to new `Hash`, removing IterBytes and std::to_bytes.Huon Wilson-221/+104
2014-02-23Make break and continue hygienicEdward Wang-17/+68
Makes labelled loops hygiene by performing renaming of the labels defined in e.g. `'x: loop { ... }` and then used in break and continue statements within loop body so that they act hygienically when used with macros. Closes #12262.
2014-02-23Move std::{trie, hashmap} to libcollectionsAlex Crichton-13/+14
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-12/+11
Closes #7743.
2014-02-22auto merge of #11863 : erickt/rust/hash, r=acrichtobors-2/+137
This PR merges `IterBytes` and `Hash` into a trait that allows for generic non-stream-based hashing. It makes use of @eddyb's default type parameter support in order to have a similar usage to the old `Hash` framework. Fixes #8038. Todo: - [x] Better documentation - [ ] Benchmark - [ ] Parameterize `HashMap` on a `Hasher`.
2014-02-22Warn about unnecessary parentheses upon assignmentEduard Bopp-3/+3
Closes #12366. Parentheses around assignment statements such as let mut a = (0); a = (1); a += (2); are not necessary and therefore an unnecessary_parens warning is raised when statements like this occur. The warning mechanism was refactored along the way to allow for code reuse between the routines for checking expressions and statements. Code had to be adopted throughout the compiler and standard libraries to comply with this modification of the lint.
2014-02-21std: rewrite Hash to make it more genericErick Tryzelaar-6/+106
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: add syntax extension helper to make simple view itemsErick Tryzelaar-0/+17
2014-02-21syntax: Allow syntax extensions to have attributesErick Tryzelaar-8/+26
2014-02-22Represent lifetimes as Names instead of IdentsEdward Wang-12/+11
Closes #7743.
2014-02-22Reduce reliance on `to_str_radix`Brendan Zabarauskas-18/+3
This is in preparation to remove the implementations of ToStrRadix in integers, and to remove the associated logic from `std::num::strconv`. The parts that still need to be liberated are: - `std::fmt::Formatter::runplural` - `num::{bigint, complex, rational}`
2014-02-20Mass rename if_ok! to try!Alex Crichton-734/+734
This "bubble up an error" macro was originally named if_ok! in order to get it landed, but after the fact it was discovered that this name is not exactly desirable. The name `if_ok!` isn't immediately clear that is has much to do with error handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In general, the agreed opinion about `if_ok!` is that is came in as subpar. The name `try!` is more invocative of error handling, it's shorter by 2 letters, and it looks fitting in almost all circumstances. One concern about the word `try!` is that it's too invocative of exceptions, but the belief is that this will be overcome with documentation and examples. Close #12037
2014-02-20move extra::test to libtestLiigo Zhuang-6/+7
2014-02-19librustc: Remove unique vector patterns from the language.Patrick Walton-79/+96
Preparatory work for removing unique vectors from the language, which is itself preparatory work for dynamically sized types.
2014-02-19auto merge of #11904 : nick29581/rust/0filemap, r=alexcrichtonbors-8/+78
2014-02-19auto merge of #12349 : edwardw/rust/debug-expansion, r=huonwbors-6/+40
Currently, the format_args! macro and its downstream macros in turn expand to series of let statements, one for each of its arguments, and then the invocation of the macro function. If one or more of the arguments are RefCell's, the enclosing statement for the temporary of the let is the let itself, which leads to scope problem. This patch changes let's to a match expression. Closes #12239.
2014-02-19Change the format_args! macro expansion for temporariesEdward Wang-6/+40
Currently, the format_args! macro and its downstream macros in turn expand to series of let statements, one for each of its arguments, and then the invocation of the macro function. If one or more of the arguments are RefCell's, the enclosing statement for the temporary of the let is the let itself, which leads to scope problem. This patch changes let's to a match expression. Closes #12239.
2014-02-19Fix bug with zero-length filemaps and rename bytepos_to_local_charpos to ↵Nick Cameron-8/+78
bytepos_to_charpos.
2014-02-18Avoid returning original macro if expansion fails.Douglas Young-28/+34
Closes #11692. Instead of returning the original expression, a dummy expression (with identical span) is returned. This prevents infinite loops of failed expansions as well as odd double error messages in certain situations.
2014-02-15auto merge of #12298 : alexcrichton/rust/rustdoc-testing, r=sfacklerbors-12/+20
It's too easy to forget the `rust` tag to test something. Closes #11698
2014-02-14Fix all code examplesAlex Crichton-12/+20
2014-02-14extern mod => extern crateAlex Crichton-16/+16
This was previously implemented, and it just needed a snapshot to go through
2014-02-14Register new snapshotsAlex Crichton-7/+6
This enables the parser error for `extern mod` => `extern crate` transitions.
2014-02-14Removed the obsolete ast::CallSugar (previously used by `do`).Eduard Burtescu-74/+34
2014-02-14Expand ItemDecorator extensions in all contextsSteven Fackler-53/+40
Now that fold_item can return multiple items, this is pretty trivial. It also recursively expands generated items so ItemDecorators can generate items that are tagged with ItemDecorators! Closes #4913
2014-02-14Removed libextra dependency from libsyntax.HeroesGrave-1/+1
2014-02-14auto merge of #12234 : sfackler/rust/restructure-item-decorator, r=huonwbors-74/+76
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-688/+743
2014-02-13Tweak ItemDecorator APISteven Fackler-74/+76
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-13auto merge of #12061 : pongad/rust/delorderable, r=cmrbors-3/+3
#12057
2014-02-13Removed num::OrderableMichael Darakananda-3/+3
2014-02-13auto merge of #12017 : FlaPer87/rust/replace-mod-crate, r=alexcrichtonbors-143/+134
The first setp for #9880 is to add a new `crate` keyword. This PR does exactly that. I took a chance to refactor `parse_item_foreign_mod` and I broke it down into 2 separate methods to isolate each feature. The next step will be to push a new stage0 snapshot and then get rid of all `extern mod` around the code.
2014-02-13Stop unloading syntax librariesSteven Fackler-11/+7
Externally loaded libraries are able to do things that cause references to them to survive past the expansion phase (e.g. creating @-box cycles, launching a task or storing something in task local data). As such, the library has to stay loaded for the lifetime of the process.
2014-02-13Remove obsolete warnings for `extern mod`Flavio Percoco-12/+0
This patch gets rid of ObsoleteExternModAttributesInParens and ObsoleteNamedExternModule since the replacement of `extern mod` with `extern crate` avoids those cases and raises different errors. Both have been around for at least a version which makes this a good moment to get rid of them.
2014-02-13Replace `extern mod` with `extern crate`Flavio Percoco-105/+108
This patch adds a new keyword `crate` which is intended to replace mod in the context of `extern mod` as part of the issue #9880. The patch doesn't replace all `extern mod` cases since it is necessary to first push a new snapshot 0. The implementation could've been less invasive than this. However I preferred to take this chance to split the `parse_item_foreign_mod` method and pull the `extern crate` part out of there, hence the new method `parse_item_foreign_crate`.
2014-02-13Replace `crate` usage with `krate`Flavio Percoco-26/+26
This patch replaces all `crate` usage with `krate` before introducing the new keyword. This ensures that after introducing the keyword, there won't be any compilation errors. krate might not be the most expressive substitution for crate but it's a very close abbreviation for it. `module` was already used in several places already.
2014-02-11libsyntax -- fix unsafe sharing in closuresNiko Matsakis-10/+12
2014-02-11libsyntax -- combine two iter ops into one so that `fld` does not need to be ↵Niko Matsakis-5/+6
mutably shared between them both
2014-02-11syntax/fold -- remove conflicting (and rather pointless) closuresNiko Matsakis-18/+7
2014-02-11syntax/ext/format -- rewrite conflicting closures into methodsNiko Matsakis-116/+127
2014-02-11to_str -- update to contain scope of closureNiko Matsakis-20/+21
2014-02-11Correct span for self and ExprStructSeo Sanghyeon-2/+2
2014-02-11auto merge of #12175 : sfackler/rust/phase-use-ignored, r=alexcrichtonbors-8/+13
It could throw an error but I think it's best to not since `#[phase(..)]` syntax in other places would be silently ignored. Closes #11806