summary refs log tree commit diff
path: root/src/libsyntax/ext/expand.rs
AgeCommit message (Collapse)AuthorLines
2016-03-25do not overwrite spans as eagerlyNiko Matsakis-6/+36
this was required to preserve the span from the #[structural_match] attribute -- but honestly I am not 100% sure if it makes sense.
2016-03-14Add `default` as contextual keyword, and parse it for impl items.Aaron Turon-0/+1
2016-03-09Auto merge of #31631 - jonas-schievink:agoraphobia, r=nrcbors-3/+3
[breaking-batch] Move more uses of `panictry!` out of libsyntax
2016-03-02Fix the search paths for macro-expanded non-inline modulesJeffrey Seyfried-2/+45
2016-02-16Move more uses of `panictry!` out of libsyntaxJonas Schievink-3/+3
[breaking-change] for syntax extensions
2016-02-13Rename ast::Pat_ and its variantsVadim Petrochenkov-12/+12
2016-02-12Use more autoderef in libsyntaxJonas Schievink-1/+1
2016-02-11Remove some unnecessary indirection from AST structuresVadim Petrochenkov-44/+45
2016-02-11[breaking-change] don't glob export ast::TraitItemKind variantsOliver 'ker' Schneider-3/+3
2016-02-11[breaking-change] don't glob export ast::MetaItem_Oliver 'ker' Schneider-1/+1
2016-02-11[breaking-change] don't glob export ast::MacStmtStyleOliver 'ker' Schneider-1/+1
2016-02-11[breaking-change] don't glob export ast::Item_ variantsOliver 'ker' Schneider-12/+12
2016-02-11[breaking-change] don't pub export ast::Stmt_ variantsOliver Schneider-7/+6
2016-02-11[breaking-change] don't pub export ast::Ty_ variantsOliver Schneider-2/+2
2016-02-11[breaking-change] don't glob export ast::Expr_ variantsOliver Schneider-20/+20
2016-02-11[breaking-change] don't glob export ast::Decl_ variantsOliver Schneider-3/+3
2016-01-22The war on abort_if_errorsNick Cameron-1/+6
2015-12-30use structured errorsNick Cameron-5/+10
2015-12-18Rollup merge of #30384 - nrc:diagnostics, r=@nikomatsakisManish Goregaokar-1/+1
Should make it possible to add JSON or HTML errors. Also tidies up a lot.
2015-12-17Remove unused importsJeffrey Seyfried-1/+1
2015-12-17move error handling from libsyntax/diagnostics.rs to libsyntax/errors/*Nick Cameron-1/+1
Also split out emitters into their own module.
2015-12-15Fix expansion testsSeo Sanghyeon-4/+13
2015-12-15Move built-in syntax extensions to a separate crateSeo Sanghyeon-11/+7
2015-12-04Auto merge of #29850 - Kimundi:attributes_that_make_a_statement, r=pnkfelixbors-10/+28
See https://github.com/rust-lang/rfcs/pull/16 and https://github.com/rust-lang/rust/issues/15701 - Added syntax support for attributes on expressions and all syntax nodes in statement position. - Extended `#[cfg]` folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. - Extended lint checker to recognize lint levels on expressions and locals. - As per RFC, attributes are not yet accepted on `if` expressions. Examples: ```rust let x = y; { ... } assert_eq!((1, #[cfg(unset)] 2, 3), (1, 3)); let FOO = 0; ``` Implementation wise, there are a few rough corners and open questions: - The parser work ended up a bit ugly. - The pretty printer change was based mostly on guessing. - Similar to the `if` case, there are some places in the grammar where a new `Expr` node starts, but where it seemed weird to accept attributes and hence the parser doesn't. This includes: - const expressions in patterns - in the middle of an postfix operator chain (that is, after `.`, before indexing, before calls) - on range expressions, since `#[attr] x .. y` parses as `(#[attr] x) .. y`, which is inconsistent with `#[attr] .. y` which would parse as `#[attr] (.. y)` - Attributes are added as additional `Option<Box<Vec<Attribute>>>` fields in expressions and locals. - Memory impact has not been measured yet. - A cfg-away trailing expression in a block does not currently promote the previous `StmtExpr` in a block to a new trailing expr. That is to say, this won't work: ```rust let x = { #[cfg(foo)] Foo { data: x } #[cfg(not(foo))] Foo { data: y } }; ``` - One-element tuples can have their inner expression removed to become Unit, but just Parenthesis can't. Eg, `(#[cfg(unset)] x,) == ()` but `(#[cfg(unset)] x) == error`. This seemed reasonable to me since tuples and unit are type constructors, but could probably be argued either way. - Attributes on macro nodes are currently unconditionally dropped during macro expansion, which seemed fine since macro disappear at that point? - Attributes on `ast::ExprParens` will be prepend-ed to the inner expression in the hir folder. - The work on pretty printer tests for this did trigger, but not fix errors regarding macros: - expression `foo![]` prints as `foo!()` - expression `foo!{}` prints as `foo!()` - statement `foo![];` prints as `foo!();` - statement `foo!{};` prints as `foo!();` - statement `foo!{}` triggers a `None` unwrap ICE.
2015-11-30Improved comments around dropped attributes in the macro expanderMarvin Löbel-2/+2
2015-11-26Added stmt_expr_attribute feature gateMarvin Löbel-3/+3
2015-11-26Some TLC for the MoveMap traitMarvin Löbel-0/+1
2015-11-26Fixed macro expander not folding attributes (though I'm not sure if that is ↵Marvin Löbel-15/+13
actually neccessary)
2015-11-26Add syntax support for attributes on expressions and all syntaxMarvin Löbel-9/+28
nodes in statement position. Extended #[cfg] folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. Extended lint checker to recognize lint levels on expressions and locals.
2015-11-26Add suggestion of similar macro names to `macro undefined` error messageFlorian Hartwig-0/+1
2015-11-22Look up macro names as well when suggesting replacements for function ↵Manish Goregaokar-15/+19
resolve errors fixes #5780
2015-11-16rename `ast::ImplItem_::*ImplItem` to `ast::ImplItemKind::*`Oliver Schneider-5/+5
2015-11-10Use deref coercionsSeo Sanghyeon-6/+6
2015-11-05remove excess string allocationSteve Klabnik-3/+1
&format!("...") is the same as "" if we're not doing any interpolation, and doesn't allocate an intermediate String.
2015-10-09hygiene for `for` loops, `if let`, `while let`Nick Cameron-15/+72
and some unrelated test cleanups
2015-10-09Fix stabilityNick Cameron-1/+1
2015-10-09Move placement in desugaring to loweringNick Cameron-154/+3
2015-10-09if let and while letNick Cameron-140/+4
2015-10-09Move `for` loop desugaring to loweringNick Cameron-94/+2
2015-10-01Stop re-exporting AttrStyle's variants and rename them.Ms2ger-1/+1
2015-09-26Auto merge of #28642 - petrochenkov:name3, r=nrcbors-22/+16
This PR removes random remaining `Ident`s outside of libsyntax and performs general cleanup In particular, interfaces of `Name` and `Ident` are tidied up, `Name`s and `Ident`s being small `Copy` aggregates are always passed to functions by value, and `Ident`s are never used as keys in maps, because `Ident` comparisons are tricky. Although this PR closes https://github.com/rust-lang/rust/issues/6993 there's still work related to it: - `Name` can be made `NonZero` to compress numerous `Option<Name>`s and `Option<Ident>`s but it requires const unsafe functions. - Implementation of `PartialEq` on `Ident` should be eliminated and replaced with explicit hygienic, non-hygienic or member-wise comparisons. - Finally, large parts of AST can potentially be converted to `Name`s in the same way as HIR to clearly separate identifiers used in hygienic and non-hygienic contexts. r? @nrc
2015-09-24Cleanup interfaces of Name, SyntaxContext and IdentVadim Petrochenkov-22/+16
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-09-24Remove the deprecated box(PLACE) syntax.Eduard Burtescu-2/+2
2015-09-20Replace `ast::Mac_` enum with structAndrew Paseltiner-88/+75
Closes #28527.
2015-09-20Move tts instead of cloning in expansionManish Goregaokar-24/+25
2015-09-08Allow tracking issues for lang features.Huon Wilson-1/+3
This is similar to the libs version, which allow an `issue` field in the `#[unstable]` attribute. cc #28244
2015-09-01Auto merge of #28137 - nrc:remove-non-multi, r=huonwbors-83/+2
This is a [breaking-change] for syntax extension authors. The fix is to use MultiModifier or MultiDecorator, which have the same functionality but are more flexible. Users of syntax extensions are unaffected.
2015-09-01Remove the Modifier and Decorator kinds of syntax extensions.Nick Cameron-83/+2
This is a [breaking-change] for syntax extension authors. The fix is to use MultiModifier or MultiDecorator, which have the same functionality but are more flexible. Users of syntax extensions are unaffected.
2015-08-31Closures are not generated code.Nick Cameron-4/+1
2015-08-28Move ExpnInfo to NameManish Goregaokar-15/+15