about summary refs log tree commit diff
path: root/src/libsyntax/parse/mod.rs
AgeCommit message (Collapse)AuthorLines
2018-11-04Auto merge of #54861 - rep-nop:find_main_in_doctest, r=estebankbors-8/+42
rustdoc: Replaces fn main search and extern crate search with proper parsing during doctests. Fixes #21299. Fixes #33731. Let me know if there's any additional changes you'd like made!
2018-11-02implement existing parser fns in terms of fallible fnsQuietMisdreavus-14/+4
2018-11-01buffer errors from initial tokenization when parsingQuietMisdreavus-2/+46
2018-10-29Rename other occs of (Code/File)Map to Source(Map/File) #51574David Lavati-4/+4
2018-10-26Avoid unnecessary allocations in `float_lit` and `integer_lit`.Nicholas Nethercote-4/+19
This commit avoids an allocation when parsing any float and integer literals that don't involved underscores. This reduces the number of allocations done for the `tuple-stress` benchmark by 10%, reducing its instruction count by just under 1%.
2018-10-21Fix a few tests with target-specific outputVadim Petrochenkov-1/+1
Enable one fully ignored test
2018-09-08Track distinct spans for open and close delimiterDavid Tolnay-3/+3
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-4/+4
2018-08-21Rollup merge of #53521 - alexcrichton:optimize-lit-token, r=michaelwoeristerkennytm-6/+4
syntax: Optimize some literal parsing 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-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-19fix tidy errorsDonato Sciarra-2/+3
2018-08-19mv codemap source_mapDonato Sciarra-2/+2
2018-08-19mv codemap() source_map()Donato Sciarra-5/+5
2018-08-19mv (mod) codemap source_mapDonato Sciarra-1/+1
2018-08-19mv filemap source_fileDonato Sciarra-14/+14
2018-08-19mv FileMap SourceFileDonato Sciarra-4/+4
2018-08-19mv CodeMap SourceMapDonato Sciarra-5/+5
2018-07-23dump lints _after_ parsing macrosmark-3/+3
2018-07-23Extend ParseSess to support buffering lintsmark-2/+21
2018-07-14Remove some tests using AST comparisons, fix other testsVadim Petrochenkov-204/+26
2018-06-30Fortify dummy span checkingVadim Petrochenkov-3/+3
2018-06-23Auto merge of #51580 - cramertj:async-await, r=eddybbors-5/+8
async/await This PR implements `async`/`await` syntax for `async fn` in Rust 2015 and `async` closures and `async` blocks in Rust 2018 (tracking issue: https://github.com/rust-lang/rust/issues/50547). Limitations: non-`move` async closures with arguments are currently not supported, nor are `async fn` with multiple different input lifetimes. These limitations are not fundamental and will be removed in the future, however I'd like to go ahead and get this PR merged so we can start experimenting with this in combination with futures 0.3. Based on https://github.com/rust-lang/rust/pull/51414. cc @petrochenkov for parsing changes. r? @eddyb
2018-06-22Re-reexport some items that were recently made crate-private.Tim Kuehn-1/+1
2018-06-21Parse async fn header.Without Boats-5/+8
This is gated on edition 2018 & the `async_await` feature gate. The parser will accept `async fn` and `async unsafe fn` as fn items. Along the same lines as `const fn`, only `async unsafe fn` is permitted, not `unsafe async fn`.The parser will not accept `async` functions as trait methods. To do a little code clean up, four fields of the function type struct have been merged into the new `FnHeader` struct: constness, asyncness, unsafety, and ABI. Also, a small bug in HIR printing is fixed: it previously printed `const unsafe fn` as `unsafe const fn`, which is grammatically incorrect.
2018-06-09Crate-ify and delete unused code in syntax::parseMark Simulacrum-20/+37
2018-05-20lexer: Fix span override for the first token in a stringVadim Petrochenkov-2/+1
2018-05-18Make `Directory::path` a `Cow`.Nicholas Nethercote-2/+3
Because we create a lot of these in the macro parser, but only very rarely modify them. This speeds up some html5ever runs by 2--3%.
2018-05-09Optimize string handling in lit_token().Nicholas Nethercote-6/+17
In the common case, the string value in a string literal Token is the same as the string value in a string literal LitKind. (The exception is when escapes or \r are involved.) This patch takes advantage of that to avoid calling str_lit() and re-interning the string in that case. This speeds up incremental builds for a few of the rustc-benchmarks, the best by 3%.
2018-05-03Remove parse::escape_default().Nicholas Nethercote-6/+2
str::escape_default() can be used instead.
2018-04-26rustc_target: move in syntax::abi and flip dependency.Irina Popa-1/+1
2018-04-19Avoid allocating when parsing \u{...} literals.Nicholas Nethercote-2/+10
`char_lit` uses an allocation in order to ignore '_' chars in \u{...} literals. This patch changes it to not do that by processing the chars more directly. This improves various rustc-perf benchmark measurements by up to 6%, particularly regex, futures, clap, coercions, hyper, and encoding.
2018-04-10Auto merge of #49390 - Zoxc:sync-syntax, r=michaelwoeristerbors-9/+8
More thread-safety changes r? @michaelwoerister
2018-04-06Remove more duplicated spansVadim Petrochenkov-1/+1
2018-04-06Rename `ast::Variant_::name` into `ident` + Fix rebaseVadim Petrochenkov-7/+3
2018-03-28Make ParseSess thread-safeJohn Kåre Alsaker-9/+8
2018-03-27libsyntax: Remove obsolete.rsVadim Petrochenkov-1/+0
2018-03-23Merge branch 'master' of https://github.com/Lymia/rust into rollupAlex Crichton-9/+15
2018-03-22Rollup merge of #49117 - nivkner:fixme_fixup3, r=estebankkennytm-2/+0
address some FIXME whose associated issues were marked as closed part of #44366
2018-03-18Feature gate raw identifiers.Lymia Aluysia-0/+4
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-9/+11
2018-03-17Cleanup import parsingVadim Petrochenkov-1/+1
Fix spans of root segments
2018-03-17remove FIXME(#8372) since for-loops wont support borrowing iteratorsNiv Kaminer-2/+0
2018-03-14Remove syntax and syntax_pos thread localsJohn Kåre Alsaker-287/+322
2018-03-08Move REGISTERED_DIAGNOSTICS to a ParseSess fieldJohn Kåre Alsaker-1/+5
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-10/+10
2018-02-18Fix up tests and typosSeiichi Uchida-2/+2
2018-02-18Replace dummy spans with empty spansSeiichi Uchida-1/+1
2018-02-18Change ast::Visibility to Spanned typeSeiichi Uchida-1/+1
2018-01-26Do not capture stderr in the compiler. Instead just panic silently for fatal ↵John Kåre Alsaker-2/+2
errors
2018-01-04rustc: use {U,I}size instead of {U,I}s shorthands.Eduard-Mihai Burtescu-2/+2