about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2014-03-20Added new attribute syntax with backward compatibility.Daniel Fagnan-11/+51
Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>
2014-03-21syntax: make OptVec immutable.Huon Wilson-5/+5
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-8/+0
It's now in the prelude.
2014-03-20auto merge of #13028 : thestinger/rust/vec_ng, r=huonwbors-19/+19
Closes #12771
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-19/+19
Closes #12771
2014-03-20Fix spans for enum-struct match armsNick Cameron-10/+8
Correct spans for fields in enum struct arms where the field and variable are unified
2014-03-17rustc: disallow trailing parentheses for nullary enum variantsLaurent Bonnans-2/+19
Fixes #12560
2014-03-17Fix rustdoc and tests.Eduard Burtescu-55/+32
2014-03-17De-@ codemap and diagnostic.Eduard Burtescu-104/+94
2014-03-17De-@ ParseSess uses.Eduard Burtescu-46/+46
2014-03-15rustc: Remove compiler support for __log_level()Alex Crichton-7/+1
This commit removes all internal support for the previously used __log_level() expression. The logging subsystem was previously modified to not rely on this magical expression. This also removes the only other function to use the module_data map in trans, decl_gc_metadata. It appears that this is an ancient function from a GC only used long ago. This does not remove the crate map entirely, as libgreen still uses it to hook in to the event loop provided by libgreen.
2014-03-15log: Introduce liblog, the old std::loggingAlex Crichton-30/+29
This commit moves all logging out of the standard library into an external crate. This crate is the new crate which is responsible for all logging macros and logging implementation. A few reasons for this change are: * The crate map has always been a bit of a code smell among rust programs. It has difficulty being loaded on almost all platforms, and it's used almost exclusively for logging and only logging. Removing the crate map is one of the end goals of this movement. * The compiler has a fair bit of special support for logging. It has the __log_level() expression as well as generating a global word per module specifying the log level. This is unfairly favoring the built-in logging system, and is much better done purely in libraries instead of the compiler itself. * Initialization of logging is much easier to do if there is no reliance on a magical crate map being available to set module log levels. * If the logging library can be written outside of the standard library, there's no reason that it shouldn't be. It's likely that we're not going to build the highest quality logging library of all time, so third-party libraries should be able to provide just as high-quality logging systems as the default one provided in the rust distribution. With a migration such as this, the change does not come for free. There are some subtle changes in the behavior of liblog vs the previous logging macros: * The core change of this migration is that there is no longer a physical log-level per module. This concept is still emulated (it is quite useful), but there is now only a global log level, not a local one. This global log level is a reflection of the maximum of all log levels specified. The previously generated logging code looked like: if specified_level <= __module_log_level() { println!(...) } The newly generated code looks like: if specified_level <= ::log::LOG_LEVEL { if ::log::module_enabled(module_path!()) { println!(...) } } Notably, the first layer of checking is still intended to be "super fast" in that it's just a load of a global word and a compare. The second layer of checking is executed to determine if the current module does indeed have logging turned on. This means that if any module has a debug log level turned on, all modules with debug log levels get a little bit slower (they all do more expensive dynamic checks to determine if they're turned on or not). Semantically, this migration brings no change in this respect, but runtime-wise, this will have a perf impact on some code. * A `RUST_LOG=::help` directive will no longer print out a list of all modules that can be logged. This is because the crate map will no longer specify the log levels of all modules, so the list of modules is not known. Additionally, warnings can no longer be provided if a malformed logging directive was supplied. The new "hello world" for logging looks like: #[phase(syntax, link)] extern crate log; fn main() { debug!("Hello, world!"); }
2014-03-14extra: Put the nail in the coffin, delete libextraAlex Crichton-1/+1
This commit shreds all remnants of libextra from the compiler and standard distribution. Two modules, c_vec/tempfile, were moved into libstd after some cleanup, and the other modules were moved to separate crates as seen fit. Closes #8784 Closes #12413 Closes #12576
2014-03-14Added support for type placeholders (explicit requested typeMarvin Löbel-0/+3
inference in a type with `_` ). This enables partial type inference.
2014-03-13auto merge of #12849 : nick29581/rust/doubles, r=alexcrichtonbors-0/+1
2014-03-12rustc: Remove matching on ~str from the languageMichael Darakananda-18/+1
The `~str` type is not long for this world as it will be superseded by the soon-to-come DST changes for the language. The new type will be `~Str`, and matching over the allocation will no longer be supported. Matching on `&str` will continue to work, in both a pre and post DST world.
2014-03-12Update last_span in replace_tokenNick Cameron-0/+1
2014-03-12Changed lists of lifetimes in ast and ty to use Vec instead of OptVec.Felix S. Klock II-20/+20
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-12alpha-rename .ident to .name in Lifetime, including in rustdoc.Felix S. Klock II-4/+4
2014-03-11auto merge of #12774 : alexcrichton/rust/proc-bounds, r=pcwaltonbors-1/+2
This is needed to make progress on #10296 as the default bounds will no longer include Send. I believe that this was the originally intended syntax for procs, and it just hasn't been necessary up until now.
2014-03-11syntax: Add support for trait bounds on procsAlex Crichton-1/+2
This is needed to make progress on #10296 as the default bounds will no longer include Send. I believe that this was the originally intended syntax for procs, and it just hasn't been necessary up until now.
2014-03-12rand: deprecate `rng`.Huon Wilson-1/+1
This should be called far less than it is because it does expensive OS interactions and seeding of the internal RNG, `task_rng` amortises this cost. The main problem is the name is so short and suggestive. The direct equivalent is `StdRng::new`, which does precisely the same thing. The deprecation will make migrating away from the function easier.
2014-03-07rename ast::ViewItemExternMod to ast::ViewItemExternCrate, and ↵Liigo Zhuang-4/+4
clean::ExternMod to clean::ExternCrate
2014-03-05Refactor and fix FIXME's in mtwt hygiene codeEdward Wang-3/+4
- Moves mtwt hygiene code into its own file - Fixes FIXME's which leads to ~2x speed gain in expansion pass - It is now @-free
2014-03-03syntax: make match arms store the expr directly.Huon Wilson-10/+1
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-02Make visible types public in rustcSteven Fackler-1/+1
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-39/+63
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-199/+198
2014-03-01auto merge of #12627 : alexcrichton/rust/issue-12623, r=brsonbors-3/+7
This helps prevent the unfortunate interleavings found in #12623.
2014-02-28std: Change assert_eq!() to use {} instead of {:?}Alex Crichton-9/+27
Formatting via reflection has been a little questionable for some time now, and it's a little unfortunate that one of the standard macros will silently use reflection when you weren't expecting it. This adds small bits of code bloat to libraries, as well as not always being necessary. In light of this information, this commit switches assert_eq!() to using {} in the error message instead of {:?}. In updating existing code, there were a few error cases that I encountered: * It's impossible to define Show for [T, ..N]. I think DST will alleviate this because we can define Show for [T]. * A few types here and there just needed a #[deriving(Show)] * Type parameters needed a Show bound, I often moved this to `assert!(a == b)` * `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths. I don't think this is much of a regression though because {:?} on paths looks awful (it's a byte array). Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime significant for smaller binaries.
2014-02-28rustdoc: Capture all output from rustc by defaultAlex Crichton-1/+5
This helps prevent interleaving of error messages when running rustdoc tests. This has an interesting bit of shuffling with I/O handles, but other than that this is just using the APIs laid out in the previous commit. Closes #12623
2014-02-28syntax: Refactor diagnostics to focus on WritersAlex Crichton-2/+2
This commit alters the diagnostic emission machinery to be focused around a Writer for emitting errors. This allows it to not hard-code emission of errors to stderr (useful for other applications).
2014-02-27Fix a pretty printer crash on `/***`.Chris Morgan-1/+1
The pretty printer was treating block comments with more than two asterisks after the first slash (e.g. `/***`) as doc comments (which are attributes), whereas in actual fact they are just regular comments.
2014-02-26Replace callee_id with information stored in method_map.Eduard Burtescu-5/+5
2014-02-24syntax: allow stmt/expr macro invocations to be delimited by {}.Huon Wilson-3/+23
This makes using control-flow-y macros like `spawn! { ... }` more fluent and natural. cc #11892.
2014-02-24syntax: record multibyte chars' positions absolutely, not relative toHuon Wilson-2/+1
file. Previously multibyte UTF-8 chars were being recorded as byte offsets from the start of the file, and then later compared against global byte positions, resulting in the compiler possibly thinking it had a byte position pointing inside a multibyte character, if there were multibyte characters in any non-crate files. (Although, sometimes the byte offsets line up just right to not ICE, but that was a coincidence.) Fixes #11136. Fixes #11178.
2014-02-24Move extra::json to libserializeAlex Crichton-3/+1
This also inverts the dependency between libserialize and libcollections. cc #8784
2014-02-23auto merge of #12328 : nick29581/rust/abi, r=alexcrichtonbors-4/+5
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-5/+5
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-14/+5
2014-02-23Make break and continue hygienicEdward Wang-5/+5
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-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-22Represent lifetimes as Names instead of IdentsEdward Wang-1/+1
Closes #7743.
2014-02-20move extra::test to libtestLiigo Zhuang-3/+4
2014-02-19librustc: Remove unique vector patterns from the language.Patrick Walton-25/+33
Preparatory work for removing unique vectors from the language, which is itself preparatory work for dynamically sized types.
2014-02-14extern mod => extern crateAlex Crichton-10/+10
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-17/+13
2014-02-14Refactored ast_map and friends, mainly to have Paths without storing them.Eduard Burtescu-152/+120