about summary refs log tree commit diff
path: root/src/librustc/plugin
AgeCommit message (Collapse)AuthorLines
2015-01-08librustc::metadata : Allow passing a string to read_plugin_metadataManish Goregaokar-2/+2
2015-01-07use slicing sugarJorge Aparicio-3/+3
2015-01-07Replace full slice notation with index callsNick Cameron-3/+3
2015-01-05Forbid '#[macro_use] extern crate' outside the crate rootKeegan McAllister-0/+16
2015-01-05Pass the #[plugin(...)] meta item to the registrarKeegan McAllister-7/+38
2015-01-05Allow selective macro importKeegan McAllister-5/+28
2015-01-05Move #[macro_reexport] to extern crateKeegan McAllister-1/+27
2015-01-05Replace #[phase] with #[plugin] / #[macro_use] / #[no_link]Keegan McAllister-16/+26
2015-01-05creader: Load parts of plugin metadata on demandKeegan McAllister-32/+27
2015-01-05Reformat metadata for exported macrosKeegan McAllister-20/+13
Instead of copy-pasting the whole macro_rules! item from the original .rs file, we serialize a separate name, attributes list, and body, the latter as pretty-printed TTs. The compilation of macro_rules! macros is decoupled somewhat from the expansion of macros in item position. This filters out comments, and facilitates selective imports.
2015-01-05creader: Use a single structKeegan McAllister-3/+3
2015-01-05Replace LetSyntaxTT with MacroRulesTTKeegan McAllister-6/+15
The implementation of LetSyntaxTT was specialized to macro_rules! in various ways. This gets rid of the false generality and simplifies the code.
2014-12-21Fallout of std::str stabilizationAlex Crichton-3/+3
2014-11-29Replace some verbose match statements with their `if let` equivalent.jfager-7/+4
No semantic changes, no enabling `if let` where it wasn't already enabled.
2014-11-26/*! -> //!Steve Klabnik-48/+46
Sister pull request of https://github.com/rust-lang/rust/pull/19288, but for the other style of block doc comment.
2014-11-19Make os::getcwd() return IoResult<Path>Barosl Lee-1/+1
os::getcwd() panics if the current directory is not available. According to getcwd(3), there are three cases: - EACCES: Permission denied. - ENOENT: The current working directory has been removed. - ERANGE: The buffer size is less than the actual absolute path. This commit makes os::getcwd() return IoResult<Path>, not just Path, preventing it from panicking. As os::make_absolute() depends on os::getcwd(), it is also modified to return IoResult<Path>. Fixes #16946. [breaking-change]
2014-11-18Move trans, back, driver, and back into a new crate, rustc_trans. Reduces ↵Niko Matsakis-1/+1
memory usage significantly and opens opportunities for more parallel compilation.
2014-10-29Rename fail! to panic!Steve Klabnik-1/+1
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-2/+2
Spring cleaning is here! In the Fall! This commit removes quite a large amount of deprecated functionality from the standard libraries. I tried to ensure that only old deprecated functionality was removed. This is removing lots and lots of deprecated features, so this is a breaking change. Please consult the deprecation messages of the deleted code to see how to migrate code forward if it still needs migration. [breaking-change]
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]