about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2017-03-29Merge `ExpnId` and `SyntaxContext`.Jeffrey Seyfried-5/+1
2017-03-27Fix unittestsEsteban Küber-1/+1
2017-03-27Simplify error outputEsteban Küber-11/+6
2017-03-27Fix various useless derefs and slicingsOliver Schneider-3/+3
2017-03-25Improve wording and spans for unexpected tokenEsteban Küber-6/+19
* Point at where the token was expected instead of the last token successfuly parsed. * Only show `unexpected token` if the next char and the unexpected token don't have the same span. * Change some cfail and pfail tests to ui test. * Don't show all possible tokens in span label if they are more than 6.
2017-03-24Point at last valid token on failed `expect_one_of`Esteban Küber-14/+14
```rust error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` --> $DIR/token-error-correct-3.rs:29:9 | 25 | foo() | - expected one of `.`, `;`, `?`, `}`, or an operator after this ... 29 | } else { | ^ unexpected token ```
2017-03-24Identify missing item category in `impl`sEsteban Küber-15/+47
```rust struct S; impl S { pub hello_method(&self) { println!("Hello"); } } fn main() { S.hello_method(); } ``` ```rust error: can't qualify macro invocation with `pub` --> file.rs:3:4 | 3 | pub hello_method(&self) { | ^^^- - expected `!` here for a macro invocation | | | did you mean to write `fn` here for a method declaration? | = help: try adjusting the macro to put `pub` inside the invocation ```
2017-03-22Add diagnostic for incorrect `pub (restriction)`Esteban Küber-26/+38
Given the following statement ```rust pub (a) fn afn() {} ``` Provide the following diagnostic: ```rust error: incorrect restriction in `pub` --> file.rs:15:1 | 15 | pub (a) fn afn() {} | ^^^^^^^ | = help: some valid visibility restrictions are: `pub(crate)`: visible only on the current crate `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path help: to make this visible only to module `a`, add `in` before the path: | pub (in a) fn afn() {} ``` Remove cruft from old `pub(path)` syntax.
2017-03-21Refactor parsing of trait object typesVadim Petrochenkov-242/+206
2017-03-19Rollup merge of #40589 - topecongiro:floating-point-literal, r=nagisaCorey Farwell-1/+1
Parse 0e+10 as a valid floating-point literal Fixes issue #40408.
2017-03-19Auto merge of #40346 - jseyfried:path_and_tokenstream_attr, r=nrcbors-101/+154
`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-18Parse 0e+10 as a valid floating-point literaltopecongiro-1/+1
Fixes issue #40408.
2017-03-14Point out correct turbofish usage on `Foo<Bar<Baz>>`Esteban Küber-1/+4
Whenever we parse a chain of binary operations, as long as the first operation is `<` and the subsequent operations are either `>` or `<`, present the following diagnostic help: use `::<...>` instead of `<...>` if you meant to specify type arguments This will lead to spurious recommendations on situations like `2 < 3 < 4` but should be clear from context that the help doesn't apply in that case.
2017-03-14Auto merge of #39921 - cramertj:add-catch-to-ast, r=nikomatsakisbors-0/+28
Add catch {} to AST Part of #39849. Builds on #39864.
2017-03-14Liberalize attributes.Jeffrey Seyfried-7/+36
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-85/+110
2017-03-14Cleanup.Jeffrey Seyfried-11/+10
2017-03-12Rollup merge of #40369 - petrochenkov:segspan, r=eddybCorey Farwell-18/+29
Give spans to individual path segments in AST And use these spans in path resolution diagnostics. The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors. HIR still doesn't have spans. Fixes https://github.com/rust-lang/rust/pull/38927#discussion_r95336667 https://github.com/rust-lang/rust/pull/38890#issuecomment-271731008 r? @nrc @eddyb
2017-03-12Auto merge of #40340 - petrochenkov:restricted, r=nikomatsakisbors-32/+40
Update syntax for `pub(restricted)` Update the syntax before stabilization. cc https://github.com/rust-lang/rust/issues/32409 r? @nikomatsakis
2017-03-11Temporarily prefix catch block with do keywordTaylor Cramer-13/+6
2017-03-11Add catch expr to AST and disallow catch as a struct nameTaylor Cramer-0/+35
2017-03-10Give spans to individual path segments in ASTVadim Petrochenkov-18/+29
2017-03-10Update syntax for `pub(restricted)`Vadim Petrochenkov-32/+40
2017-03-10Avoid using `Mark` and `Invocation` for macro defs.Jeffrey Seyfried-2/+1
2017-03-10Refactor out `ast::ItemKind::MacroDef`.Jeffrey Seyfried-3/+43
2017-03-04Inline function to avoid naming confusion.Mark Simulacrum-8/+6
2017-03-03Fix fallout in unit tests.Jeffrey Seyfried-29/+29
2017-03-03Fix `token::Eof` spans.Jeffrey Seyfried-2/+6
2017-03-03Integrate `TokenStream`.Jeffrey Seyfried-49/+46
2017-03-03Introduce `syntax::parse::parser::TokenCursor`.Jeffrey Seyfried-47/+127
2017-03-03Remove lifetime parameter from `syntax::tokenstream::Cursor`.Jeffrey Seyfried-1/+1
2017-02-28Add warning cycle.Jeffrey Seyfried-0/+4
2017-02-28Refactor out `parser.expect_delimited_token_tree()`.Jeffrey Seyfried-36/+13
2017-02-28Remove `Token::MatchNt`.Jeffrey Seyfried-3/+0
2017-02-28Add `syntax::ext::tt::quoted::{TokenTree, ..}` and remove ↵Jeffrey Seyfried-155/+16
`tokenstream::TokenTree::Sequence`.
2017-02-28Avoid `Token::{OpenDelim, CloseDelim}`.Jeffrey Seyfried-1/+1
2017-02-28Clean up `ext::tt::transcribe::TtFrame`, rename to `Frame`.Jeffrey Seyfried-2/+2
2017-02-28rustc_save_analysis: don't pollute the codemap with fake files.Eduard Burtescu-8/+38
2017-02-21Add long error explanationsGuillaume Gomez-17/+17
2017-02-20Add error codes for errors in libsyntaxGuillaume Gomez-40/+82
2017-02-10Fix ICE on certain sequence repetitions.Jeffrey Seyfried-5/+14
2017-02-09Fix ICE when parsing token trees after an error.Jeffrey Seyfried-3/+10
2017-02-05Rollup merge of #39453 - nrc:save-path, r=nikomatsakisCorey Farwell-0/+1
save-analysis: be more paranoid about generated paths fixes https://github.com/rust-lang-nursery/rls/issues/160
2017-02-03Bump version, upgrade bootstrapAlex Crichton-4/+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-02-02save-analysis: be more paranoid about generated pathsNick Cameron-0/+1
fixes https://github.com/rust-lang-nursery/rls/issues/160
2017-01-31use suggestions instead of helps with code in themOliver Schneider-4/+23
2017-01-27Rollup merge of #39335 - cramertj:cramertj/can_begin_expr_fix, r=petrochenkovAlex Crichton-1/+23
Fix can_begin_expr keyword behavior Partial fix for #28784.
2017-01-26Fix can_begin_expr keyword behaviorTaylor Cramer-1/+23
2017-01-27Auto merge of #39158 - petrochenkov:bounds, r=nikomatsakisbors-433/+300
Bounds parsing refactoring 2 See https://github.com/rust-lang/rust/pull/37511 for previous discussion. cc @matklad Relaxed parsing rules: - zero bounds after `:` are allowed in all contexts. - zero predicates are allowed after `where`. - trailing separator `,` is allowed after predicates in `where` clauses not followed by `{`. Other parsing rules: - trailing separator `+` is still allowed in all bound lists. Code is also cleaned up and tests added. I haven't touched parsing of trait object types yet, I'll do it later.
2017-01-26Better comments for FIXMEsVadim Petrochenkov-2/+2