about summary refs log tree commit diff
path: root/src/libsyntax_expand
AgeCommit message (Collapse)AuthorLines
2019-11-07move syntax::parse::lexer::comments -> syntax::util::commentsMazdak Farrokhzad-2/+2
2019-11-07move PResult to librustc_errorsMazdak Farrokhzad-4/+4
2019-11-07syntax::parser::token -> syntax::tokenMazdak Farrokhzad-13/+14
2019-11-07Rollup merge of #65974 - Centril:matcher-friendly-gating, r=petrochenkovMazdak Farrokhzad-2/+15
A scheme for more macro-matcher friendly pre-expansion gating Pre-expansion gating will now avoid gating macro matchers that did not result in `Success(...)`. That is, the following is now OK despite `box 42` being a valid `expr` and that form being pre-expansion gated: ```rust macro_rules! m { ($e:expr) => { 0 }; // This fails on the input below due to `, foo`. (box $e:expr, foo) => { 1 }; // Successful matcher, we should get `2`. } fn main() { assert_eq!(1, m!(box 42, foo)); } ``` Closes https://github.com/rust-lang/rust/issues/65846. r? @petrochenkov cc @Mark-Simulacrum
2019-11-07syntax: use distinct FloatTy from rustc_target.Mazdak Farrokhzad-1/+0
We also sever syntax's dependency on rustc_target as a result. This should slightly improve pipe-lining. Moreover, some cleanup is done in related code.
2019-11-06Make doc comments cheaper with `AttrKind`.Nicholas Nethercote-10/+12
`AttrKind` is a new type with two variants, `Normal` and `DocComment`. It's a big performance win (over 10% in some cases) because `DocComment` lets doc comments (which are common) be represented very cheaply. `Attribute` gets some new helper methods to ease the transition: - `has_name()`: check if the attribute name matches a single `Symbol`; for `DocComment` variants it succeeds if the symbol is `sym::doc`. - `is_doc_comment()`: check if it has a `DocComment` kind. - `{get,unwrap}_normal_item()`: extract the item from a `Normal` variant; panic otherwise. Fixes #60935.
2019-11-06Remove unnecessary `Deref` impl for `Attribute`.Nicholas Nethercote-6/+6
This kind of thing just makes the code harder to read.
2019-11-06rollback gating for failing macro matchersMazdak Farrokhzad-2/+15
2019-11-06legacy_directory_ownership -> errorMazdak Farrokhzad-1/+1
2019-11-06Rollup merge of #66139 - euclio:pluralize, r=nagisaMazdak Farrokhzad-3/+3
use American spelling for `pluralize!`
2019-11-06Rollup merge of #66086 - RalfJung:smallvec, r=nagisaMazdak Farrokhzad-1/+1
bump smallvec to 1.0 This includes https://github.com/servo/rust-smallvec/pull/162, fixing an unsoundness in smallvec. See https://github.com/servo/rust-smallvec/pull/175 for the 1.0 release announcement. Cc @mbrubeck @emilio
2019-11-06Rollup merge of #65973 - eddyb:caller-location-panic, r=petrochenkovMazdak Farrokhzad-12/+1
caller_location: point to macro invocation sites, like file!/line!, and use in core::panic!. The main change here is to `core::panic!`, trying to fix this remaining regression: https://github.com/rust-lang/rust/pull/65927#issuecomment-547625147 However, in order for `caller_location` to be usable from macros the same way `file!()`/`line!()` are, it needs to have the same behavior (of extracting the macro invocation site `Span` and using that). Arguably we would've had to do this at some point anyway, if we want to use `#[track_caller]` to replace the `file!()`/`line!()` uses from macros, but I'm not sure the RFC mentions this at all. r? @petrochenkov cc @anp @nnethercote
2019-11-06Rollup merge of #65776 - nnethercote:rename-LocalInternedString-and-more, ↵Mazdak Farrokhzad-1/+1
r=estebank Rename `LocalInternedString` and more This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses. r? @estebank
2019-11-06Rollup merge of #66054 - petrochenkov:delspan, r=estebankMazdak Farrokhzad-20/+10
syntax: Avoid span arithmetic for delimiter tokens The +/-1 logic is from the time where the whole group had a single span and the delimiter spans had to be calculated from it. Now the delimiters have their own spans which are constructed by lexer or proc macro API and can be used directly. If those spans are not perfect, then it should be fixed by tweaking the corresponding lexer logic rather than by trying to add or substract `1` from the span boundaries. Fixes https://github.com/rust-lang/rust/issues/62524 r? @estebank
2019-11-05use American spelling for `pluralize!`Andy Russell-3/+3
2019-11-05Review feedback: Remove more stuff! Simplify simplify simplify!Felix S. Klock II-4/+3
2019-11-04bump smallvec to 1.0Ralf Jung-1/+1
2019-11-04Auto merge of #66078 - petrochenkov:gateout, r=Centrilbors-16/+50
expand: Feature gate out-of-line modules in proc macro input Extracted from https://github.com/rust-lang/rust/pull/64273. We are currently gating attributes applied directly to `mod` items because there are unresolved questions about out-of-line modules and their behavior is very likely to change. However, you can sneak an out-of-line module into an attribute macro input using modules nested into other items like ```rust #[my_attr] fn m() { #[path = "zzz.rs"] mod n; // what tokens does the `my_attr` macro see? } ``` This PR prevents that and emits a feature gate error for this case as well. r? @Centril It would be great to land this before beta.
2019-11-04expand: Feature gate out-of-line modules in proc macro inputVadim Petrochenkov-16/+50
2019-11-03Migrate resolver over to internal lint bufferMark Rousskov-2/+2
2019-11-03syntax: Avoid span arithmetics for delimiter tokensVadim Petrochenkov-20/+10
2019-11-02Convert `x.as_str().to_string()` to `x.to_string()` where possible.Nicholas Nethercote-1/+1
2019-10-30caller_location: point to macro invocation sites, like file!/line!.Eduard-Mihai Burtescu-12/+1
2019-10-27rustc, rustc_passes: don't depend on syntax_expand.Mazdak Farrokhzad-95/+4
This is done by moving some data definitions to syntax::expand.
2019-10-27syntax/attr: reduce reliance on parserMazdak Farrokhzad-1/+8
2019-10-21Rollup merge of #65647 - nnethercote:rm-unnecessary-traits, r=CentrilMazdak Farrokhzad-1/+1
Remove unnecessary trait bounds and derivations This PR removes unnecessary trait bounds and derivations from many types. r? @nikomatsakis
2019-10-21Remove many unnecessary trait derivations.Nicholas Nethercote-1/+1
2019-10-19Avoid ICE when include! is used by stdin crateNika Layzell-5/+19
This should also eliminate the ICE when using `include_bytes!`, `include_str!` and `#[doc(include = "...")]`. Fixes #63900
2019-10-19Fix rebaseVadim Petrochenkov-1/+2
2019-10-19expand: Simplify expansion of derivesVadim Petrochenkov-23/+24
And make it more uniform with other macros. By merging placeholders for future derives' outputs into the derive container's output fragment early.
2019-10-16mbe: leave a FIXMEMazdak Farrokhzad-0/+3
2019-10-16move syntax::ext to new crate syntax_expandMazdak Farrokhzad-0/+8388