about summary refs log tree commit diff
path: root/src/libsyntax/ext/expand.rs
AgeCommit message (Collapse)AuthorLines
2014-06-27remove unnecessary abstractionJohn Clements-10/+5
2014-06-27cleanup and shiny new more-functional interfaceJohn Clements-55/+36
2014-06-27WIP match hygiene, compilesJohn Clements-12/+12
2014-06-27get rid of needless wrapper functionJohn Clements-14/+8
2014-06-27working on hygieneJohn Clements-12/+50
2014-06-25don't expand subexprs of for loop, just re-expand whole thing.John Clements-5/+6
Fixes #15167
2014-06-25remove misleading and unnecessary underscoresJohn Clements-2/+3
2014-06-25remove unneccessary pubs, shorten namesJohn Clements-9/+9
2014-06-25remove unneeded visit_ty methodsJohn Clements-9/+0
2014-06-25add unit test for match var hygieneJohn Clements-0/+12
2014-06-25enrich and rename crate_idents test caseJohn Clements-6/+12
2014-06-25comments onlyJohn Clements-4/+9
2014-06-25revive old commented-out test cases as ignored test cases for hygieneJohn Clements-6/+58
2014-06-14rustc: Obsolete the `@` syntax entirelyAlex Crichton-1/+3
This removes all remnants of `@` pointers from rustc. Additionally, this removes the `GC` structure from the prelude as it seems odd exporting an experimental type in the prelude by default. Closes #14193 [breaking-change]
2014-06-11rustc: Move the AST from @T to Gc<T>Alex Crichton-5/+6
2014-06-11syntax: Move the AST from @T to Gc<T>Alex Crichton-38/+40
2014-06-09Implement #[plugin_registrar]Keegan McAllister-122/+30
See RFC 22. [breaking-change]
2014-05-28Expand macros in patternsKeegan McAllister-5/+90
2014-05-27auto merge of #14414 : richo/rust/features/nerf_unused_string_fns, ↵bors-17/+17
r=alexcrichton This should block on #14323
2014-05-27std: Rename strbuf operations to stringRicho Healey-17/+17
[breaking-change]
2014-05-27syntax: desugar a `for` loop to a let binding to get better errorHuon Wilson-4/+32
messages when the pattern is refutable. This means the compiler points directly to the pattern and said that the problem is the pattern being refutable (rather than just saying that some value isn't covered in the `match` as it did previously). Fixes #14390.
2014-05-26syntax: Add a source field to `Local` for tracking if it comes from `let`s ↵Huon Wilson-1/+3
or `for`s.
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-2/+2
[breaking-change]
2014-05-24Port more stuff to mark used attributesSteven Fackler-0/+3
2014-05-24First sketch of lint passSteven Fackler-1/+1
Enough attributes are marked to cleanly compile an empty library.
2014-05-24Add AttrId to Attribute_Steven Fackler-0/+2
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-26/+26
2014-05-18Output debug info on how `#[phase] extern crate foo;` gets resolved.Felix S. Klock II-0/+3
2014-05-13Touch up and rebase previous commitsAlex Crichton-4/+12
* Added `// no-pretty-expanded` to pretty-print a test, but not run it through the `expanded` variant. * Removed #[deriving] and other expanded attributes after they are expanded * Removed hacks around &str and &&str and friends (from both the parser and the pretty printer). * Un-ignored a bunch of tests
2014-05-13libsyntax: Workaround pprust `for` issueklutzy-1/+1
2014-05-11core: Remove the cast moduleAlex Crichton-3/+3
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-08libsyntax: Remove uses of `~str` from libsyntax, and fix falloutPatrick Walton-24/+28
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-6/+0
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-13/+13
2014-04-16syntax: unify all MacResult's into a single trait.Huon Wilson-36/+28
There's now one unified way to return things from a macro, instead of being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr` variants of the `MacResult` enum. This does simplify the logic handling the expansions, but the biggest value of this is it makes macros in (for example) type position easier to implement, as there's this single thing to modify. By my measurements (using `-Z time-passes` on libstd and librustc etc.), this appears to have little-to-no impact on expansion speed. There are presumably larger costs than the small number of extra allocations and virtual calls this adds (notably, all `macro_rules!`-defined macros have not changed in behaviour, since they had to use the `AnyMacro` trait anyway).
2014-04-08Test fixes from rollupAlex Crichton-8/+0
Closes #13394 (sync: remove unsafe and add Send+Share to Deref (enabled by autoderef vtables)) Closes #13389 (Made libflate functions return Options instead of outright failing) Closes #13388 (doc: Document flavorful variations of paths) Closes #13387 (Register new snapshots) Closes #13386 (std: Add more docs for ptr mod) Closes #13384 (Tweak crate loading to load less metadata) Closes #13382 (fix ~ZeroSizeType rvalues) Closes #13378 (Update tidy script, replace XXX with FIXME) Closes #13377 (std: User a smaller stdin buffer on windows) Closes #13369 (Fix spelling errors in comments.) Closes #13314 (Made 'make install' include libs for additional targets) Closes #13278 (std: make vec!() macro handle a trailing comma) Closes #13276 (Add test for #11881)
2014-04-08rustc: Never register syntax crates in CStoreAlex Crichton-4/+4
When linking, all crates in the local CStore are used to link the final product. With #[phase(syntax)], crates want to be omitted from this linkage phase, and this was achieved by dumping the entire CStore after loading crates. This causes crates like the standard library to get loaded twice. This loading process is a fairly expensive operation when dealing with decompressing metadata. This commit alters the loading process to never register syntax crates in CStore. Instead, only phase(link) crates ever make their way into the map of crates. The CrateLoader trait was altered to return everything in one method instead of having separate methods for finding information.
2014-03-31syntax: Switch field privacy as necessaryAlex Crichton-5/+5
2014-03-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-1/+1
2014-03-25Changed `iter::Extendable` and `iter::FromIterator` to take a `Iterator` by ↵Marvin Löbel-1/+1
value
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-3/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-2/+2
Closes #12771
2014-03-18Docify std::vec_ngSteven Fackler-1/+1
I also removed a couple of methods that were silly and added sort.
2014-03-17Fix rustdoc and tests.Eduard Burtescu-7/+7
2014-03-17De-@ ParseSess uses.Eduard Burtescu-7/+8
2014-03-15log: Introduce liblog, the old std::loggingAlex Crichton-0/+6
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-11Add an ItemModifier syntax extension typeSteven Fackler-1/+46
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-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-9/+30
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-56/+56
- Moves mtwt hygiene code into its own file - Fixes FIXME's which leads to ~2x speed gain in expansion pass - It is now @-free