about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-08-20syntax: Optimize some literal parsingAlex Crichton-6/+4
Currently in the `wasm-bindgen` project we have a very very large crate that's procedurally generated, `web-sys`. To generate this crate we parse all of a browser's WebIDL and we then generate bindings for all of the APIs contained within. The resulting Rust file is 18MB large (wow!) and currently takes a very long time to compile in debug mode. On the nightly compiler a *debug* build takes 90s for the crate to finish. I was curious what was taking so long and upon investigating a *massive* portion of the time was spent in the `lit_token` method of the compiler, primarily formatting strings via `format!`. Upon some more investigation it looks like the `byte_str_lit` was allocating an error message once per byte, causing a very large number of allocations to happen for large literals, of which wasm-bindgen generates quite a few (some are MB large). This commit fixes the issue by lazily allocating the error message, only doing so if the error message is actually needed (which should be never). As a result, the debug mode compilation time for our `web-sys` crate decreased from 90s to 20s, a very nice improvement! (although we've still got some work to do).
2018-08-20Set applicability for more suggestions.Sébastien Duquette-2/+6
2018-08-19Switch out another use of `do catch`Scott McMurray-2/+10
2018-08-19Rename `catch_expr` feature to `try_blocks`Scott McMurray-2/+2
2018-08-19Suggest `try` if someone uses `do catch`Scott McMurray-0/+12
2018-08-19Parse try blocks with the try keyword instead of do catch placeholderScott McMurray-14/+14
2018-08-19Rename `Catch` variants to `TryBlock`Scott McMurray-11/+11
(Not `Try` since `QuestionMark` is using that.)
2018-08-19fix tidy errorsDonato Sciarra-10/+13
2018-08-19mv codemap source_mapDonato Sciarra-11/+11
2018-08-19mv codemap() source_map()Donato Sciarra-41/+41
2018-08-19mv (mod) codemap source_mapDonato Sciarra-47/+47
2018-08-19mv filemap source_fileDonato Sciarra-91/+91
2018-08-19mv FileMap SourceFileDonato Sciarra-40/+40
2018-08-19mv CodeMap SourceMapDonato Sciarra-72/+72
2018-08-19Stabilize macro_vis_matcherJakub Kozlowski-19/+3
2018-08-19Fix typos found by codespell.Matthias Krüger-9/+9
2018-08-19Auto merge of #51131 - qnighy:unsized-locals, r=eddybbors-0/+3
Implement Unsized Rvalues This PR is the first step to implement RFC1909: unsized rvalues (#48055). ## Implemented - `Sized` is removed for arguments and local bindings. (under `#![feature(unsized_locals)]`) - Unsized locations are allowed in MIR - Unsized places and operands are correctly translated at codegen ## Not implemented in this PR - Additional `Sized` checks: - tuple struct constructor (accidentally compiles now) - closure arguments at closure generation (accidentally compiles now) - upvars (ICEs now) - Generating vtable for `fn method(self)` (ICEs now) - VLAs: `[e; n]` where `n` isn't const - Reduce unnecessary allocations ## Current status - [x] Fix `__rust_probestack` (rust-lang-nursery/compiler-builtins#244) - [x] Get the fix merged - [x] `#![feature(unsized_locals)]` - [x] Give it a tracking issue number - [x] Lift sized checks in typeck and MIR-borrowck - [ ] <del>Forbid `A(unsized-expr)`</del> will be another PR - [x] Minimum working codegen - [x] Add more examples and fill in unimplemented codegen paths - [ ] <del>Loosen object-safety rules (will be another PR)</del> - [ ] <del>Implement `Box<FnOnce>` (will be another PR)</del> - [ ] <del>Reduce temporaries (will be another PR)</del>
2018-08-19Add #![feature(unsized_locals)].Masaki Hara-0/+3
2018-08-18Auto merge of #52592 - eddyb:or-default, r=Mark-Simulacrumbors-4/+3
Use the new Entry::or_default method where possible.
2018-08-18Auto merge of #53324 - alexreg:self_in_typedefs, r=eddybbors-15/+21
`Self` in type definitions (self_in_typedefs) This implements the [`self_in_typedefs` feature](https://github.com/rust-lang/rfcs/blob/master/text/2300-self-in-typedefs.md) ([tracking issue 49303](https://github.com/rust-lang/rust/issues/49303)). r? @eddyb CC @Centril
2018-08-18Added feature gate.Alexander Regueiro-15/+21
2018-08-18Use the new Entry::or_default method where possible.Eduard-Mihai Burtescu-4/+3
2018-08-17Auto merge of #50911 - petrochenkov:macuse, r=alexcrichtonbors-24/+6
Stabilize `use_extern_macros` Closes https://github.com/rust-lang/rust/issues/35896
2018-08-17Rollup merge of #53413 - eddyb:featured-in-the-latest-edition, r=varkorCorey Farwell-23/+56
Warn that `#![feature(rust_2018_preview)]` is implied when the edition is set to Rust 2018. cc @varkor @petrochenkov @joshtriplett
2018-08-17Stabilize `use_extern_macros`Vadim Petrochenkov-24/+6
2018-08-16Add some commentsvarkor-1/+1
2018-08-16Add feature gate and refactorvarkor-0/+3
2018-08-16Auto merge of #53433 - kennytm:rollup, r=kennytmbors-12/+43
Rollup of 10 pull requests Successful merges: - #52946 (Documented impl From on line 367 of libserialize/json.rs) - #53234 (Remove Travis shutdown debug scripts, and remove CI-specific DNS settings) - #53313 (Two small improvements) - #53360 (Addressed #51602) - #53364 (Warn if the user tries to use GATs) - #53373 (Tweak unclosed delimiter parser error) - #53377 (std: Use target_pointer_width for BACKTRACE_ELF_SIZE) - #53395 (Use #[non_exhaustive] on internal enums) - #53399 (Tidy: ignore non-Markdown files when linting for the Unstable Book) - #53412 (syntax_ext: remove leftover span_err_if_not_stage0 macro.)
2018-08-17Rollup merge of #53373 - estebank:unclosed, r=petrochenkovkennytm-11/+21
Tweak unclosed delimiter parser error
2018-08-17Rollup merge of #53364 - varkor:gat-warn-broken, r=pnkfelixkennytm-0/+15
Warn if the user tries to use GATs GATs are currently broken, but still accessible behind a feature gate. This leads to people attempting to use them and then immediately encountering ICEs (or other broken behaviour). Here, we emit a warning if the user tries to use any feature associated with GATs, hopefully making it obvious that ICEs and the like are expected. For the meantime, this seems better than continually getting reported errors (for example: [here](https://github.com/rust-lang/rust/issues?q=is%3Aissue+gat+is%3Aclosed) and [here](https://github.com/rust-lang/rust/issues?utf8=%E2%9C%93&q=is%3Aissue+generic_associated_types+is%3Aclosed)).
2018-08-17Rollup merge of #53360 - PramodBisht:issue/51602, r=estebankkennytm-1/+7
Addressed #51602 Fixed #51602 r? @estebank here I have addressed the case where `in` was not expected right after `if` block. Speaking of `type ascription` I am not sure if this the best approach which I have implemented. Plus I think one more test case can be added to test `type-ascription` case, though I don't have any at this point of time. I will ping you again if all existing testcases pass.
2018-08-16Auto merge of #53304 - dtolnay:extend, r=dtolnaybors-16/+265
TokenStream::extend Two new insta-stable impls in libproc_macro: ```rust impl Extend<TokenTree> for TokenStream impl Extend<TokenStream> for TokenStream ``` `proc_macro::TokenStream` already implements `FromIterator<TokenTree>` and `FromIterator<TokenStream>` so I elected to support the same input types for `Extend`. **This commit reduces compile time of Serde derives by 60% (takes less than half as long to compile)** as measured by building our test suite: ```console $ git clone https://github.com/serde-rs/serde $ cd serde/test_suite $ cargo check --tests --features proc-macro2/nightly $ rm -f ../target/debug/deps/libtest_*.rmeta $ time cargo check --tests --features proc-macro2/nightly Before: 20.8 seconds After: 8.6 seconds ``` r? @alexcrichton
2018-08-16syntax: also warn about edition "umbrella" features being implied by --edition.Eduard-Mihai Burtescu-13/+22
2018-08-16Auto merge of #53293 - petrochenkov:gramattr2, r=alexcrichtonbors-27/+53
syntax: Enforce attribute grammar in the parser Also fix feature-gating for `unrestricted_attribute_tokens` that was introduced in https://github.com/rust-lang/rust/pull/53270, but was actually broken. cc https://github.com/rust-lang/rust/pull/50911
2018-08-16Auto merge of #53289 - ljedrz:improve_lexer, r=michaelwoeristerbors-74/+134
A few cleanups and minor improvements for the lexer - improve readability by adjusting the formatting of some function signatures and adding some newlines - reorder some functions for easier reading - remove redundant `'static` in `const`s - remove some explicit `return`s - read directly to a `String` in `gather_comments_and_literals` - change `unwrap_or!` (macro) to `unwrap_or` (function) - move an `assert!`ion from `try_next_token` (called in a loop) to `try_real_token` after all calls to `try_next_token` - `#[inline]` some one-liner functions - assign directly from an `if-else` expression - refactor a `match` to `map_or` - add a `token::is_irrelevant` function to detect tokens that are not "`real`"
2018-08-16syntax: process all edition features before other features.Eduard-Mihai Burtescu-10/+34
2018-08-15Do not emit "incorrect close delimiter" twice in the same placeEsteban Küber-11/+19
2018-08-15Tweak unclosed delimiter parser errorEsteban Küber-2/+4
2018-08-15Warn when `generic_associated_types` feature gate is enabledvarkor-0/+15
2018-08-15syntax: Enforce attribute grammar in the parserVadim Petrochenkov-27/+53
2018-08-14Feature gate where clauses on associated type implsvarkor-4/+9
2018-08-14Adddressed #51602Pramod Bisht-1/+7
2018-08-14Auto merge of #53085 - ljedrz:cleanup_syntax_structures, r=ljedrzbors-268/+131
Move SmallVector and ThinVec out of libsyntax - move `libsyntax::util::SmallVector` tests to `librustc_data_structures::small_vec` - remove `libsyntax::util::SmallVector` - move `libsyntax::util::thin_vec` to `librustc_data_structures::thin_vec` Other than moving these data structures where they belong it allows modules using `SmallVector<T>` (`SmallVec<[T; 1]>`) to specify their own length (e.g. 8 or 32) independently from `libsyntax`.
2018-08-14rustc_resolve: fix special-case for one-segment import paths.Eduard-Mihai Burtescu-1/+1
2018-08-14syntax: gensym the injected std/core extern crates in the Rust 2018 edition.Eduard-Mihai Burtescu-7/+30
2018-08-13Address review of RcVecDavid Tolnay-10/+5
2018-08-14syntax: add `uniform_paths` feature-gate.Eduard-Mihai Burtescu-0/+3
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-268/+131
2018-08-13Auto merge of #53270 - petrochenkov:macuse-regr, r=alexcrichtonbors-21/+25
Fix a few regressions from enabling macro modularization The first commit restores the old behavior for some minor unstable stuff (`rustc_*` and `derive_*` attributes) and adds a new feature gate for arbitrary tokens in non-macro attributes. The second commit fixes https://github.com/rust-lang/rust/issues/53205 The third commit fixes https://github.com/rust-lang/rust/issues/53144. Same technique is used as for other things blocking expansion progress - if something causes indeterminacy too often, then prohibit it. In this case referring to crate-local macro-expanded `#[macro_export]` macros via module-relative paths is prohibited, see comments in code for more details. cc https://github.com/rust-lang/rust/pull/50911
2018-08-13A few cleanups and minor improvements for the lexerljedrz-74/+134