about summary refs log tree commit diff
path: root/src/libsyntax/ext/expand.rs
AgeCommit message (Collapse)AuthorLines
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-02Make visible types public in rustcSteven Fackler-2/+2
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-33/+50
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-53/+35
2014-02-23Make break and continue hygienicEdward Wang-2/+29
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-19librustc: Remove unique vector patterns from the language.Patrick Walton-9/+10
Preparatory work for removing unique vectors from the language, which is itself preparatory work for dynamically sized types.
2014-02-18Avoid returning original macro if expansion fails.Douglas Young-4/+4
Closes #11692. Instead of returning the original expression, a dummy expression (with identical span) is returned. This prevents infinite loops of failed expansions as well as odd double error messages in certain situations.
2014-02-14Expand ItemDecorator extensions in all contextsSteven Fackler-52/+33
Now that fold_item can return multiple items, this is pretty trivial. It also recursively expands generated items so ItemDecorators can generate items that are tagged with ItemDecorators! Closes #4913
2014-02-14auto merge of #12234 : sfackler/rust/restructure-item-decorator, r=huonwbors-8/+8
The old method of building up a list of items and threading it through all of the decorators was unwieldy and not really scalable as non-deriving ItemDecorators become possible. The API is now that the decorator gets an immutable reference to the item it's attached to, and a callback that it can pass new items to. If we want to add syntax extensions that can modify the item they're attached to, we can add that later, but I think it'll have to be separate from ItemDecorator to avoid strange ordering issues. @huonw
2014-02-14Refactored ast_map and friends, mainly to have Paths without storing them.Eduard Burtescu-32/+19
2014-02-13Tweak ItemDecorator APISteven Fackler-8/+8
The old method of building up a list of items and threading it through all of the decorators was unwieldy and not really scalable as non-deriving ItemDecorators become possible. The API is now that the decorator gets an immutable reference to the item it's attached to, and a callback that it can pass new items to. If we want to add syntax extensions that can modify the item they're attached to, we can add that later, but I think it'll have to be separate from ItemDecorator to avoid strange ordering issues.
2014-02-13auto merge of #12017 : FlaPer87/rust/replace-mod-crate, r=alexcrichtonbors-9/+9
The first setp for #9880 is to add a new `crate` keyword. This PR does exactly that. I took a chance to refactor `parse_item_foreign_mod` and I broke it down into 2 separate methods to isolate each feature. The next step will be to push a new stage0 snapshot and then get rid of all `extern mod` around the code.
2014-02-13Stop unloading syntax librariesSteven Fackler-3/+7
Externally loaded libraries are able to do things that cause references to them to survive past the expansion phase (e.g. creating @-box cycles, launching a task or storing something in task local data). As such, the library has to stay loaded for the lifetime of the process.
2014-02-13Replace `crate` usage with `krate`Flavio Percoco-9/+9
This patch replaces all `crate` usage with `krate` before introducing the new keyword. This ensures that after introducing the keyword, there won't be any compilation errors. krate might not be the most expressive substitution for crate but it's a very close abbreviation for it. `module` was already used in several places already.
2014-02-11libsyntax -- combine two iter ops into one so that `fld` does not need to be ↵Niko Matsakis-5/+6
mutably shared between them both
2014-02-10Ignore #[phase] on use view itemsSteven Fackler-8/+13
Closes #11806
2014-02-08Remove unnecessary parentheses.OGINO Masanori-1/+1
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-08Fix unused import warnings.OGINO Masanori-5/+3
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-07Removed @self and @Trait.Eduard Burtescu-118/+22
2014-02-07Fix expansion testsSeo Sanghyeon-4/+4
2014-02-06Avoid cloning ast::CrateConfigSeo Sanghyeon-2/+1
2014-02-03syntax: Remove usage of io_error in testsAlex Crichton-5/+4
2014-02-02librustc: Remove `@str` from the languagePatrick Walton-2/+2
2014-02-02libsyntax: Remove many uses of `token::ident_to_str`Patrick Walton-9/+23
2014-02-02libsyntax: Fix tests.Patrick Walton-17/+17
2014-02-02librustc: De-`@str` `NameAndSpan`Patrick Walton-19/+31
2014-02-02librustc: Fix merge fallout.Patrick Walton-4/+4
2014-02-02librustc: Stop using `@str` for source.Patrick Walton-1/+1
2014-02-02libsyntax: Introduce an `InternedString` type to reduce `@str` in thePatrick Walton-2/+2
compiler and use it for attributes
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-1/+1
2014-01-25Simplify and rename macro APISteven Fackler-49/+12
Now that procedural macros can be implemented outside of the compiler, it's more important to have a reasonable API to work with. Here are the basic changes: * Rename SyntaxExpanderTTTrait to MacroExpander, SyntaxExpanderTT to BasicMacroExpander, etc. I think "procedural macro" is the right term for these now, right? The other option would be SynExtExpander or something like that. * Stop passing the SyntaxContext to extensions. This was only ever used by macro_rules, which doesn't even use it anymore. I can't think of a context in which an external extension would need it, and removal allows the API to be significantly simpler - no more SyntaxExpanderTTItemExpanderWithoutContext wrappers to worry about.
2014-01-24Move macro_rules! macros to libstdSteven Fackler-241/+0
They all have to go into a single module at the moment unfortunately. Ideally, the logging macros would live in std::logging, condition! would live in std::condition, format! in std::fmt, etc. However, this introduces cyclic dependencies between those modules and the macros they use which the current expansion system can't deal with. We may be able to get around this by changing the expansion phase to a two-pass system but that's for a later PR. Closes #2247 cc #11763
2014-01-23Redo exported macro serializationSteven Fackler-5/+15
The old method of serializing the AST gives totally bogus spans if the expansion of an imported macro causes compilation errors. The best solution seems to be to serialize the actual textual macro definition and load it the same way the std-macros are. I'm not totally confident that getting the source from the CodeMap will always do the right thing, but it seems to work in simple cases.
2014-01-21Remove unnecessary parentheses.Huon Wilson-2/+2
2014-01-19auto merge of #11644 : huonw/rust/less-fatality, r=cmrbors-32/+51
This means that compilation continues for longer, and so we can see more errors per compile. This is mildly more user-friendly because it stops users having to run rustc n times to see n macro errors: just run it once to see all of them.
2014-01-17Actually force a / in the path for ext cratesSteven Fackler-2/+2
If the library is in the working directory, its path won't have a "/" which will cause dlopen to search /usr/lib etc. It turns out that Path auto-normalizes during joins so Path::new(".").join(path) is actually a no-op.
2014-01-17auto merge of #11585 : nikomatsakis/rust/issue-3511-rvalue-lifetimes, r=pcwaltonbors-18/+12
Major changes: - Define temporary scopes in a syntax-based way that basically defaults to the innermost statement or conditional block, except for in a `let` initializer, where we default to the innermost block. Rules are documented in the code, but not in the manual (yet). See new test run-pass/cleanup-value-scopes.rs for examples. - Refactors Datum to better define cleanup roles. - Refactor cleanup scopes to not be tied to basic blocks, permitting us to have a very large number of scopes (one per AST node). - Introduce nascent documentation in trans/doc.rs covering datums and cleanup in a more comprehensive way. r? @pcwalton
2014-01-18syntax::ext: replace span_fatal with span_err in many places.Huon Wilson-32/+51
This means that compilation continues for longer, and so we can see more errors per compile. This is mildly more user-friendly because it stops users having to run rustc n times to see n macro errors: just run it once to see all of them.
2014-01-17Change expansion of `for` loop to use a `match` statementNiko Matsakis-18/+12
so that the "innermost enclosing statement" used for rvalue temporaries matches up with user expectations
2014-01-16Load macros from external modulesSteven Fackler-8/+102
2014-01-13librustc: Remove `@` pointer patterns from the languagePatrick Walton-56/+59
2014-01-11Remove re-exports of std::io::stdio::{print, println} in the prelude.Brendan Zabarauskas-4/+4
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-39/+39
2014-01-09Remove ApproxEq and assert_approx_eq!Brendan Zabarauskas-37/+0
This trait seems to stray too far from the mandate of a standard library as implementations may vary between use cases.
2014-01-07Fixup the rest of the tests in the compilerAlex Crichton-0/+1
2014-01-06auto merge of #11332 : sfackler/rust/de-at-se, r=huonwbors-53/+52
This is necessary for #11151 to make sure dtors run before the libraries are unloaded.
2014-01-06Disowned the Visitor.Eduard Burtescu-1/+1
2014-01-05Use ~-objects instead of @-objects for syntax extsSteven Fackler-53/+52
This is necessary for #11151 to make sure dtors run before the libraries are unloaded.
2014-01-03libsyntax: Fix tests.Patrick Walton-9/+10
2014-01-03libsyntax: Remove unused `MultiRenamer`Patrick Walton-17/+3