summary refs log tree commit diff
path: root/src/libsyntax/parse/token.rs
AgeCommit message (Collapse)AuthorLines
2014-03-29auto merge of #13188 : FlaPer87/rust/master, r=alexcrichtonbors-17/+0
2014-03-28auto merge of #13170 : eddyb/rust/syntax-cleanup, r=alexcrichtonbors-5/+7
Removes all Cell's/RefCell's from lexer::Reader implementations and a couple @.
2014-03-29Register new snapshotFlavio Percoco-17/+0
2014-03-28syntax: Accept meta matchers in macrosAlex Crichton-4/+4
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-@ IdentInterner.Eduard Burtescu-5/+7
2014-03-27serialize: use ResultSean McArthur-0/+17
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-23use TotalEq for HashMapDaniel Micay-3/+3
Closes #5283
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-1/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
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-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-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-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-7/+6
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-3/+3
2014-02-28std: Change assert_eq!() to use {} instead of {:?}Alex Crichton-2/+20
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-23auto merge of #12338 : edwardw/rust/hygienic-break-continue, r=cmrbors-2/+2
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-4/+4
2014-02-23Make break and continue hygienicEdward Wang-2/+2
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-14Refactored ast_map and friends, mainly to have Paths without storing them.Eduard Burtescu-118/+103
2014-02-13Replace `extern mod` with `extern crate`Flavio Percoco-26/+27
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-11Reserve `do` as a keywordEduard Bopp-0/+1
Resolves issue #12157. `do` is hereby reinstated as a keyword; no syntax is associated with it though. Along the way, a unit test had to be adapted, since it was using `do` as a method identifier. Breaking changes: - Any code using `do` as an identifier will no longer work.
2014-02-08std::fmt: convert the formatting traits to a proper self.Huon Wilson-2/+2
Poly and String have polymorphic `impl`s and so require different method names.
2014-02-05pull extra::{serialize, ebml} into a separate libserialize crateJeff Olson-1/+1
- `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-03Fixing remaining warnings and errors throughoutAlex Crichton-2/+2
2014-02-02std: rename fmt::Default to `Show`.Huon Wilson-1/+1
This is a better name with which to have a #[deriving] mode. Decision in: https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-01-28
2014-02-02Changes from the review of the @str PR.Huon Wilson-7/+0
2014-02-02Fix `@str` removal tests.Huon Wilson-1/+0
2014-02-02librustc: Remove `@str` from the languagePatrick Walton-4/+5
2014-02-02libsyntax: Remove `@str` from the internerPatrick Walton-10/+12
2014-02-02libsyntax: Remove the `interner_get` function and all usesPatrick Walton-27/+0
2014-02-02libsyntax: Remove uses of `token::ident_to_str()`Patrick Walton-29/+14
2014-02-02libsyntax: De-`@str` literal strings in the ASTPatrick Walton-1/+13
2014-02-02libsyntax: Introduce an `InternedString` type to reduce `@str` in thePatrick Walton-0/+87
compiler and use it for attributes
2014-01-29Removing support for the do syntax from libsyntax and librustc.Scott Lawrence-40/+39
Fixes #10815.
2014-01-21Remove unnecessary parentheses.Huon Wilson-1/+1
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-46/+48
2013-12-15libsyntax: Implement the new `box` syntax for unique pointers.Patrick Walton-7/+9
2013-12-11Separate strict/reserved keywords, derive bounds.Chris Morgan-11/+29
It's twenty lines longer, but makes for clearer separation of strict and reserved keywords (probably a good thing) and removes another moving part (the definitions of `(STRICT|RESERVED)_KEYWORD_(START|FINAL)`).
2013-12-11Remove the following unused special identifiers:Chris Morgan-107/+67
- underscore ("_") - unary ("unary") - not_fn ("!") - idx_fn ("[]") - unary_minus_fn ("unary-") - item ("item") - block ("block") - stmt ("stmt") - pat ("pat") - expr ("expr") - ty ("ty") - ident ("ident") - path ("path") - descrim ("descrim") - clownshoe_stack_shim ("__rust_stack_shim") - blk ("blk") - c_abi ("C") (And, of course, renumber everything to match.)
2013-12-11Deduplicate in syntax::parse::token with a macro.Chris Morgan-271/+183
I also renumbered things at the same time; ``in`` was shifted into its alphabetical position and the reserved keywords were reordered (a couple of them were out of order).
2013-12-01Box Block, fn_decl, variant and Ty in the AST, as they were inflating ↵Eduard Burtescu-3/+3
critical enum sizes.
2013-11-28Register new snapshotsAlex Crichton-16/+16
2013-11-26auto merge of #10670 : eddyb/rust/node-u32, r=alexcrichtonbors-6/+6
### Rationale There is no reason to support more than 2³² nodes or names at this moment, as compiling something that big (even without considering the quadratic space usage of some analysis passes) would take at least **64GB**. Meanwhile, some can't (or barely can) compile rustc because it requires almost **1.5GB**. ### Potential problems Can someone confirm this doesn't affect metadata (de)serialization? I can't tell myself, I know nothing about it. ### Results Some structures have a size reduction of 25% to 50%: [before](https://gist.github.com/luqmana/3a82a51fa9c86d9191fa) - [after](https://gist.github.com/eddyb/5a75f8973d3d8018afd3). Sadly, there isn't a massive change in the memory used for compiling stage2 librustc (it doesn't go over **1.4GB** as [before](http://huonw.github.io/isrustfastyet/mem/), but I can barely see the difference). However, my own testcase (previously peaking at **1.6GB** in typeck) shows a reduction of **200**-**400MB**.
2013-11-27Shink NodeId, CrateNum, Name and Mrk down to 32 bits on x64.Eduard Burtescu-6/+6
2013-11-26libsyntax: Remove all non-`proc` `do` syntax.Patrick Walton-2/+2
2013-11-04libsyntax/librustc: Allow calling variadic foreign functions.Luqman Aden-0/+2
2013-10-29librustc: Implement the `proc` type as sugar for `~once fn` and `proc`Patrick Walton-19/+22
notation for closures, and disable the feature gate for `once fn` if used with the `~` sigil.
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-3/+3
Who doesn't like a massive renaming?
2013-10-09option: rewrite the API to use compositionDaniel Micay-1/+1
2013-10-08Register new snapshotsAlex Crichton-19/+0