about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2019-01-14Avoid some `TokenTree`-to-`TokenStream` conversions.Nicholas Nethercote-7/+6
This avoids some allocations.
2019-01-14Remove `ThinTokenStream`.Nicholas Nethercote-70/+21
`TokenStream` is now almost identical to `ThinTokenStream`. This commit removes the latter, replacing it with the former.
2019-01-14Remove `TokenStream::Tree` variant.Nicholas Nethercote-40/+5
`TokenStream::Stream` can represent a token stream containing any number of token trees. `TokenStream::Tree` is the special case representing a single token tree. The latter doesn't occur all that often dynamically, so this commit removes it, which simplifies the code quite a bit. This change has mixed performance effects. - The size of `TokenStream` drops from 32 bytes to 8 bytes, and there is one less case for all the match statements. - The conversion of a `TokenTree` to a `TokenStream` now requires two allocations, for the creation of a single element Lrc<Vec<_>>. (But a subsequent commit in this PR will reduce the main source of such conversions.)
2019-01-13Cosmetic improvementsAlexander Regueiro-1/+1
2019-01-13Rollup merge of #57004 - nnethercote:TS-change-Stream, r=petrochenkovMazdak Farrokhzad-335/+141
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-13remove extern_in_paths.Mazdak Farrokhzad-34/+8
2019-01-13Address review commentsVadim Petrochenkov-4/+11
2019-01-13Implement basic input validation for built-in attributesVadim Petrochenkov-179/+274
2019-01-13Rollup merge of #57564 - varkor:update-const_fn-tracking-issue, r=CentrilMazdak Farrokhzad-1/+1
Update the const fn tracking issue to the new metabug The new `const fn` tracking issue is #57563. We don't want to point to a closed issue in the diagnostics (or FIXMEs), so these have been updated (from the old issue, #24111). r? @Centril
2019-01-13Rollup merge of #57461 - nnethercote:ParseResult-Failure-static-str, ↵Mazdak Farrokhzad-4/+4
r=simulacrum Change `String` to `&'static str` in `ParseResult::Failure`. This avoids 770,000 allocations when compiling the `html5ever` benchmark, reducing instruction counts by up to 2%.
2019-01-12Suggest correct location for lifetime parameters in useEsteban Küber-9/+43
2019-01-13Update the const fn tracking issue to the new metabugvarkor-1/+1
2019-01-12Auto merge of #56759 - petrochenkov:prestabuni, r=nikomatsakisbors-3/+2
Stabilize `uniform_paths` Address all the things described in https://github.com/rust-lang/rust/issues/56417. Assign visibilities to `macro_rules` items - `pub` to `macro_export`-ed macros and `pub(crate)` to non-exported macros, these visibilities determine how far these macros can be reexported with `use`. Prohibit use of reexported inert attributes and "tool modules", after renaming (e.g. `use inline as imported_inline`) their respective tools and even compiler passes won't be able to recognize and properly check them. Also turn use of uniform paths in 2015 macros into an error, I'd prefer to neither remove nor stabilize them right away because I still want to make some experiments in this area (uniform path fallback was added to 2015 macros used on 2018 edition in https://github.com/rust-lang/rust/pull/56053#issuecomment-441405140). UPDATE: The last commit also stabilizes the feature `uniform_paths`. Closes https://github.com/rust-lang/rust/issues/53130 Closes https://github.com/rust-lang/rust/issues/55618 Closes https://github.com/rust-lang/rust/issues/56326 Closes https://github.com/rust-lang/rust/issues/56398 Closes https://github.com/rust-lang/rust/issues/56417 Closes https://github.com/rust-lang/rust/issues/56821 Closes https://github.com/rust-lang/rust/issues/57252 Closes https://github.com/rust-lang/rust/issues/57422
2019-01-12Stabilize `uniform_paths`Vadim Petrochenkov-3/+2
2019-01-12Auto merge of #57542 - Centril:rollup, r=Centrilbors-6/+6
Rollup of 26 pull requests Successful merges: - #56425 (Redo the docs for Vec::set_len) - #56906 (Issue #56905) - #57042 (Don't call `FieldPlacement::count` when count is too large) - #57175 (Stabilize `let` bindings and destructuring in constants and const fn) - #57192 (Change std::error::Error trait documentation to talk about `source` instead of `cause`) - #57296 (Fixed the link to the ? operator) - #57368 (Use CMAKE_{C,CXX}_COMPILER_LAUNCHER for ccache) - #57400 (Rustdoc: update Source Serif Pro and replace Heuristica italic) - #57417 (rustdoc: use text-based doctest parsing if a macro is wrapping main) - #57433 (Add link destination for `read-ownership`) - #57434 (Remove `CrateNum::Invalid`.) - #57441 (Supporting backtrace for x86_64-fortanix-unknown-sgx.) - #57450 (actually take a slice in this example) - #57459 (Reference tracking issue for inherent associated types in diagnostic) - #57463 (docs: Fix some 'second-edition' links) - #57466 (Remove outdated comment) - #57493 (use structured suggestion when casting a reference) - #57498 (make note of one more normalization that Paths do) - #57499 (note that FromStr does not work for borrowed types) - #57505 (Remove submodule step from README) - #57510 (Add a profiles section to the manifest) - #57511 (Fix undefined behavior) - #57519 (Correct RELEASES.md for 1.32.0) - #57522 (don't unwrap unexpected tokens in `format!`) - #57530 (Fixing a typographical error.) - #57535 (Stabilise irrefutable if-let and while-let patterns) Failed merges: r? @ghost
2019-01-12Rollup merge of #57535 - varkor:stabilise-if-while-let-patterns, r=CentrilMazdak Farrokhzad-3/+2
Stabilise irrefutable if-let and while-let patterns This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495). This replaces https://github.com/rust-lang/rust/pull/55639, as we want to stabilise this in time for the beta cut-off. Closes https://github.com/rust-lang/rust/pull/55639. r? @Centril
2019-01-12move const_let accepted gate to avoid future conflict.Mazdak Farrokhzad-2/+2
2019-01-11Add label for invalid literal suffixEsteban Küber-0/+2
2019-01-11Tweak incorrect discriminator value variant errorEsteban Küber-7/+13
2019-01-11Small tweaks to parser errorsEsteban Küber-7/+20
2019-01-11Tweak type argument after assoc type errorEsteban Küber-2/+9
2019-01-11Continue evaluating after finding incorrect .. in patternEsteban Küber-3/+10
2019-01-11Continue evaluating after incorrect float literalEsteban Küber-1/+5
2019-01-11Continue evaluating after type argument in where clauseEsteban Küber-2/+6
2019-01-11Continue evaluating after missing `for` in `impl Trait for Foo`Esteban Küber-1/+7
2019-01-11Continue evaluating after parsing incorrect binary literalEsteban Küber-1/+1
2019-01-11Continue parsing after lifetime in incorrect locationEsteban Küber-2/+6
2019-01-11Continue parser after trailing type argument attributeEsteban Küber-2/+6
2019-01-12Stabilise irrefutable if-let and while-let patternsvarkor-3/+2
This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495). Co-Authored-By: Sebastian Malton <sebastian@malton.name>
2019-01-11stabilize top level or-pats in if/while let.Mazdak Farrokhzad-11/+5
2019-01-09Clarify const_let commentOliver Scherer-1/+3
2019-01-09Stabilize `let` bindings and destructuring in constants and const fnOliver Scherer-3/+2
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-08improve non_snake_case diagnosticsAndy Russell-5/+7
Use a structured suggestion and tighten the span to just the identifier.
2019-01-08Make `TokenStream` less recursive.Nicholas Nethercote-335/+141
`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-08remove unwanted stage0 line, fix styledylan_DPC-1/+1
2019-01-08remove unused imports and feature gate from testsdylan_DPC-3/+0
2019-01-08stabilise cfg_attrdylan_DPC-23/+4
2019-01-06tests: Do not use `-Z parse-only`, continue compilation to test recoveryVadim Petrochenkov-1/+0
2019-01-05Rollup merge of #57314 - wiktorkuchta:master, r=Centrilkennytm-1/+1
Fix repeated word typos Inspired by #57295 (I skipped 'be be' because of it) and my [PR in another repo ](https://github.com/e-maxx-eng/e-maxx-eng/pull/389) Not a stupid `sed`, I actually tried to fix case by case.
2019-01-05Auto merge of #56145 - weiznich:re_rebalance_coherence, r=nikomatsakisbors-0/+3
Implement the Re-rebalance coherence RFC This is the first time I touch anything in the compiler so just tell me if I got something wrong. Big thanks to @sgrif for the pointers where to look for those things. cc #55437
2019-01-04Auto merge of #56897 - euclio:parse-fatal, r=estebankbors-2/+0
make `panictry!` private to libsyntax This commit completely removes usage of the `panictry!` macro from outside libsyntax. The macro causes parse errors to be fatal, so using it in libsyntax_ext caused parse failures *within* a syntax extension to be fatal, which is probably not intended. Furthermore, this commit adds spans to diagnostics emitted by empty extensions if they were missing, à la #56491.
2019-01-03Implement the re-rebalance coherence rfcGeorg Semmler-0/+3
2019-01-03Fix repeated word typosWiktor Kuchta-1/+1
Found with `git grep -P '\b([a-z]+)\s+\1\b'`
2019-01-02make `panictry!` private to libsyntaxAndy Russell-2/+0
This commit completely removes usage of the `panictry!` macro from outside libsyntax. The macro causes parse errors to be fatal, so using it in libsyntax_ext caused parse failures *within* a syntax extension to be fatal, which is probably not intended. Furthermore, this commit adds spans to diagnostics emitted by empty extensions if they were missing, à la #56491.
2019-01-02Auto merge of #57251 - petrochenkov:reregr, r=varkorbors-1/+2
syntax: Fix regression in diagnostics for patterns in trait method parameters Fixes https://github.com/rust-lang/rust/issues/55036
2019-01-01Auto merge of #57209 - estebank:suggest-raw-ident, r=petrochenkovbors-0/+12
Suggest using raw identifiers in 2018 edition when using keywords
2019-01-01syntax: Fix regression in diagnostics for patterns in trait method parametersVadim Petrochenkov-1/+2
2018-12-31Do not use unicode character in diagnostic helpEsteban Küber-1/+1
2018-12-31Use structured suggestion for braceless unicode escape squenceEsteban Küber-6/+30