summary refs log tree commit diff
path: root/src/libsyntax/ext
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-47/+51
2014-03-28auto merge of #13170 : eddyb/rust/syntax-cleanup, r=alexcrichtonbors-212/+185
Removes all Cell's/RefCell's from lexer::Reader implementations and a couple @.
2014-03-28syntax: Accept meta matchers in macrosAlex Crichton-1/+1
This removes the `attr` matcher and adds a `meta` matcher. The previous `attr` matcher is now ambiguous because it doesn't disambiguate whether it means inner attribute or outer attribute. The new behavior can still be achieved by taking an argument of the form `#[$foo:meta]` (the brackets are part of the macro pattern). Closes #13067
2014-03-28De-@ NamedMatch.Eduard Burtescu-26/+27
2014-03-28De-@ TokenTree.Eduard Burtescu-7/+11
2014-03-28Used inherited mutability in lexer::Reader.Eduard Burtescu-184/+152
2014-03-27serialize: use ResultSean McArthur-15/+103
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-4/+4
value
2014-03-24auto merge of #12998 : huonw/rust/log_syntax, r=alexcrichtonbors-35/+33
syntax: allow `trace_macros!` and `log_syntax!` in item position. Previously trace_macros!(true) fn main() {} would complain about `trace_macros` being an expression macro in item position. This is a pointless limitation, because the macro is purely compile-time, with no runtime effect. (And similarly for log_syntax.) This also changes the behaviour of `trace_macros!` very slightly, it used to be equivalent to macro_rules! trace_macros { (true $($_x: tt)*) => { true }; (false $($_x: tt)*) => { false } } I.e. you could invoke it with arbitrary trailing arguments, which were ignored. It is changed to accept only exactly `true` or `false` (with no trailing arguments) and expands to `()`.
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-22syntax: Fix fallout of removing get()Alex Crichton-81/+52
2014-03-22Migrate all users of opt_vec to owned_slice, delete opt_vec.Huon Wilson-35/+31
syntax::opt_vec is now entirely unused, and so can go.
2014-03-22syntax: allow `trace_macros!` and `log_syntax!` in item position.Huon Wilson-35/+33
Previously trace_macros!(true) fn main() {} would complain about `trace_macros` being an expression macro in item position. This is a pointless limitation, because the macro is purely compile-time, with no runtime effect. (And similarly for log_syntax.) This also changes the behaviour of `trace_macros!` very slightly, it used to be equivalent to macro_rules! trace_macros { (true $($_x: tt)*) => { true }; (false $($_x: tt)*) => { false } } I.e. you could invoke it with arbitrary trailing arguments, which were ignored. It is changed to accept only exactly `true` or `false` (with no trailing arguments) and expands to `()`.
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-52/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-36/+36
Closes #12771
2014-03-20rename std::vec -> std::sliceDaniel Micay-2/+2
Closes #12702
2014-03-19auto merge of #12770 : eddyb/rust/drop-tld, r=cmrbors-0/+9
Sadly, this seems to make memory usage worse (unless `Vec<T>` makes it worse and this PR doesn't change that much, which is entirely possible).
2014-03-19Discard MTWT & interner tables from TLD after they stop being useful.Eduard Burtescu-0/+9
2014-03-18Docify std::vec_ngSteven Fackler-6/+6
I also removed a couple of methods that were silly and added sort.
2014-03-17rustc: disallow trailing parentheses for nullary enum variantsLaurent Bonnans-1/+1
Fixes #12560
2014-03-17Fix rustdoc and tests.Eduard Burtescu-7/+7
2014-03-17De-@ codemap and diagnostic.Eduard Burtescu-19/+18
2014-03-17De-@ ParseSess uses.Eduard Burtescu-21/+22
2014-03-16auto merge of #12929 : sfackler/rust/automatically-derived, r=cmrbors-8/+4
This will enable rustdoc to treat them specially. I also got rid of `std::cmp::cmp2`, which is isomorphic to the `TotalOrd` impl for 2-tuples and never used.
2014-03-15Tag derived impls with #[automatically_derived]Steven Fackler-8/+4
This will enable rustdoc to treat them specially.
2014-03-15rustc: Remove compiler support for __log_level()Alex Crichton-1/+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-1/+12
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-13auto merge of #12798 : pczarn/rust/inline-asm, r=alexcrichtonbors-50/+69
## read+write modifier '+' This small sugar was left out in the original implementation (#5359). When an output operand with the '+' modifier is encountered, we store the index of that operand alongside the expression to create and append an input operand later. The following lines are equivalent: ``` asm!("" : "+m"(expr)); asm!("" : "=m"(expr) : "0"(expr)); ``` ## misplaced options and clobbers give a warning It's really annoying when a small typo might change behavior without any warning. ``` asm!("mov $1, $0" : "=r"(x) : "r"(8u) : "cc" , "volatile"); //~^ WARNING expected a clobber, but found an option ``` ## liveness Fixed incorrect order of propagation. Sometimes it caused spurious warnings in code: `warning: value assigned to `i` is never read, #[warn(dead_assignment)] on by default` ~~Note: Rebased on top of another PR. (uses other changes)~~ * [x] Implement read+write * [x] Warn about misplaced options * [x] Fix liveness (`dead_assignment` lint) * [x] Add all tests
2014-03-13Fix and improve inline assembly.Piotr Czarnecki-50/+69
Read+write modifier Some documentation in asm.rs rpass and cfail tests
2014-03-13Remove Rc's borrow method to avoid conflicts with RefCell's borrow in ↵Eduard Burtescu-2/+2
Rc<RefCell<T>>.
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-20/+19
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-2/+2
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-11Add an ItemModifier syntax extension typeSteven Fackler-11/+65
Where ItemDecorator creates new items given a single item, ItemModifier alters the tagged item in place. The expansion rules for this are a bit weird, but I think are the most reasonable option available. When an item is expanded, all ItemModifier attributes are stripped from it and the item is folded through all ItemModifiers. At that point, the process repeats until there are no ItemModifiers in the new item.
2014-03-08Removed DeepClone. Issue #12698.Michael Darakananda-31/+0
2014-03-07rename ast::ViewItemExternMod to ast::ViewItemExternCrate, and ↵Liigo Zhuang-2/+2
clean::ExternMod to clean::ExternCrate
2014-03-06syntax: Conditionally deriving(Hash) with WritersAlex Crichton-16/+49
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-05Refactor and fix FIXME's in mtwt hygiene codeEdward Wang-59/+541
- 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-04Expand nested items within a backtrace.Nick Cameron-6/+7
Fixes a regression from #4913 which causes items to be exanded with spans lacking expn_info from the context's current backtrace.
2014-03-03syntax: make match arms store the expr directly.Huon Wilson-3/+3
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-02auto merge of #12662 : sfackler/rust/unexported-type, r=cmrbors-2/+2
2014-03-02Make visible types public in rustcSteven Fackler-2/+2
2014-03-02Expand string literals and exprs inside of macrosSteven Fackler-22/+9
A couple of syntax extensions manually expanded expressions, but it wasn't done universally, most noticably inside of asm!(). There's also a bit of random cleanup.
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-133/+289