about summary refs log tree commit diff
path: root/src/libsyntax/ext/tt
AgeCommit message (Collapse)AuthorLines
2015-11-25Auto merge of #30011 - jonas-schievink:macro-context, r=nrcbors-10/+10
Fixes #22425 Also fixes #30007, since it's just a change from `true` to `false`.
2015-11-24Remove "this"Jonas Schievink-1/+1
2015-11-24Fix unreachable code in libsyntaxManish Goregaokar-2/+2
2015-11-23Print the macro context name on incomplete parseJonas Schievink-10/+10
Fixes #22425 Also fixes #30007, since it's just a change from `true` to `false`.
2015-11-17Fix match_ref_pats flagged by ClippySeo Sanghyeon-17/+17
2015-11-16Auto merge of #29828 - sanxiyn:check-macro, r=nrcbors-49/+63
Fix #27409.
2015-11-14Check macro definition and do not expand invalid macrosSeo Sanghyeon-3/+22
2015-11-14Reindent codeSeo Sanghyeon-22/+22
2015-11-14Store TokenTree in MacroRulesMacroExpanderSeo Sanghyeon-28/+23
2015-11-13Auto merge of #29761 - eefriedman:rename-nopanic, r=sanxiynbors-10/+10
Just `sed s/_nopanic//g`. Hopefully makes libsyntax a bit more readable.
2015-11-10Rename _nopanic methods to remove the suffix.Eli Friedman-10/+10
Just `sed s/_nopanic//g`. Hopefully makes libsyntax a bit more readable.
2015-11-10Use deref coercionsSeo Sanghyeon-1/+1
2015-11-06remove `Tt` prefix from TokenType variantsOliver Schneider-67/+72
[breaking change]
2015-10-27Don't panic for fatal errors in attribute parsing.Eli Friedman-1/+1
2015-10-27Delete unnecessary ParserAttr trait.Eli Friedman-1/+0
2015-10-27Don't use panicking helpers in Parser.Eli Friedman-9/+9
2015-10-08typos: fix a grabbag of typos all over the placeCristi Cobzarenco-2/+2
2015-09-24Cleanup interfaces of Name, SyntaxContext and IdentVadim Petrochenkov-14/+14
Make sure Name, SyntaxContext and Ident are passed by value Make sure Idents don't serve as keys (or parts of keys) in maps, Ident comparison is not well defined
2015-08-19Auto merge of #27849 - jonas-schievink:macro-errors, r=nikomatsakisbors-46/+50
And some small indentation/code style fixes in the macro parser.
2015-08-15Slightly improved macro diagnostics + Indentation fixesJonas Schievink-46/+50
2015-08-15Fix span of invalid metavariable repetitionJonas Schievink-1/+1
2015-08-10add and use Span.substitute_dummy methodTim Neumann-17/+6
2015-08-07improve span of erroneous empty macro invocationTim Neumann-22/+27
The ideas is to use the span of the complete macro invocation if the span of a macro error is `DUMMY_SP`. fixes #7970
2015-08-04Extend macro machinery to expand macros in typesJared Roesch-0/+6
Reapplied the changes from https://github.com/freebroccolo/rust/commit/7aafe24139abc2d1f302bbb166bcaa006f12cf4d to a clean branch of master
2015-07-28remove `get_ident` and `get_name`, make `as_str` soundOliver Schneider-24/+17
2015-07-24Make ICE an error and use a sensible error messageAndy Caldwell-2/+2
2015-07-13Auto merge of #27000 - alexcrichton:semi-after-type, r=cmrbors-1/+1
This commit expands the follow set of the `ty` and `path` macro fragments to include the semicolon token as well. A semicolon is already allowed after these tokens, so it's currently a little too restrictive to not have a semicolon allowed. For example: extern { fn foo() -> i32; // semicolon after type } fn main() { struct Foo; Foo; // semicolon after path }
2015-07-12syntax: Allow semi tokens after macro ty/pathAlex Crichton-1/+1
This commit expands the follow set of the `ty` and `path` macro fragments to include the semicolon token as well. A semicolon is already allowed after these tokens, so it's currently a little too restrictive to not have a semicolon allowed. For example: extern { fn foo() -> i32; // semicolon after type } fn main() { struct Foo; Foo; // semicolon after path }
2015-07-10Change some instances of .connect() to .join()Wesley Wiser-1/+1
2015-05-22Allow patterns to be followed by if and in.Steven Allen-0/+1
Needed to support: match X { pattern if Y ... } for pattern in Y {}
2015-05-15Permit token trees, identifiers, and blocks to be following byNiko Matsakis-34/+78
sequences. Fixes #25436.
2015-04-21syntax: remove #![feature(box_syntax, box_patterns)]Erick Tryzelaar-12/+12
2015-04-21Model lexer: Fix remaining issuesPiotr Czarnecki-2/+0
2015-04-14Negative case of `len()` -> `is_empty()`Tamir Duberstein-4/+4
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-1/+1
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-11Auto merge of #24155 - chris-chambers:stmt_macros, r=sfacklerbors-4/+18
Statement macros are now treated somewhat like item macros, in that a statement macro can now expand into a series of statements, rather than just a single statement. This allows statement macros to be nested inside other kinds of macros and expand properly, where previously the expansion would only work when no nesting was present. See: - `src/test/run-pass/macro-stmt_macro_in_expr_macro.rs` - `src/test/run-pass/macro-nested_stmt_macro.rs` This changes the interface of the MacResult trait. make_stmt has become make_stmts and now returns a vector, rather than a single item. Plugin writers who were implementing MacResult will have breakage, as well as anyone using MacEager::stmt. See: - `src/libsyntax/ext/base.rs` This also causes a minor difference in behavior to the diagnostics produced by certain malformed macros. See: - `src/test/compile-fail/macro-incomplete-parse.rs`
2015-04-07Improves handling of statement macros.Christopher Chambers-4/+18
Statement macros are now treated somewhat like item macros, in that a statement macro can now expand into a series of statements, rather than just a single statement. This allows statement macros to be nested inside other kinds of macros and expand properly, where previously the expansion would only work when no nesting was present. See: src/test/run-pass/macro-stmt_macro_in_expr_macro.rs src/test/run-pass/macro-nested_stmt_macro.rs This changes the interface of the MacResult trait. make_stmt has become make_stmts and now returns a vector, rather than a single item. Plugin writers who were implementing MacResult will have breakage, as well as anyone using MacEager::stmt. See: src/libsyntax/ext/base.rs This also causes a minor difference in behavior to the diagnostics produced by certain malformed macros. See: src/test/compile-fail/macro-incomplete-parse.rs
2015-04-06Provide context for macro expansions which result in unparsed tokens.Will Hipschman-0/+17
Issue #22425
2015-04-05Work towards a non-panicing parser (libsyntax)Phil Dawes-29/+29
- Functions in parser.rs return PResult<> rather than panicing - Other functions in libsyntax call panic! explicitly for now if they rely on panicing behaviour. - 'panictry!' macro added as scaffolding while converting panicing functions. (This does the same as 'unwrap()' but is easier to grep for and turn into try!()) - Leaves panicing wrappers for the following functions so that the quote_* macros behave the same: - parse_expr, parse_item, parse_pat, parse_arm, parse_ty, parse_stmt
2015-03-25Add trivial cast lints.Nick Cameron-1/+1
This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ```
2015-03-23Fallout in stdlib, rustdoc, rustc, etc. For most maps, converted uses ofNiko Matsakis-2/+2
`[]` on maps to `get` in rustc, since stage0 and stage1+ disagree about how to use `[]`.
2015-03-13syntax: use lookahead to distinguish inner and outer attributes, instead of ↵Eduard Burtescu-16/+10
passing the latter around.
2015-03-11syntax: move MethMac to MacImplItem and combine {Provided,Required}Method ↵Eduard Burtescu-6/+4
into MethodTraitItem.
2015-03-11syntax: gather common fields of impl & trait items into their respective types.Eduard Burtescu-1/+2
2015-03-11syntax: move indirection around {Trait,Impl}Item, from within.Eduard Burtescu-1/+1
2015-03-06Add #[allow_internal_unstable] to track stability for macros better.Huon Wilson-1/+1
Unstable items used in a macro expansion will now always trigger stability warnings, *unless* the unstable items are directly inside a macro marked with `#[allow_internal_unstable]`. IOW, the compiler warns unless the span of the unstable item is a subspan of the definition of a macro marked with that attribute. E.g. #[allow_internal_unstable] macro_rules! foo { ($e: expr) => {{ $e; unstable(); // no warning only_called_by_foo!(); }} } macro_rules! only_called_by_foo { () => { unstable() } // warning } foo!(unstable()) // warning The unstable inside `foo` is fine, due to the attribute. But the `unstable` inside `only_called_by_foo` is not, since that macro doesn't have the attribute, and the `unstable` passed into `foo` is also not fine since it isn't contained in the macro itself (that is, even though it is only used directly in the macro). In the process this makes the stability tracking much more precise, e.g. previously `println!("{}", unstable())` got no warning, but now it does. As such, this is a bug fix that may cause [breaking-change]s. The attribute is definitely feature gated, since it explicitly allows side-stepping the feature gating system.
2015-03-05Auto merge of #22061 - pczarn:quote_matcher_and_attr, r=kmcallisterbors-13/+9
Fixes #19674 Fixes #17396 (already closed, yeah) cc @kmcallister , @cmr
2015-03-04Add quasiquote for matchers and attributesPiotr Czarnecki-13/+9
2015-03-03Switched to Box::new in many places.Felix S. Klock II-3/+3
Many of the modifications putting in `Box::new` calls also include a pointer to Issue 22405, which tracks going back to `box <expr>` if possible in the future. (Still tried to use `Box<_>` where it sufficed; thus some tests still have `box_syntax` enabled, as they use a mix of `box` and `Box::new`.) Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
2015-02-25Always error on invalid macro fragment specifiersKeegan McAllister-4/+4
Fixes #21370. unused-macro-with-follow-violation.rs was already handled correctly. That test is just for good measure. :)