about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
2016-11-14Auto merge of #37278 - matklad:lone-lifetime, r=jseyfriedbors-1/+1
Fix syntax error in the compiler Currently `rustc` accepts the following code: `fn f<'a>() where 'a {}`. This should be a syntax error, shouldn't it? Not sure if my changes actually compile, waiting for the LLVM to build.
2016-11-14Fix where clauses parsingAleksey Kladov-1/+1
Don't allow lifetimes without any bounds at all
2016-11-13Auto merge of #37753 - est31:master, r=petrochenkovbors-3/+3
Fix empty lifetime list or one with trailing comma being rejected Fixes #37733
2016-11-13Fix empty lifetime list or one with trailing comma being rejectedest31-3/+3
Fixes #37733
2016-11-10syntax: don't fake a block around closures' bodies during parsing.Eduard Burtescu-16/+3
2016-11-04Improve `tt`-heavy expansion performance.Jeffrey Seyfried-1/+8
2016-11-03Move doc comment desugaring into the parser.Jeffrey Seyfried-0/+11
2016-11-03Reimplement "macros: Improve `tt` fragments" with better performance.Jeffrey Seyfried-18/+61
2016-11-03Reduce the size of `Token` and make it cheaper to clone by refactoringJeffrey Seyfried-143/+44
`Token::Interpolated(Nonterminal)` -> `Token::Interpolated(Rc<Nonterminal>)`.
2016-11-03Clean up `parser.parse_token_tree()`.Jeffrey Seyfried-22/+13
2016-10-31Changed most vec! invocations to use square bracesiirelu-4/+4
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-10-29Move `CrateConfig` from `Crate` to `ParseSess`.Jeffrey Seyfried-16/+3
2016-10-28Auto merge of #37367 - jseyfried:import_crate_root, r=nrcbors-4/+9
Support `use *;` and `use ::*;`. Fixes #31484. r? @nrc
2016-10-28Rollup merge of #36206 - mcarton:35755, r=pnkfelixGuillaume Gomez-0/+11
Fix bad error message with `::<` in types Fix #36116. Before: ```rust error: expected identifier, found `<` --> src/test/compile-fail/issue-36116.rs:16:52 | 16 | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); | ^ error: chained comparison operators require parentheses --> src/test/compile-fail/issue-36116.rs:16:52 | 16 | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); | ^^^^^^ | = help: use `::<...>` instead of `<...>` if you meant to specify type arguments error: expected expression, found `)` --> src/test/compile-fail/issue-36116.rs:16:57 | 16 | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); | ^ error: expected identifier, found `<` --> src/test/compile-fail/issue-36116.rs:20:17 | 20 | let g: Foo::<i32> = Foo { _a: 42 }; | ^ error: aborting due to 5 previous errors ``` After: ```rust error: unexpected token: `::` --> src/test/compile-fail/issue-36116.rs:16:50 | 16 | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); | ^^ | = help: use `<...>` instead of `::<...>` if you meant to specify type arguments error: unexpected token: `::` --> src/test/compile-fail/issue-36116.rs:20:15 | 20 | let g: Foo::<i32> = Foo { _a: 42 }; | ^^ | = help: use `<...>` instead of `::<...>` if you meant to specify type arguments error: aborting due to 2 previous errors ```
2016-10-28Fix bad error message with `::<` in typesmcarton-0/+11
2016-10-27Auto merge of #37245 - goffrie:recovery, r=nrcbors-2/+10
Recover out of an enum or struct's braced block. If we encounter a syntax error inside of a braced block, then we should fail by consuming the rest of the block if possible. This implements such recovery for enums and structs. Fixes #37113.
2016-10-26Recover out of an enum or struct's braced block.Geoffry Song-2/+10
If we encounter a syntax error inside of a braced block, then we should fail by consuming the rest of the block if possible. This implements such recovery for enums and structs. Fixes #37113.
2016-10-27Implement field shorthands in struct literal expressions.Eduard Burtescu-8/+21
2016-10-23Support `use *;` and `use ::*;`.Jeffrey Seyfried-4/+9
2016-10-20Tweak path parsing logicVadim Petrochenkov-15/+23
2016-10-20Refactor parser lookahead buffer and increase its sizeVadim Petrochenkov-38/+35
2016-10-19Improve `$crate`.Jeffrey Seyfried-3/+6
2016-10-05Rename Parser::last_token_kind as prev_token_kind.Nicholas Nethercote-17/+17
Likewise, rename LastTokenKind as PrevTokenKind. This is a [breaking-change] for libsyntax.
2016-10-05Rename Parser::last_span as prev_span.Nicholas Nethercote-158/+154
This is a [breaking-change] for libsyntax.
2016-10-01Rollup merge of #34764 - pnkfelix:attrs-on-generic-formals, r=eddybManish Goregaokar-9/+53
First step for #34761
2016-10-01Rollup merge of #36599 - ↵Manish Goregaokar-3/+3
jonas-schievink:whats-a-pirates-favorite-data-structure, r=pnkfelix Contains a syntax-[breaking-change] as a separate commit (cc #31645).nnAlso renames slice patterns from `PatKind::Vec` to `PatKind::Slice`.
2016-09-28Rollup merge of #36789 - jseyfried:non_inline_mod_in_block, r=nikomatsakisJonathan Turner-9/+13
Allow more non-inline modules in blocks Currently, non-inline modules without a `#[path]` attribute are not allowed in blocks. This PR allows non-inline modules that have an ancestor module with a `#[path]` attribute, provided there is not a nearer ancestor block. For example, ```rust fn main() { #[path = "..."] mod foo { mod bar; //< allowed by this PR fn f() { mod bar; //< still an error } } } ``` Fixes #36772. r? @nikomatsakis
2016-09-28Allow non-inline modules in more places.Jeffrey Seyfried-9/+13
2016-09-28libsyntax: clearer names for some AST partsJonas Schievink-3/+3
This applies the HIR changes from the previous commits to the AST, and is thus a syntax-[breaking-change] Renames `PatKind::Vec` to `PatKind::Slice`, since these are called slice patterns, not vec patterns. Renames `TyKind::Vec`, which represents the type `[T]`, to `TyKind::Slice`. Renames `TyKind::FixedLengthVec` to `TyKind::Array`.
2016-09-26Rollup merge of #36669 - jseyfried:refactor_tok_result, r=nrcJonathan Turner-11/+0
Unify `TokResult` and `ResultAnyMacro` Fixes #36641. r? @nrc
2016-09-26Rollup merge of #36662 - jseyfried:parse_macro_invoc_paths, r=nrcJonathan Turner-252/+222
parser: support paths in bang macro invocations (e.g. `path::to::macro!()`) r? @nrc
2016-09-26Move `ensure_complete_parse` into `expand.rs`.Jeffrey Seyfried-14/+0
2016-09-26Refactor `ensure_complete_parse`.Jeffrey Seyfried-9/+12
2016-09-23Added tests and fixed corner case for trailing attributes with no attached ↵Felix S. Klock II-1/+16
binding in generics.
2016-09-23Add attribute support to generic lifetime and type parameters.Felix S. Klock II-9/+38
I am using `ThinAttributes` rather than a vector for attributes attached to generics, since I expect almost all lifetime and types parameters to not carry any attributes.
2016-09-23Fix indents.Jeffrey Seyfried-141/+131
2016-09-23Cleanup.Jeffrey Seyfried-40/+17
2016-09-23Parse paths in item, trait item, and impl item macro invocations.Jeffrey Seyfried-21/+6
2016-09-23Parse paths in statement and pattern macro invocations.Jeffrey Seyfried-31/+46
2016-09-23reviewer comments and rebasingNick Cameron-7/+20
2016-09-22Refactor out `parse_struct_expr`.Jeffrey Seyfried-45/+48
2016-09-18Auto merge of #36527 - nnethercote:last_token_kind, r=jseyfriedbors-43/+39
Optimize the parser's last token handling. The parser currently makes a heap copy of the last token in four cases: identifiers, paths, doc comments, and commas. The identifier and interpolation cases are unused, and for doc comments and commas we only need to record their presence, not their value. This commit consolidates the last token handling and avoids the unnecessary copies by replacing `last_token`, `last_token_eof`, and `last_token_interpolated` with a new field `last_token_kind`. This simplifies the parser slightly and speeds up parsing on some files by 3--4%.
2016-09-17Auto merge of #36502 - TimNN:correct-cancel, r=jseyfriedbors-5/+11
correctly cancel some errors Fixes #36499. I also (proactively) changed all other calls in `parser.rs` to use `Handler::cancel`.
2016-09-16Auto merge of #36482 - jseyfried:dont_load_unconfigured_noninline_modules, r=nrcbors-9/+18
Avoid loading and parsing unconfigured non-inline modules. For example, `#[cfg(any())] mod foo;` will always compile after this PR, even if `foo.rs` and `foo/mod.rs` do not exist or do not contain valid Rust. Fixes #36478 and fixes #27873. r? @nrc
2016-09-16Optimize the parser's last token handling.Nicholas Nethercote-43/+39
The parser currently makes a heap copy of the last token in four cases: identifiers, paths, doc comments, and commas. The identifier and interpolation cases are unused, and for doc comments and commas we only need to record their presence, not their value. This commit consolidates the last token handling and avoids the unnecessary copies by replacing `last_token`, `last_token_eof`, and `last_token_interpolated` with a new field `last_token_kind`. This simplifies the parser slightly and speeds up parsing on some files by 3--4%.
2016-09-15correctly cancel some errorsTim Neumann-5/+11
2016-09-15Avoid loading and parsing unconfigured non-inline modules.Jeffrey Seyfried-9/+18
2016-09-13Remove parsing of obsolete pre-1.0 syntaxesVadim Petrochenkov-32/+1
2016-09-05In `Parser` and `ExtCtxt`, replace fields `filename` and `mod_path_stack`Jeffrey Seyfried-26/+16
with a single field `directory: PathBuf`.
2016-09-03Check fields in union patters/expressionsVadim Petrochenkov-1/+3
Make parsing of union items backward compatible Add some tests