summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2013-09-16switch Drop to `&mut self`Daniel Micay-1/+1
2013-09-16Limit spans in bytes!() error messages to the argument in questionKevin Ballard-10/+10
This constrains the span to the appropriate argument, so you know which one caused the problem. Instead of foo.rs:2:4: 2:21 error: Too large integer literal in bytes! foo.rs:2 bytes!(1, 256, 2) ^~~~~~~~~~~~~~~~~ it will say foo.rs:2:14 2:17 error: Too large integer literal in bytes! foo.rs:2 bytes!(1, 256, 2) ^~~
2013-09-16Update syntax testCorey Richardson-1/+123
2013-09-16Fix hardcoded string in libsyntaxCorey Richardson-24/+2
2013-09-16auto merge of #9187 : lkuper/rust/no-simplevisitor, r=catamorphismbors-144/+3
We don't seem to be using `SimpleVisitor` anywhere in rustc. Is there any reason to keep it around? r? anyone
2013-09-15auto merge of #9168 : michaelwoerister/rust/traits, r=jdmbors-0/+10
This pull request finally adds support for recursive type definitions and provides a stub implementation for object pointers.
2013-09-15Remove {uint,int,u64,i64,...}::from_str,from_str_radixblake2-ppc-3/+3
Remove these in favor of the two traits themselves and the wrapper function std::from_str::from_str. Add the function std::num::from_str_radix in the corresponding role for the FromStrRadix trait.
2013-09-15debuginfo: Basic support for trait objects.Michael Woerister-0/+10
2013-09-15Fix expand_stmt as well as expand_expr to use the correct spanAlex Crichton-15/+25
The same fix as before is still relevant, I just forgot to update the expand_stmt macro expansion site. The tests for format!() suffice as tests for this change.
2013-09-15Reduce the amount of complexity in format!Alex Crichton-122/+62
This renames the syntax-extension file to format from ifmt, and it also reduces the amount of complexity inside by defining all other macros in terms of format_args!
2013-09-14These impls, at least, can be avoided by deriving Ord.Lindsey Kuper-16/+2
2013-09-14Kill off method impls made redundant by default methods.Lindsey Kuper-39/+0
2013-09-14auto merge of #9183 : alexcrichton/rust/issue-5794, r=catamorphismbors-1/+19
Closes #5794
2013-09-14auto merge of #9181 : lkuper/rust/libsyntax-default-methods-refactor, ↵bors-275/+3
r=alexcrichton I'm getting the three `make check` failures mentioned in issue #9127, which I also get building master.
2013-09-14auto merge of #9180 : blake2-ppc/rust/reduce-either, r=catamorphismbors-21/+15
Work a bit towards #9157 "Remove Either". These instances don't need to use Either and are better expressed in other ways (removing allocations and simplifying types).
2013-09-14auto merge of #9115 : erickt/rust/master, r=ericktbors-11/+103
This is a series of patches to modernize option and result. The highlights are: * rename `.unwrap_or_default(value)` and etc to `.unwrap_or(value)` * add `.unwrap_or_default()` that uses the `Default` trait * add `Default` implementations for vecs, HashMap, Option * add `Option.and(T) -> Option<T>`, `Option.and_then(&fn() -> Option<T>) -> Option<T>`, `Option.or(T) -> Option<T>`, and `Option.or_else(&fn() -> Option<T>) -> Option<T>` * add `option::ToOption`, `option::IntoOption`, `option::AsOption`, `result::ToResult`, `result::IntoResult`, `result::AsResult`, `either::ToEither`, and `either::IntoEither`, `either::AsEither` * renamed `Option::chain*` and `Result::chain*` to `and_then` and `or_else` to avoid the eventual collision with `Iterator.chain`. * Added a bunch of impls of `Default` * Added a `#[deriving(Default)]` syntax extension * Removed impls of `Zero` for `Option<T>` and vecs.
2013-09-14Get rid of unused SimpleVisitor stuff.Lindsey Kuper-144/+3
2013-09-13Pass a more proper span to the syntax expandersAlex Crichton-1/+19
Closes #5794
2013-09-14syntax: Remove use of Either in parse.rsblake2-ppc-21/+15
The arg or capture type alias was actually never used for the capture case, so the code is simplified with `Either<arg, ()>` replaced by `arg`
2013-09-13Refactor libsyntax Visitor impls to use default methods.Lindsey Kuper-275/+3
2013-09-13Work around a compiler crash folding labeled break. #9129Brian Anderson-2/+10
Servo is hitting this problem, so this is a workaround for a lack of a real solution.
2013-09-12syntax: add #[deriving(Default)] syntax extensionErick Tryzelaar-0/+81
2013-09-12std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else}Erick Tryzelaar-7/+14
2013-09-12std: Add Option.{result_or_default,or_default} that uses DefaultErick Tryzelaar-1/+1
2013-09-12libsyntax: add Default implementation to OptVecErick Tryzelaar-0/+4
2013-09-12std: rename Option::unwrap_or_default() to unwrap_or()Erick Tryzelaar-4/+4
2013-09-12auto merge of #9135 : jbclements/rust/let-var-hygiene, r=ericktbors-1/+2
Fixes issue #9110, changes field_ty element to Name, adds test case, improves fail error message
2013-09-12Implement a format_args!() macroAlex Crichton-61/+108
The purpose of this macro is to further reduce the number of allocations which occur when dealing with formatting strings. This macro will perform all of the static analysis necessary to validate that a format string is safe, and then it will wrap up the "format string" into an opaque struct which can then be passed around. Two safe functions are added (write/format) which take this opaque argument structure, unwrap it, and then call the unsafe version of write/format (in an unsafe block). Other than these two functions, it is not intended for anyone to ever look inside this opaque struct. The macro looks a bit odd, but mostly because of rvalue lifetimes this is the only way for it to be safe that I know of. Example use-cases of this are: * third-party libraries can use the default formatting syntax without any forced allocations * the fail!() macro can avoid allocating the format string * the logging macros can avoid allocation any strings
2013-09-11more helpful error message for ident comparison failureJohn Clements-1/+2
2013-09-11auto merge of #9061 : jakub-/rust/pretty-print-empty-impl, r=huonwbors-1/+3
2013-09-11Properly encode/decode structural variants.SiegeLord-3/+3
2013-09-11auto merge of #9093 : pnkfelix/rust/fsk-remove-oldvisit, r=alexcrichtonbors-780/+0
2013-09-11Flag unsafe blocks from format! as compiler-generatedAlex Crichton-3/+9
2013-09-11Implement the notion of a "generated unsafe block"Alex Crichton-3/+3
This way syntax extensions can generate unsafe blocks without worrying about them generating unnecessary unsafe warnings. Perhaps a special keyword could be added to be used in macros, but I don't think that's the best solution.
2013-09-10change type of ExprLoop and ExprBreak elts from ident->name.John Clements-10/+21
Lots of downstream changes in librustc, should be infinitesimally faster.
2013-09-10auto merge of #9088 : nikomatsakis/rust/issue-6304-AST-tree-not-DAG, ↵bors-318/+360
r=catamorphism Ensures that each AST node has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two representative tests. Fixes #7971 Fixes #6304 Fixes #8367 Fixes #8754 Fixes #8852 Fixes #2543 Fixes #7654
2013-09-10Delay assignment of node ids until after expansion. Ensures that each AST nodeNiko Matsakis-318/+360
has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two representative tests. Fixes #7971 Fixes #6304 Fixes #8367 Fixes #8754 Fixes #8852 Fixes #2543 Fixes #7654
2013-09-10auto merge of #9090 : jbclements/rust/let-var-hygiene, r=luqmanabors-13/+2
This appears to fix issue #9049. It also re-enables the ICE check on comparing idents for equality; it appears that ICEs are better than seg faults.
2013-09-10Remove oldvisit.rs (yay!); part of #7081 refactoring.Felix S. Klock II-780/+0
2013-09-09auto merge of #9062 : blake2-ppc/rust/vec-iterator, r=alexcrichtonbors-1/+1
Visit the free functions of std::vec and reimplement or remove some. Most prominently, remove `each_permutation` and replace with two iterators, ElementSwaps and Permutations. Replace unzip, unzip_slice with an updated `unzip` that works with an iterator argument. Replace each_permutation with a Permutation iterator. The new permutation iterator is more efficient since it uses an algorithm that produces permutations in an order where each is only one element swap apart, including swapping back to the original state with one swap at the end. Unify the seldomly used functions `build`, `build_sized`, `build_sized_opt` into just one function `build`. Remove `equal_sizes`
2013-09-09undo cowardly hiding of eq-checkJohn Clements-13/+2
I've reversed my thinking on this restrictive definition of eq after two separate bugs were hidden by commenting it out; it's better to get ICEs than SIGSEGV's, any day. RE-ENABLING ICE MACHINE!
2013-09-10std::at_vec and vec: Unify build_sized, build_sized_opt into buildblake2-ppc-1/+1
These functions have very few users since they are mostly replaced by iterator-based constructions. Convert a few remaining users in-tree, and reduce the number of functions by basically renaming build_sized_opt to build, and removing the other two. This for both the vec and the at_vec versions.
2013-09-09auto merge of #9034 : catamorphism/rust/rustpkg-workcache, r=metajackbors-78/+9
r? @metajack or @brson - This pull request makes rustpkg use the workcache library to avoid recompilation.
2013-09-09auto merge of #9005 : alexcrichton/rust/rusty-log, r=brsonbors-83/+49
Also redefine all of the standard logging macros to use more rust code instead of custom LLVM translation code. This makes them a bit easier to understand, but also more flexibile for future types of logging. Additionally, this commit removes the LogType language item in preparation for changing how logging is performed.
2013-09-08rustpkg: Use workcacheTim Chevalier-78/+9
rustpkg now uses the workcache library to avoid recompilation. Hooray!
2013-09-08Fix pretty-printing of empty impl itemsJakub-1/+3
2013-09-08syntax: aesthetic improvements to the `for` desugaring.Huon Wilson-130/+38
2013-09-08syntax: implement labelled breaks for `for`.Huon Wilson-15/+25
`for` desugars to `loop` so it is trivial to just desugar to `loop` while retaining any label.
2013-09-08auto merge of #9035 : alexcrichton/rust/fewer-clownshoes, r=huonwbors-23/+23
This removes another large chunk of this odd 'clownshoes' identifier showing up in symbol names. These all originated from external crates because the encoded items were encoded independently of the paths calculated in ast_map. The encoding of these paths now uses the helper function in ast_map to calculate the "pretty name" for an impl block. Unfortunately there is still no information about generics in the symbol name, but it's certainly vastly better than before hash::__extensions__::write::_version::v0.8 becomes hash::Writer$SipState::write::hversion::v0.8 This also fixes bugs in which lots of methods would show up as `meth_XXX`, they now only show up as `meth` and throw some extra characters onto the version string.
2013-09-06Remove even more usage of clownshoes in symbolsAlex Crichton-23/+23
This removes another large chunk of this odd 'clownshoes' identifier showing up in symbol names. These all originated from external crates because the encoded items were encoded independently of the paths calculated in ast_map. The encoding of these paths now uses the helper function in ast_map to calculate the "pretty name" for an impl block. Unfortunately there is still no information about generics in the symbol name, but it's certainly vastly better than before hash::__extensions__::write::_version::v0.8 becomes hash::Writer$SipState::write::hversion::v0.8 This also fixes bugs in which lots of methods would show up as `meth_XXX`, they now only show up as `meth` and throw some extra characters onto the version string.