about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2014-07-20auto merge of #15785 : treeman/rust/fix-15780, r=alexcrichtonbors-2/+11
Fix for #15780.
2014-07-20Correctly stringify! types and paths inside macrosPiotr Jawniak-3/+5
Closes #8709
2014-07-19Register new snapshotsAlex Crichton-90/+9
2014-07-19Fixed lifetimes on syntax deriving structs, implemented CloneDzmitry Malyshau-2/+6
2014-07-19auto merge of #15754 : jakub-/rust/diagnostics, r=alexcrichtonbors-6/+6
2014-07-18Special case for 0 arguments given in format!Jonas Hietala-4/+4
2014-07-18Assign more diagnostic codesJakub Wieczorek-6/+6
2014-07-18Correct plural of arguments in format_args!Jonas Hietala-2/+11
2014-07-18librustc: Implement unboxed closures with mutable receiversPatrick Walton-88/+210
2014-07-18auto merge of #15732 : bgamari/rust/to-tokens, r=alexcrichtonbors-3/+35
Here I add a `ToTokens` impl for `Attribute_` and `Option<T>`, as well as generalize the impl for `Vec<T>`
2014-07-18auto merge of #15725 : aochagavia/rust/vec, r=alexcrichtonbors-1/+1
* Deprecated `to_owned` in favor of `to_vec` * Deprecated `into_owned` in favor of `into_vec` [breaking-change]
2014-07-17librustc: Remove cross-borrowing of `Box<T>` to `&T` from the language,Patrick Walton-21/+27
except where trait objects are involved. Part of issue #15349, though I'm leaving it open for trait objects. Cross borrowing for trait objects remains because it is needed until we have DST. This will break code like: fn foo(x: &int) { ... } let a = box 3i; foo(a); Change this code to: fn foo(x: &int) { ... } let a = box 3i; foo(&*a); [breaking-change]
2014-07-17auto merge of #15706 : phi-gamma/rust/master, r=huonwbors-1/+1
I kept changes to each file in a separate commit. Please let me know if you prefer them squashed!
2014-07-17Rename functions in the CloneableVector traitAdolfo Ochagavía-1/+1
* Deprecated `to_owned` in favor of `to_vec` * Deprecated `into_owned` in favor of `into_vec` [breaking-change]
2014-07-17syntax: Add ToTokens impl for MethodBen Gamari-0/+2
2014-07-17syntax: Add quote_method!Ben Gamari-0/+13
2014-07-16libsyntax: Remove `Send` from `PtrTy` in `deriving`.Patrick Walton-6/+0
It'll be complex to port to the new explicit-self regime and it seems to be unused.
2014-07-16librustc: Implement the fully-expanded, UFCS form of explicit self.Patrick Walton-8/+35
This makes two changes to region inference: (1) it allows region inference to relate early-bound regions; and (2) it allows regions to be related before variance runs. The former is needed because there is no relation between the two regions before region substitution happens, while the latter is needed because type collection has to run before variance. We assume that, before variance is inferred, that lifetimes are invariant. This is a conservative overapproximation. This relates to #13885. This does not remove `~self` from the language yet, however. [breaking-change]
2014-07-16syntax: Generalize ToTokens impl for Vec<T>Ben Gamari-3/+4
It will now `flat_map` over the elements of a `Vec<T>` if `T: ToTokens`
2014-07-16syntax: Add ToTokens for Attribute_Ben Gamari-0/+7
2014-07-16syntax: Add ToTokens for Option<T>Ben Gamari-0/+9
2014-07-16auto merge of #15691 : jbclements/rust/method-field-cleanup, r=alexcrichtonbors-25/+85
This patch applies the excellent suggestion of @pnkfelix to group the helper methods for method field access into a Trait, making the code much more readable, and much more similar to the way it was before.
2014-07-16obsolete.rs: fix typo in messagePhilipp Gesang-1/+1
2014-07-15libsyntax::ast: Derive Show implsBen Gamari-70/+82
2014-07-15change to new trait style for method field refsJohn Clements-4/+4
Per @pnkfelix 's suggestion, using a trait to make these field accesses more readable (and vastly more similar to the original code. oops fix new ast_map fix
2014-07-15use trait rather than fnsJohn Clements-21/+81
please note the snapshot-waiting unpleasantness. I'm unable to use the traditional #[cfg(stage0)] mechanism to swap the new style in for later compiler stages, because macros invocations in method positions cause the parser to choke before cfg can strip it out. Parenthetical note: this problem wouldn't arise with an interleaved parsing/expansion....
2014-07-15auto merge of #15615 : jakub-/rust/diagnostics, r=brsonbors-1/+27
2014-07-15Fix errorsAdolfo Ochagavía-2/+0
2014-07-15Deprecate `str::from_utf8_owned`Adolfo Ochagavía-7/+7
Use `String::from_utf8` instead [breaking-change]
2014-07-15Extend --pretty flowgraph=ID to include dataflow results in output.Felix S. Klock II-0/+220
Use one or more of the following `-Z` flag options to tell the graphviz renderer to include the corresponding dataflow sets (after the iterative constraint propagation reaches a fixed-point solution): * `-Z flowgraph-print-loans` : loans computed via middle::borrowck * `-Z flowgraph-print-moves` : moves computed via middle::borrowck::move_data * `-Z flowgraph-print-assigns` : assignments, via middle::borrowck::move_data * `-Z flowgraph-print-all` : all of the available sets are included. Fix #15016. ---- This also adds a module, `syntax::ast_map::blocks`, that captures a common abstraction shared amongst code blocks and procedure-like things. As part of this, moved `ast_map.rs` to subdir `ast_map/mod.rs`, to follow our directory layout conventions. (incorporated review feedback from huon, acrichto.)
2014-07-13auto merge of #15646 : jbclements/rust/method-macros, r=cmrbors-278/+430
This patch adds support for macros in method position. It follows roughly the template for Item macros, where an outer `Method` wrapper contains a `Method_` enum which can either be a macro invocation or a standard macro definition. One note; adding support for macros that expand into multiple methods is not included here, but should be a simple parser change, since this patch updates the type of fold_macro to return a smallvector of methods. For reviewers, please pay special attention to the parser changes; these are the ones I'm most concerned about. Because of the small change to the interface of fold_method, this is a ... [breaking change]
2014-07-13macro expansion for methodsJohn Clements-25/+47
Closes #4621
2014-07-13expansion abstractionJohn Clements-144/+114
2014-07-13add make_method method to MacResult traitJohn Clements-1/+36
this allows macro results to be parsed as methods
2014-07-13macro in method position parsingJohn Clements-13/+42
2014-07-13remove no-stmt checkJohn Clements-4/+0
nothing wrong with a statement expanding into 0 stmts, that I can see.
2014-07-13update fold_method to return a smallvectorJohn Clements-13/+33
This is nice for macros, to allow them to expand into multiple methods
2014-07-13macro method unit test case fixJohn Clements-2/+2
2014-07-13refactor Method definition to make space for macrosJohn Clements-94/+174
This change propagates to many locations, but because of the Macro Exterminator (or, more properly, the invariant that it protects), macro invocations can't occur downstream of expansion. This means that in librustc and librustdoc, extracting the desired field can simply assume that it can't be a macro invocation. Functions in ast_util abstract over this check.
2014-07-13auto merge of #15584 : alexcrichton/rust/warn-annoyances, r=cmrbors-2/+9
* Don't warn about `#[crate_name]` if `--crate-name` is specified * Don't warn about non camel case identifiers on `#[repr(C)]` structs * Switch `mode` to `mode_t` in libc.
2014-07-12Use a nicer Show impl for NameCorey Richardson-2/+9
2014-07-13auto merge of #15621 : sfackler/rust/attr-span, r=cmrbors-1/+1
They used to be one token too long, so you'd see things like ``` rust/rust/test.rs:1:1: 2:2 warning: unused attribute, rust/rust/test.rs:1 #![foo] rust/rust/test.rs:2 #![bar] ``` instead of ``` test.rs:1:1: 1:8 warning: unused attribute, #[warn(unused_attribute)] on by default test.rs:1 #![foo] ^~~~~~~ ```
2014-07-12Convert a first batch of diagnostics to have error codesJakub Wieczorek-1/+27
2014-07-12auto merge of #15610 : brson/rust/0.12.0, r=alexcrichtonbors-1/+1
2014-07-12auto merge of #15601 : jbclements/rust/disable-default-macro-behavior, ↵bors-25/+102
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-11Fix spans for attributesSteven Fackler-1/+1
They used to be one token too long, so you'd see things like ``` rust/rust/test.rs:1:1: 2:2 warning: unused attribute, rust/rust/test.rs:1 #![foo] rust/rust/test.rs:2 #![bar] ``` instead of ``` test.rs:1:1: 1:8 warning: unused attribute, #[warn(unused_attribute)] on by default test.rs:1 #![foo] ^~~~~~~ ```
2014-07-11Update doc URLs for version bumpBrian Anderson-1/+1
2014-07-11add Macro ExterminatorJohn Clements-0/+19
the Macro Exterminator ensures that there are no macro invocations in an AST. This should help make later passes confident that there aren't hidden items, methods, expressions, etc.
2014-07-11make walk/visit_mac opt-in onlyJohn Clements-14/+61
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-11use side table to store exported macrosJohn Clements-6/+16
Per discussion with @sfackler, refactored the expander to change the way that exported macros are collected. Specifically, a crate now contains a side table of spans that exported macros go into. This has two benefits. First, the encoder doesn't need to scan through the expanded crate in order to discover exported macros. Second, the expander can drop all expanded macros from the crate, with the pleasant result that a fully expanded crate contains no macro invocations (which include macro definitions).