about summary refs log tree commit diff
path: root/src/librustc/plugin
AgeCommit message (Collapse)AuthorLines
2014-10-01Add a guide to compiler pluginsKeegan McAllister-2/+2
Fixes #16983.
2014-09-19Add enum variants to the type namespaceNick Cameron-3/+3
Change to resolve and update compiler and libs for uses. [breaking-change] Enum variants are now in both the value and type namespaces. This means that if you have a variant with the same name as a type in scope in a module, you will get a name clash and thus an error. The solution is to either rename the type or the variant.
2014-09-16Fallout from renamingAaron Turon-1/+1
2014-09-13auto merge of #17162 : sfackler/rust/decorator-traits, r=huonwbors-8/+3
The other extension types already worked this way and it can be useful to track some state along with the extension. I also removed the `BasicMacroExpander` and `BasicIdentMacroExpander` since the span inside of them was never used. The expander function types now directly implement the relevant trait.
2014-09-12Track the visited AST's lifetime throughout Visitor.Eduard Burtescu-2/+2
2014-09-12Remove largely unused context from Visitor.Eduard Burtescu-8/+8
2014-09-10Remove BasicMacroExpander and BasicIdentMacroExpanderSteven Fackler-8/+3
The spans inside of these types were always None and never used. Pass the expander function directly instead of wrapping it in one of these types. [breaking-change]
2014-08-30Add lint groups; define built-in lint groups `bad_style` and `unused`P1start-1/+12
This adds support for lint groups to the compiler. Lint groups are a way of grouping a number of lints together under one name. For example, this also defines a default lint for naming conventions, named `bad_style`. Writing `#[allow(bad_style)]` is equivalent to writing `#[allow(non_camel_case_types, non_snake_case, non_uppercase_statics)]`. These lint groups can also be defined as a compiler plugin using the new `Registry::register_lint_group` method. This also adds two built-in lint groups, `bad_style` and `unused`. The contents of these groups can be seen by running `rustc -W help`.
2014-07-21rustc: Pass optional additional plugins to compile_inputBrian Anderson-2/+16
This provides a way for clients of the rustc library to add their own features to the pipeline.
2014-07-12auto merge of #15601 : jbclements/rust/disable-default-macro-behavior, ↵bors-0/+5
r=alexcrichton Our AST definition can include macro invocations, which can expand into all kinds of things. Macro invocations are expanded away during expansion time, and the rest of the compiler doesn't have to deal with them. However, we have no way of enforcing this. This patch adds two protective mechanisms. First, it adds a (quick) explicit check that ensures there are no macro invocations remaining in the AST after expansion. Second, it updates the visit and fold mechanisms so that by default, they will not traverse macro invocations. It's easy enough to add this, if desired (it's documented in the source, and examples appear, e.g. in the IdentFinder. Along the way, I also consulted with @sfackler to refactor the macro export mechanism so that it stores macro text spans in a side table, rather than leaving them in the AST.
2014-07-11make walk/visit_mac opt-in onlyJohn Clements-0/+5
macros can expand into arbitrary items, exprs, etc. This means that using a default walker or folder on an AST before macro expansion is complete will miss things (the things that the macros expand into). As a partial fence against this, this commit moves the default traversal of macros into a separate procedure, and makes the default trait implementation signal an error. This means that Folders and Visitors can traverse macros if they want to, but they need to explicitly add an impl that calls the walk_mac or fold_mac procedure This should prevent problems down the road.
2014-07-09Register new snapshotsAlex Crichton-1/+1
Closes #15544
2014-07-08introducing let-syntaxJohn Clements-1/+3
The let-syntax expander is different in that it doesn't apply a mark to its token trees before expansion. This is used for macro_rules, and it's because macro_rules is essentially MTWT's let-syntax. You don't want to mark before expand sees let-syntax, because there's no "after" syntax to mark again. In some sense, the cleaner approach might be to introduce a new AST node that macro_rules expands into; this would make it clearer that the expansion of a macro is distinct from the addition of a new macro binding. This should work for now, though...
2014-06-28Rename all raw pointers as necessaryAlex Crichton-1/+1
2014-06-24Implement lint pluginsKeegan McAllister-0/+11
2014-06-13librustc: Forbid `transmute` from being called on types whose size isPatrick Walton-2/+4
only known post-monomorphization, and report `transmute` errors before the code is generated for that `transmute`. This can break code that looked like: unsafe fn f<T>(x: T) { let y: int = transmute(x); } Change such code to take a type parameter that has the same size as the type being transmuted to. Closes #12898. [breaking-change]
2014-06-09std: Move dynamic_lib from std::unstable to stdBrian Anderson-1/+1
This leaves a deprecated reexport in place temporarily. Closes #1457.
2014-06-09Document rustc::pluginKeegan McAllister-5/+99
2014-06-09Implement #[plugin_registrar]Keegan McAllister-0/+246
See RFC 22. [breaking-change]