about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2017-04-25 support `default impl` for specializationGianni Ciccarelli-3/+11
pr review
2017-04-24Remove strip prefixGuillaume Gomez-16/+2
2017-04-24Add tests for module suggestionsGuillaume Gomez-15/+28
2017-04-24Fix invalid module suggestionGuillaume Gomez-13/+20
2017-04-24support `default impl` for specializationGianni Ciccarelli-7/+22
this commit implements the first step of the `default impl` feature: all items in a `default impl` are (implicitly) `default` and hence specializable. In order to test this feature I've copied all the tests provided for the `default` method implementation (in run-pass/specialization and compile-fail/specialization directories) and moved the `default` keyword from the item to the impl. See referenced issue for further info
2017-04-21Move parse_remaining_bounds into a separate functionVadim Petrochenkov-20/+21
2017-04-21Fix issue with single question mark or parenVadim Petrochenkov-23/+28
2017-04-21syntax: Support parentheses around trait boundsVadim Petrochenkov-4/+25
2017-04-17Auto merge of #41282 - arielb1:missing-impl-item, r=petrochenkovbors-68/+99
libsyntax/parse: fix missing kind error reporting Fixes #41161. Fixes #41239.
2017-04-17libsyntax/parse: improve associated item error reportingAriel Ben-Yehuda-68/+99
Fixes #41161. Fixes #41239.
2017-04-17Auto merge of #41345 - frewsxcv:rollup, r=frewsxcvbors-1/+5
Rollup of 3 pull requests - Successful merges: #41012, #41280, #41290 - Failed merges:
2017-04-17Adjust descriptionalexey zabelin-1/+1
2017-04-15move NtVis enum variant to stave off comment rotAlex Burka-1/+1
2017-04-15parse interpolated visibility tokensAlex Burka-0/+2
2017-04-15update :vis implementation to current rustAlex Burka-1/+1
2017-04-15Implementation of the `vis` macro matcher.Daniel Keep-0/+2
2017-04-13Address the PR reviewalexey zabelin-2/+2
2017-04-12Fix old docsalexey zabelin-2/+2
#41158
2017-04-12Rollup merge of #41087 - estebank:tuple-float-index, r=arielb1Tim Neumann-3/+3
Use proper span for tuple index parsed as float Fix diagnostic suggestion from: ```rust help: try parenthesizing the first index | (1, (2, 3)).((1, (2, 3)).1).1; ``` to the correct: ```rust help: try parenthesizing the first index | ((1, (2, 3)).1).1; ``` Fix #41081.
2017-04-10Point at only one char on `Span::next_point`Esteban Küber-2/+4
Avoid pointing at two chars so the diagnostic output doesn't display a multiline span when starting beyond a line end.
2017-04-07Merge branch 'master' into ty-placeholderEsteban Küber-28/+88
2017-04-05Rollup merge of #41050 - jseyfried:fix_derive_parsing, r=petrochenkovCorey Farwell-0/+20
macros: fix bug parsing `#[derive]` invocations Fixes #40962 (introduced in #40346). r? @nrc
2017-04-05Rollup merge of #40815 - estebank:issue-40006, r=GuillaumeGomezAriel Ben-Yehuda-15/+42
Identify missing item category in `impl`s ```rust struct S; impl S { pub hello_method(&self) { println!("Hello"); } } fn main() { S.hello_method(); } ``` ```rust error: missing `fn` for method declaration --> file.rs:3:4 | 3 | pub hello_method(&self) { | ^ missing `fn` ``` Fix #40006. r? @pnkfelix CC @jonathandturner @GuillaumeGomez
2017-04-05Use proper span for tuple index parsed as floatEsteban Küber-3/+3
Fix diagnostic suggestion from: ```rust help: try parenthesizing the first index | (1, (2, 3)).((1, (2, 3)).1).1; ``` to the correct: ```rust help: try parenthesizing the first index | ((1, (2, 3)).1).1; ```
2017-04-04Merge branch 'master' into issue-32540Esteban Küber-456/+422
2017-04-03Fix bug parsing `#[derive]` macro invocations.Jeffrey Seyfried-0/+20
2017-04-03Merge branch 'master' into issue-40006Esteban Küber-457/+423
2017-04-02Introduce `TyErr` independent from `TyInfer`Esteban Küber-1/+24
Add a `TyErr` type to represent unknown types in places where parse errors have happened, while still able to build the AST. Initially only used to represent incorrectly written fn arguments and avoid "expected X parameters, found Y" errors when called with the appropriate amount of parameters. We cannot use `TyInfer` for this as `_` is not allowed as a valid argument type. Example output: ```rust error: expected one of `:` or `@`, found `,` --> file.rs:12:9 | 12 | fn bar(x, y: usize) {} | ^ error[E0061]: this function takes 2 parameters but 3 parameters were supplied --> file.rs:19:9 | 12 | fn bar(x, y) {} | --------------- defined here ... 19 | bar(1, 2, 3); | ^^^^^^^ expected 2 parameters ```
2017-03-31Auto merge of #40620 - laumann:slash-in-diagnostics-path, r=BurntSushibors-4/+5
Replace hardcoded forward slash with path::MAIN_SEPARATOR Fixes #40149
2017-03-30port the match code to use `CoerceMany`Niko Matsakis-0/+1
`match { }` now (correctly?) indicates divergence, which results in more unreachable warnings. We also avoid fallback to `!` if there is just one arm (see new test: `match-unresolved-one-arm.rs`).
2017-03-30Replace hardcoded forward slash with path::MAIN_SEPARATORThomas Jespersen-4/+5
Fixes #40149
2017-03-30Improve `Path` spans.Jeffrey Seyfried-48/+60
2017-03-29Refactor how spans are combined in the parser.Jeffrey Seyfried-377/+321
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