about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2014-09-30Update after the fall out from the syntax::ptr changesJakub Wieczorek-30/+36
2014-09-30Update based on PR feedbackKevin Ballard-20/+16
2014-09-30Produce a better error for irrefutable `if let` patternsKevin Ballard-2/+2
Modify ast::ExprMatch to include a new value of type ast::MatchSource, making it easy to tell whether the match was written literally or produced via desugaring. This allows us to customize error messages appropriately.
2014-09-30Desugar 'if let' into the appropriate 'match'Kevin Ballard-1/+90
2014-09-29rollup merge of #17592 : kmcallister/inline-asm-locAlex Crichton-1/+12
2014-09-29rollup merge of #17576 : kmcallister/hide-quotesAlex Crichton-49/+51
2014-09-29auto merge of #17409 : farcaller/rust/patch-1, r=huonwbors-2/+6
Parser.parse_method now has a second argument, I assume ast::Inherited is the correct visibility in this case.
2014-09-29Fixed quote_method!() implementationVladimir Pouzanov-2/+6
Parser.parse_method now has a second argument, I assume ast::Inherited is the correct visibility in this case.
2014-09-28Keep ExpnId abstract by providing conversionsKeegan McAllister-1/+1
2014-09-28auto merge of #17527 : sfackler/rust/cfg-syntax, r=alexcrichtonbors-31/+13
We'll need a snapshot before we can convert the codebase over and turn on the deprecation warnings. cc #17490 This is sitting on top of #17506
2014-09-27Convert cfg syntax to new systemSteven Fackler-31/+13
This removes the ability to use `foo(bar)` style cfgs. Switch them to `foo_bar` or `foo="bar"` instead. [breaking-change]
2014-09-27Translate inline assembly errors back to source locationsKeegan McAllister-1/+12
Fixes #17552.
2014-09-27auto merge of #17506 : sfackler/rust/cfg-attr, r=alexcrichtonbors-0/+59
cc #17490 Reopening of #16230
2014-09-26Hide the quote_*! macros when the feature gate is offKeegan McAllister-49/+51
This makes it easier to experiment with improved quasiquoting as an ordinary plugin library. The list of quote macros in feature_gate.rs was already out of sync; this commit also prevents that problem in the future.
2014-09-25auto merge of #17378 : Gankro/rust/hashmap-entry, r=aturonbors-7/+9
Deprecates the `find_or_*` family of "internal mutation" methods on `HashMap` in favour of the "external mutation" Entry API as part of RFC 60. Part of #17320, but this still needs to be done on the rest of the maps. However they don't have any internal mutation methods defined, so they can be done without deprecating or breaking anything. Work on `BTree` is part of the complete rewrite in #17334. The implemented API deviates from the API described in the RFC in two key places: * `VacantEntry.set` yields a mutable reference to the inserted element to avoid code duplication where complex logic needs to be done *regardless* of whether the entry was vacant or not. * `OccupiedEntry.into_mut` was added so that it is possible to return a reference into the map beyond the lifetime of the Entry itself, providing functional parity to `VacantEntry.set`. This allows the full find_or_insert functionality to be implemented using this API. A PR will be submitted to the RFC to amend this. [breaking-change]
2014-09-24handling fallout from entry apiAlexis Beingessner-7/+9
2014-09-24Remove unused enum variantsJakub Wieczorek-8/+1
2014-09-24Fix rebase falloutSteven Fackler-13/+11
2014-09-23Add a cfg_attr syntax extensionSteven Fackler-0/+61
This extends cfg-gating to attributes. ```rust #[cfg_attr(<cfg pattern>, <attr>)] ``` will expand to ```rust #[<attr>] ``` if the `<cfg pattern>` matches the current cfg environment, and nothing if it does not. The grammar for the cfg pattern has a simple recursive structure: * `value` and `key = "value"` are cfg patterns, * `not(<cfg pattern>)` is a cfg pattern and matches if `<cfg pattern>` does not. * `all(<cfg pattern>, ...)` is a cfg pattern and matches if all of the `<cfg pattern>`s do. * `any(<cfg pattern>, ...)` is a cfg pattern and matches if any of the `<cfg pattern>`s do. Examples: ```rust // only derive Show for assert_eq! in tests #[cfg_attr(test, deriving(Show))] struct Foo { ... } // only derive Show for assert_eq! in tests and debug builds #[cfg_attr(any(test, not(ndebug)), deriving(Show))] struct Foo { ... } // ignore a test in certain cases #[test] #[cfg_attr(all(not(target_os = "linux"), target_endian = "big"), ignore)] fn test_broken_thing() { ... } // Avoid duplication when fixing staging issues in rustc #[cfg_attr(not(stage0), lang="iter")] pub trait Iterator<T> { ... } ```
2014-09-23auto merge of #17402 : steveklabnik/rust/update_manual, r=brsonbors-1/+1
Because I'm still :mask: :mask: :mask: , I figured some mindless tasks would be better than trying to finish the ownership guide. The manual has long been waiting for some :heart: :heart: :heart: , and so I gave it a quick once-over. I made small commits in case any of the changes are a bit weird, I mostly did a few things: 1. changed 'manual' to 'reference.' I feel like this name is better. If it's not, It's not a huge deal. it shouldn't be `rust.md` though. 2. word wrapped everything appropriately. Changes 1&2 are in the first commit, so that its' easier to see the changes in the later ones. 3. fixed other small style issues 4. removed references to things that are in the standard library, and not the language itself There's still lots of gross in here, but I didn't want to pile on too too many changes. /cc @brson @nikomatsakis
2014-09-22librustc: Parse and resolve higher-rank lifetimes in traits.Patrick Walton-1/+2
They will ICE during typechecking if used, because they depend on trait reform. This is part of unboxed closures.
2014-09-22manual -> reference & formattingSteve Klabnik-1/+1
'reference' sounds better than 'manual' to me here, and rust.html is certainly wrong. I also wrapped everything to 80 cols.
2014-09-22auto merge of #17339 : treeman/rust/doc-things, r=alexcrichtonbors-156/+129
Also some cleanup to conform to documentation style.
2014-09-20auto merge of #17319 : kmcallister/rust/method-macro-bt, r=pcwaltonbors-1/+4
We were leaving these on the stack, causing spurious backtraces.
2014-09-19rollup merge of #17338 : nick29581/variants-namespaceAlex Crichton-22/+23
2014-09-19rollup merge of #17314 : eddyb/span-no-gcAlex Crichton-83/+72
2014-09-19Allow syntax extensions to return multiple items, closes #16723.Florian Hahn-16/+11
This patch replaces `MacItem` with `MacItems`.
2014-09-19Add enum variants to the type namespaceNick Cameron-22/+23
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-18syntax: use an index in CodeMap instead of Gc for ExpnInfo.Eduard Burtescu-83/+72
2014-09-17librustc: Implement associated types behind a feature gate.Patrick Walton-1/+4
The implementation essentially desugars during type collection and AST type conversion time into the parameter scheme we have now. Only fully qualified names--e.g. `<T as Foo>::Bar`--are supported.
2014-09-17Pop the expansion context after expanding a method macroKeegan McAllister-1/+4
We were leaving these on the stack, causing spurious backtraces. I've confirmed that this test fails without the fix.
2014-09-17doc: Remove "see above".Jonas Hietala-4/+3
2014-09-17doc: Backticks and spelling mistakes.Jonas Hietala-13/+13
2014-09-17doc: Cleanup.Jonas Hietala-149/+123
Remove ~~~ for code block specification. Use /// Over /** */ for doc blocks.
2014-09-16Fallout from renamingAaron Turon-40/+40
2014-09-14Add help diagnostic messagesP1start-0/+4
This adds ‘help’ diagnostic messages to rustc. This is used for anything that provides help to the user, particularly the `--explain` messages that were previously integrated into the relevant error message.
2014-09-14syntax: tests: fix fallout from using ptr::P.Eduard Burtescu-1/+2
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-1108/+1032
2014-09-13auto merge of #17162 : sfackler/rust/decorator-traits, r=huonwbors-39/+53
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-4/+4
2014-09-12Remove largely unused context from Visitor.Eduard Burtescu-23/+22
2014-09-10Remove BasicMacroExpander and BasicIdentMacroExpanderSteven Fackler-29/+10
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-09-11auto merge of #16866 : P1start/rust/tuple-indexing, r=brsonbors-0/+12
This allows code to access the fields of tuples and tuple structs behind the feature gate `tuple_indexing`: ```rust #![feature(tuple_indexing)] let x = (1i, 2i); assert_eq!(x.1, 2); struct Point(int, int); let origin = Point(0, 0); assert_eq!(origin.0, 0); assert_eq!(origin.1, 0); ``` Implements [RFC 53](https://github.com/rust-lang/rfcs/blob/master/active/0053-tuple-accessors.md). Closes #16950.
2014-09-10Change ItemModifier and ItemDecorator to traitsSteven Fackler-12/+45
For convenience, the traits are implemented for the respective bare functions. Change code from this: ```rust ItemDecorator(some_function) // or ItemModifier(some_other_function) ``` to ```rust ItemDecorator(box some_function) // or ItemModifier(box some_other_function) ``` [breaking-change]
2014-09-09auto merge of #16662 : pczarn/rust/format-fmtstr-opt, r=brsonbors-51/+99
Based on an observation that strings and arguments are always interleaved, thanks to #15832. Additionally optimize invocations where formatting parameters are unspecified for all arguments, e.g. `"{} {:?} {:x}"`, by emptying the `__STATIC_FMTARGS` array. Next, `Arguments::new` replaces an empty slice with `None` so that passing empty `__STATIC_FMTARGS` generates slightly less machine code when `Arguments::new` is inlined. Furthermore, formatting itself treats these cases separately without making redundant copies of formatting parameters. All in all, this adds a single mov instruction per `write!` in most cases. That's why code size has increased.
2014-09-10Implement tuple and tuple struct indexingP1start-0/+12
This allows code to access the fields of tuples and tuple structs: let x = (1i, 2i); assert_eq!(x.1, 2); struct Point(int, int); let origin = Point(0, 0); assert_eq!(origin.0, 0); assert_eq!(origin.1, 0);
2014-09-09Optimize for the most common cases of `format!`Piotr Czarnecki-49/+73
Format specs are ignored and not stored in case they're all default. Restore default formatting parameters during iteration. Pass `None` instead of empty slices of format specs to take advantage of non-nullable pointer optimization. Generate a call to one of two functions of `fmt::Argument`.
2014-09-09Decouple string and argument piecesPiotr Czarnecki-30/+54
2014-09-08quote: Explicitly borrow the ExtCtxtKeegan McAllister-1/+3
Fixes #16992.
2014-09-04auto merge of #16982 : jbcrail/rust/comment-and-string-corrections, ↵bors-1/+1
r=alexcrichton I corrected spelling and capitalization errors in comments and strings.