summary refs log tree commit diff
path: root/src/libsyntax_expand
AgeCommit message (Collapse)AuthorLines
2020-01-17Change `next_point` when `shrink_to_hi` is more appropriateEsteban Küber-1/+1
(cherry picked from commit b93ef68245807bac97cd17ea9eaa13169380d815)
2019-12-13Address review commentsOliver Scherer-1/+1
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-1/+5
functions with a `const` modifier
2019-12-12Remove the `DelimSpan` from `NamedMatch::MatchedSeq`.Nicholas Nethercote-20/+11
Because it's unused. This then allows the removal of `MatcherPos::sp_open`. It's a tiny perf win, reducing instruction counts by 0.1% - 0.2% on a few benchmarks.
2019-12-07Make `ForeignItem` an alias of `Item`.Mazdak Farrokhzad-0/+1
2019-12-06parse_meta: ditch parse_in_attrMazdak Farrokhzad-5/+5
2019-12-06derive: avoid parse_in_attrMazdak Farrokhzad-25/+62
2019-12-03Remove dead cfg methodMark Rousskov-1/+0
2019-12-03Move early lint declarations to librustc_sessionMark Rousskov-2/+2
2019-12-02syntax: Use `ast::MacArgs` for macro definitionsVadim Petrochenkov-6/+6
2019-12-02syntax: Use `ast::MacArgs` for attributesVadim Petrochenkov-23/+9
2019-12-02syntax: Remove redundant span from `ast::Mac`Vadim Petrochenkov-4/+3
Also remove a couple of redundant `visit_mac` asserts
2019-12-02syntax: Introduce a struct `MacArgs` for macro argumentsVadim Petrochenkov-11/+2
2019-11-30move GateIssue to rustc_feature & simplify emit_feature_errMazdak Farrokhzad-13/+15
2019-11-30move is_builtin_attr to syntax::attrMazdak Farrokhzad-2/+2
2019-11-30introduce crate rustc_feature and move active, accepted, and removed to itMazdak Farrokhzad-3/+5
2019-11-27Rollup merge of #66798 - bwignall:typo, r=varkorTyler Mandry-1/+1
Fix spelling typos Should be non-semantic. Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos.
2019-11-26Fix spelling typosBrian Wignall-1/+1
2019-11-26Rollup merge of #66754 - estebank:rustdoc-capitalization, r=Dylan-DPCTyler Mandry-1/+2
Various tweaks to diagnostic output
2019-11-25Tweak duplicate matcher binding errorEsteban Küber-1/+2
2019-11-25Auto merge of #66669 - petrochenkov:tup2attr, r=matthewjasperbors-4/+23
Fix some issues with attributes on unnamed fields Fixes https://github.com/rust-lang/rust/issues/66487 Fixes https://github.com/rust-lang/rust/issues/66555
2019-11-25Auto merge of #66671 - matthewjasper:ast-address-of, r=Centrilbors-1/+1
Ast address-of This is the parts of #64588 that don't affect MIR. If an address-of expression makes it to MIR lowering we error and lower to the best currently expressible approximation to limit further errors. r? @Centril
2019-11-24Add raw address of expressions to the AST and HIRMatthew Jasper-1/+1
2019-11-24rustc_plugin: Remove support for syntactic pluginsVadim Petrochenkov-2/+0
2019-11-24expand: Fully preserve visibilities on unnamed fields with attributesVadim Petrochenkov-4/+23
2019-11-22Rollup merge of #66183 - Centril:empty-vis-trait-decl, r=petrochenkovMazdak Farrokhzad-4/+7
*Syntactically* permit visibilities on trait items & enum variants Fixes #65041 Suppose we have `$vis trait_item` or `$vis enum_variant` and `$vis` is a `:vis` macro fragment. Before this PR, this would fail to parse. This is now instead allowed as per language team consensus in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286. (See added tests for elaboration.) Moreover, we now also permit visibility modifiers on trait items & enum variants *syntactically* but reject them with semantic checks (in `ast_validation`): ```rust #[cfg(FALSE)] trait Foo { pub fn bar(); } // OK #[cfg(FALSE)] enum E { pub U } // OK ```
2019-11-20Delete ProcessCfgModMark Rousskov-8/+3
The previous commit removes the use of this, and now we cleanup.
2019-11-19Move syntax_expand::config to rustc_parse::configMark Rousskov-367/+2
2019-11-16expand: Stop marking derive helper attributes as knownVadim Petrochenkov-34/+5
Pass them through name resolution instead
2019-11-11syntactically allow visibility on trait item & enum variantMazdak Farrokhzad-4/+7
2019-11-10move syntax::parse -> librustc_parseMazdak Farrokhzad-34/+34
also move MACRO_ARGUMENTS -> librustc_parse
2019-11-10move config.rs to libsyntax_expandMazdak Farrokhzad-2/+2445
2019-11-09move attr meta grammar to parse::validate_atr + ast_validationMazdak Farrokhzad-1/+3
2019-11-08Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obkMazdak Farrokhzad-1/+1
Transition future compat lints to {ERROR, DENY} - Take 2 Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992. - `legacy_ctor_visibility` (ERROR) -- closes #39207 - `legacy_directory_ownership` (ERROR) -- closes #37872 - `safe_extern_static` (ERROR) -- closes #36247 - `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238 - `duplicate_macro_exports` (ERROR) - `nested_impl_trait` (ERROR) -- closes #59014 - `ill_formed_attribute_input` (DENY) -- transitions #57571 - `patterns_in_fns_without_body` (DENY) -- transitions #35203 r? @varkor cc @petrochenkov
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