about summary refs log tree commit diff
path: root/src/libsyntax/parse/mod.rs
AgeCommit message (Collapse)AuthorLines
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
2017-12-22Auto merge of #46732 - estebank:silence-recovered-blocks, r=petrochenkovbors-0/+1
Do not emit type errors on recovered blocks When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user. Fix #44579.
2017-12-21Do not emit type errors on recovered blocksEsteban Küber-0/+1
When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user.
2017-12-21Add GenericParam, refactor Generics in ast, hir, rustdocJonas Platte-3/+2
The Generics now contain one Vec of an enum for the generic parameters, rather than two separate Vec's for lifetime and type parameters. Additionally, places that previously used Vec<LifetimeDef> now use Vec<GenericParam> instead.
2017-12-19Implement non-mod.rs mod statementsTaylor Cramer-1/+8
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-12/+12
2017-09-12Auto merge of #43716 - MaloJaffre:_-in-literals, r=petrochenkovbors-7/+18
Accept underscores in unicode escapes Fixes #43692. I don't know if this need an RFC, but at least the impl is here!
2017-08-30Make fields of `Span` privateVadim Petrochenkov-3/+3
2017-08-17Accept underscores in unicode escapesMalo Jaffré-7/+18
Fixes #43692.
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-1/+1
Like #43008 (f668999), but _much more aggressive_.
2017-08-11Fix some typosBastien Orivel-1/+1
2017-07-30default binding modes: add pat_binding_modesTobias Schottdorf-7/+8
This PR kicks off the implementation of the [default binding modes RFC][1] by introducing the `pat_binding_modes` typeck table mentioned in the [mentoring instructions][2]. `pat_binding_modes` is populated in `librustc_typeck/check/_match.rs` and used wherever the HIR would be scraped prior to this PR. Unfortunately, one blemish, namely a two callers to `contains_explicit_ref_binding`, remains. This will likely have to be removed when the second part of [1], the `pat_adjustments` table, is tackled. Appropriate comments have been added. See #42640. [1]: https://github.com/rust-lang/rfcs/pull/2005 [2]: https://github.com/rust-lang/rust/issues/42640#issuecomment-313535089
2017-07-29Rollup merge of #43501 - topecongiro:span-to-whereclause, r=nrcMark Simulacrum-0/+1
Add Span to ast::WhereClause This PR adds `Span` field to `ast::WhereClause`. The motivation here is to make rustfmt's life easier when recovering comments before and after where clause. r? @nrc
2017-07-28syntax: Capture a `TokenStream` when parsing itemsAlex Crichton-1/+8
This is then later used by `proc_macro` to generate a new `proc_macro::TokenTree` which preserves span information. Unfortunately this isn't a bullet-proof approach as it doesn't handle the case when there's still other attributes on the item, especially inner attributes. Despite this the intention here is to solve the primary use case for procedural attributes, attached to functions as outer attributes, likely bare. In this situation we should be able to now yield a lossless stream of tokens to preserve span information.
2017-07-29Add Span to ast::WhereClausetopecongiro-0/+1
2017-06-26Update and fix a few testsAlex Crichton-1/+1
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-5/+8
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-05-18Add an option to the parser to avoid parsing out of line modulesNick Cameron-2/+23
This is useful if parsing from stdin or a String and don't want to try and read in a module from another file. Instead we just leave a stub in the AST.
2017-05-15adressed comments by @kennytm and @petrochenkovAndre Bogus-1/+0
2017-05-12Fix some clippy warnings in libsyntaxAndre Bogus-78/+68
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-05-07fix the easy features in libsyntaxubsan-2/+6
2017-04-26Implement a file-path remapping feature in support of debuginfo and ↵Michael Woerister-8/+8
reproducible builds.
2017-03-30Improve `Path` spans.Jeffrey Seyfried-3/+1
2017-03-29Refactor how spans are combined in the parser.Jeffrey Seyfried-3/+3
2017-03-19Auto merge of #40346 - jseyfried:path_and_tokenstream_attr, r=nrcbors-40/+91
`TokenStream`-based attributes, paths in attribute and derive macro invocations This PR - refactors `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`. - supports macro invocation paths for attribute procedural macros. - e.g. `#[::foo::attr_macro] struct S;`, `#[cfg_attr(all(), foo::attr_macro)] struct S;` - supports macro invocation paths for derive procedural macros. - e.g. `#[derive(foo::Bar, super::Baz)] struct S;` - supports arbitrary tokens as arguments to attribute procedural macros. - e.g. `#[foo::attr_macro arbitrary + tokens] struct S;` - supports using arbitrary tokens in "inert attributes" with derive procedural macros. - e.g. `#[derive(Foo)] struct S(#[inert arbitrary + tokens] i32);` where `#[proc_macro_derive(Foo, attributes(inert))]` r? @nrc
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-40/+91
2017-03-10Give spans to individual path segments in ASTVadim Petrochenkov-7/+11
2017-03-03Fix fallout in unit tests.Jeffrey Seyfried-29/+29
2017-03-03Integrate `TokenStream`.Jeffrey Seyfried-17/+12
2017-03-03Remove lifetime parameter from `syntax::tokenstream::Cursor`.Jeffrey Seyfried-1/+1
2017-02-28Add warning cycle.Jeffrey Seyfried-0/+2
2017-02-28Add `syntax::ext::tt::quoted::{TokenTree, ..}` and remove ↵Jeffrey Seyfried-7/+3
`tokenstream::TokenTree::Sequence`.
2017-02-03Bump version, upgrade bootstrapAlex Crichton-2/+0
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2017-01-23Remove `open_span` and `close_span` from `Delimited`.Jeffrey Seyfried-4/+0
2017-01-22Refactor `TokenStream`.Jeffrey Seyfried-1/+1
2017-01-20Rollup merge of #39118 - jseyfried:token_tree_based_parser, r=nrcAlex Crichton-10/+6
Refactor the parser to consume token trees This is groundwork for efficiently parsing attribute proc macro invocations, bang macro invocations, and `TokenStream`-based attributes and fragment matchers. This improves parsing performance by 8-15% and expansion performance by 0-5% on a sampling of the compiler's crates. r? @nrc
2017-01-17Refactor the parser to consume token trees.Jeffrey Seyfried-3/+2
2017-01-17Introduce `string_reader.parse_all_token_trees()`.Jeffrey Seyfried-7/+4
2017-01-17Give the `StringReader` a `sess: &ParseSess`.Jeffrey Seyfried-1/+1
2017-01-17Use resizable Vec instead of P<[T]> in ASTVadim Petrochenkov-1/+1
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-2/+6
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-22Refactor how global paths are represented (for both ast and hir).Jeffrey Seyfried-7/+3
2016-12-19Optimize `ast::PathSegment`.Jeffrey Seyfried-44/+9
2016-12-17Auto merge of #38205 - jseyfried:fix_module_directory_regression, r=eddybbors-2/+2
macros: fix the expected paths for a non-inline module matched by an `item` fragment Fixes #38190. r? @nrc
2016-12-07macros: fix the expected paths for a non-inline module matched by an `item` ↵Jeffrey Seyfried-2/+2
fragment.
2016-12-06annotate stricter lifetimes on LateLintPass methods to allow them to forward ↵Oliver Schneider-2/+2
to a Visitor
2016-11-22Start warning cycle.Jeffrey Seyfried-1/+1
2016-11-22Clean up directory ownership semantics.Jeffrey Seyfried-2/+15
2016-11-21Fix fallout in `rustdoc` and tests.Jeffrey Seyfried-28/+23