about summary refs log tree commit diff
path: root/src/libsyntax/ext/tt
AgeCommit message (Collapse)AuthorLines
2019-03-23syntax: Remove warning for unnecessary path disambiguatorsVadim Petrochenkov-1/+1
2019-03-16syntax: Do not accidentally treat multi-segment meta-items as single-segmentVadim Petrochenkov-3/+8
2019-03-06Panic when unmatched delimiters aren't emittedEsteban Küber-1/+1
2019-02-27Rollup merge of #58075 - asettouf:master, r=varkorMazdak Farrokhzad-6/+12
Fix for issue #58050 Hi, a quick PR to mention in the compiler error message that `?` is a macro operator, as according to issue #58050 It passed `python x.py test src/tools/tidy` locally, as well as the recommendation to run `/x.py test src/test/ui --stage 1 --bless`. Let me know if anything else is needed.
2019-02-26Changing error message to reflect changes with the 2018 editionAdonis-6/+12
Signed-off-by: Adonis <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr Co-Authored-By: asettouf <adonis.settouf@gmail.com> Stabilize split_ascii_whitespace Tracking issue FCP to merge: https://github.com/rust-lang/rust/issues/48656#issuecomment-442372750 fix stabilization order of uniform_paths. hir: add HirId to main Hir nodes Fix `std::os::fortanix_sgx::usercalls::raw::UsercallNrs` Fixes https://github.com/fortanix/rust-sgx/issues/88 Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Revert "Merge remote-tracking branch 'upstream/master'" This reverts commit 751f05bd155e2c55d4177fe8211df634faf3a644, reversing changes made to 545a3e62b0cb473108869a61b271bc589afb49da.
2019-02-18Avoid a `clone()` in `transcribe()`.Nicholas Nethercote-11/+11
The current code (expensively) clones the value within an `Rc`. This commit changes things so that the `Rc` itself is (cheaply) cloned instead, avoid some allocations. This requires converting a few `Rc` instances to `Lrc`.
2019-02-18Remove `LazyTokenStream`.Nicholas Nethercote-6/+7
It's present within `Token::Interpolated` as an optimization, so that if a nonterminal is converted to a `TokenStream` multiple times, the first-computed value is saved and reused. But in practice it's not needed. `interpolated_to_tokenstream()` is a cold function: it's only called a few dozen times while compiling rustc itself, and a few hundred times across the entire `rustc-perf` suite. Furthermore, when it is called, it is almost always the first conversion, so no benefit is gained from it. So this commit removes `LazyTokenStream`, along with the now-unnecessary `Token::interpolated()`. As well as a significant simplification, the removal speeds things up slightly, mostly due to not having to `drop` the `LazyTokenStream` instances.
2019-02-13Rollup merge of #58273 - taiki-e:rename-dependency, r=matthewjasperMazdak Farrokhzad-4/+4
Rename rustc_errors dependency in rust 2018 crates I think this is a better solution than `use rustc_errors as errors` in `lib.rs` and `use crate::errors` in modules. Related: rust-lang/cargo#5653 cc #58099 r? @Centril
2019-02-12Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnikbors-22/+22
Cosmetic improvements to doc comments This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-13Cleanup importsTaiki Endo-3/+3
2019-02-13Rename rustc_errors dependency in rust 2018 cratesTaiki Endo-3/+3
2019-02-11Use `Rc<[Symbol]>` instead of `Vec<Symbol>` to reduce # of allocsOliver Scherer-3/+3
2019-02-11Ease the transition to requiring features by just warning if there's no ↵Oliver Scherer-8/+14
feature list while we could make this change (it's all unstable after all), there are crates.io crates that use the feature and that the compiler depends upon. We can instead roll out this feature while still supporting the old way.
2019-02-11Require a list of features to allow in `allow_internal_unstable`Oliver Scherer-1/+12
2019-02-10rustc: doc commentsAlexander Regueiro-22/+22
2019-02-07Make it an incompatibility lint for nowMark Mansi-9/+22
2019-02-07error on duplicate matcher bindingsmark-5/+49
2019-02-07libsyntax => 2018Taiki Endo-63/+68
2019-02-06Overhaul `syntax::fold::Folder`.Nicholas Nethercote-2/+4
This commit changes `syntax::fold::Folder` from a functional style (where most methods take a `T` and produce a new `T`) to a more imperative style (where most methods take and modify a `&mut T`), and renames it `syntax::mut_visit::MutVisitor`. The first benefit is speed. The functional style does not require any reallocations, due to the use of `P::map` and `MoveMap::move_{,flat_}map`. However, every field in the AST must be overwritten; even those fields that are unchanged are overwritten with the same value. This causes a lot of unnecessary memory writes. The imperative style reduces instruction counts by 1--3% across a wide range of workloads, particularly incremental workloads. The second benefit is conciseness; the imperative style is usually more concise. E.g. compare the old functional style: ``` fn fold_abc(&mut self, abc: ABC) { ABC { a: fold_a(abc.a), b: fold_b(abc.b), c: abc.c, } } ``` with the imperative style: ``` fn visit_abc(&mut self, ABC { a, b, c: _ }: &mut ABC) { visit_a(a); visit_b(b); } ``` (The reductions get larger in more complex examples.) Overall, the patch removes over 200 lines of code -- even though the new code has more comments -- and a lot of the remaining lines have fewer characters. Some notes: - The old style used methods called `fold_*`. The new style mostly uses methods called `visit_*`, but there are a few methods that map a `T` to something other than a `T`, which are called `flat_map_*` (`T` maps to multiple `T`s) or `filter_map_*` (`T` maps to 0 or 1 `T`s). - `move_map.rs`/`MoveMap`/`move_map`/`move_flat_map` are renamed `map_in_place.rs`/`MapInPlace`/`map_in_place`/`flat_map_in_place` to reflect their slightly changed signatures. - Although this commit renames the `fold` module as `mut_visit`, it keeps it in the `fold.rs` file, so as not to confuse git. The next commit will rename the file.
2019-01-26remove `_with_applicability` from suggestion fnsAndy Russell-1/+1
2019-01-15fix nested matchers with ?mark-4/+10
2019-01-13Rollup merge of #57004 - nnethercote:TS-change-Stream, r=petrochenkovMazdak Farrokhzad-3/+3
Make `TokenStream` less recursive. `TokenStream` is currently recursive in *two* ways: - the `TokenTree` variant contains a `ThinTokenStream`, which can contain a `TokenStream`; - the `TokenStream` variant contains a `Vec<TokenStream>`. The latter is not necessary and causes significant complexity. This commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`. This reduces complexity significantly. In particular, `StreamCursor` is eliminated, and `Cursor` becomes much simpler, consisting now of just a `TokenStream` and an index. The commit also removes the `Extend` impl for `TokenStream`, because it is only used in tests. (The commit also removes those tests.) Overall, the commit reduces the number of lines of code by almost 200.
2019-01-09Change `String` to `&'static str` in `ParseResult::Failure`.Nicholas Nethercote-4/+4
This avoids 770,000 allocations when compiling the `html5ever` benchmark, reducing instruction counts by up to 2%.
2019-01-08Make `TokenStream` less recursive.Nicholas Nethercote-3/+3
`TokenStream` is currently recursive in *two* ways: - the `TokenTree` variant contains a `ThinTokenStream`, which can contain a `TokenStream`; - the `TokenStream` variant contains a `Vec<TokenStream>`. The latter is not necessary and causes significant complexity. This commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`. This reduces complexity significantly. In particular, `StreamCursor` is eliminated, and `Cursor` becomes much simpler, consisting now of just a `TokenStream` and an index. The commit also removes the `Extend` impl for `TokenStream`, because it is only used in tests. (The commit also removes those tests.) Overall, the commit reduces the number of lines of code by almost 200.
2019-01-03Fix repeated word typosWiktor Kuchta-1/+1
Found with `git grep -P '\b([a-z]+)\s+\1\b'`
2018-12-25Remove licensesMark Rousskov-40/+0
2018-12-12Rename `TokenStream::concat` and remove `TokenStream::concat_rc_vec`.Nicholas Nethercote-2/+2
`TokenStream::new` is a better name for the former, and the latter is now just equivalent to `TokenStream::Stream`.
2018-12-10Remove `tokenstream::Delimited`.Nicholas Nethercote-13/+14
Because it's an extra type layer that doesn't really help; in a couple of places it actively gets in the way, and overall removing it makes the code nicer. It does, however, move `tokenstream::TokenTree` further away from the `TokenTree` in `quote.rs`. More importantly, this change reduces the size of `TokenStream` from 48 bytes to 40 bytes on x86-64, which is enough to slightly reduce instruction counts on numerous benchmarks, the best by 1.5%. Note that `open_tt` and `close_tt` have gone from being methods on `Delimited` to associated methods of `TokenTree`.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-16/+16
2018-12-06Rollup merge of #56426 - petrochenkov:syntweak, r=nikomatsakisPietro Albini-1/+0
libsyntax_pos: A few tweaks
2018-12-04Remove redundant cloneShotaro Yamada-1/+1
2018-12-04syntax: Remove `#[non_exhaustive]` from `Edition`Vadim Petrochenkov-1/+0
`Edition` is not a public API, we want users to break when a new edition is added
2018-11-27remove some unused varsMark Mansi-6/+6
2018-11-27remove feature gateMark Mansi-39/+7
2018-11-27Auto merge of #55402 - estebank:macro-eof-2, r=nikomatsakisbors-14/+54
Point at end of macro arm when encountering EOF Fix #52866.
2018-11-23Reword EOF in macro arm messageEsteban Küber-1/+4
2018-11-23Keep label on moved spans and point at macro invocation on parse errorEsteban Küber-8/+12
2018-11-23Point at macro arm when it doesn't expand to an expressionEsteban Küber-3/+7
2018-11-23Reword incorrect macro invocation primary labelEsteban Küber-8/+20
2018-11-23Add label when replacing primary DUMMY_SP in macro expansionEsteban Küber-0/+1
2018-11-23Point at end of macro arm when encountering EOFEsteban Küber-2/+18
Fix #52866
2018-11-21macro_literal_matcher: fixes per petrochenkov's reviewDan Aloni-3/+3
2018-11-21Stabilize macro_literal_matcherDan Aloni-18/+13
2018-11-13Rollup merge of #55870 - waywardmonkeys:typo-fixes, r=wesleywiserkennytm-2/+2
Fix typos.
2018-11-12Make `MatcherPos::stack` a `SmallVec`.Niko Matsakis-34/+57
This avoids some allocations.
2018-11-11Fix typos.Bruce Mitchener-2/+2
2018-11-05Auto merge of #55451 - estebank:arg-doc, r=pnkfelixbors-1/+1
Custom diagnostic when trying to doc comment argument When writing ``` pub fn f( /// Comment id: u8, ) {} ``` Produce a targeted diagnostic ``` error: documentation comments cannot be applied to method arguments --> $DIR/fn-arg-doc-comment.rs:2:5 | LL | /// Comment | ^^^^^^^^^^^ doc comments are not allowed here ``` Fix #54801.
2018-11-01Use `SmallVec` for the inner vectors in `MatcherPos::matches`.Nicholas Nethercote-5/+7
This avoids some allocations.
2018-11-01Share empty `Vec`s more within `MatcherPos::matches`.Nicholas Nethercote-4/+9
`create_matches` creates a `Vec<Rc<Vec<NamedMatch>>>`. Even though all the inner `Vec`s are empty, each one is created separately. This commit changes `create_matches` so it instead creates one empty inner `Vec`, and shares it. The commit also changes `MatcherPos::matches` to a boxed slice, because its length doesn't change.
2018-10-28Provide specific label for patern parsing errorEsteban Küber-1/+1