about summary refs log tree commit diff
path: root/src/test/ui/parser
AgeCommit message (Collapse)AuthorLines
2020-08-13Recover gracefully from `struct ` parse errorsEsteban Küber-17/+3
2020-08-13Rollup merge of #74650 - estebank:ambiguous-expr-binop, r=eddybTyler Mandry-22/+45
Correctly parse `{} && false` in tail expression Fix #74233, fix #54186.
2020-08-11Detect tuple variants used as struct pattern and suggest correct patternEsteban Küber-3/+11
2020-08-08Add a regression test for match guardLzu Tao-0/+18
Unlike if condition, match guard accepts struct literal.
2020-08-08Fallback to pase_expr because match guard accepts struct literalsLzu Tao-5/+27
2020-08-08Gate to if-let guard featureLzu Tao-27/+5
2020-07-27mv std libs to library/mark-1/+1
2020-07-22Correctly parse `{} && false` in tail expressionEsteban Küber-22/+45
Fix #74233.
2020-07-14Suggest struct pat on incorrect unit or tuple patEsteban Küber-1/+1
When encountering a unit or tuple pattern for a struct-like item, suggest using the correct pattern. Use `insert_field_names_local` when evaluating variants and store field names even when the list is empty in order to produce accurate structured suggestions.
2020-07-10Rollup merge of #71322 - petrochenkov:tuple00, r=nikomatsakisManish Goregaokar-0/+474
Accept tuple.0.0 as tuple indexing (take 2) If we expect something identifier-like when parsing a field name after `.`, but encounter a float token, we break that float token into parts, similarly to how we break `&&` into `&` `&`, or `<<` into `<` `<`, etc. An alternative to https://github.com/rust-lang/rust/pull/70420.
2020-07-09Rollup merge of #74188 - estebank:tweak-ascription-typo-heuristic, ↵Manish Goregaokar-10/+10
r=petrochenkov Tweak `::` -> `:` typo heuristic and reduce verbosity Do not trigger on correct type ascription expressions with trailing operators and _do_ trigger on likely path typos where a turbofish is used. On likely path typos, remove note explaining type ascription. Clean up indentation. r? @petrochenkov
2020-07-09Tweak `::` -> `:` typo heuristic and reduce verbosityEsteban Küber-10/+10
Do not trigger on correct type ascription expressions with trailing operators and _do_ trigger on likely path typos where a turbofish is used. On likely path typos, remove note explaining type ascription.
2020-07-06Rollup merge of #73953 - JohnTitor:audit-hidden-sugg, r=estebankManish Goregaokar-30/+345
Audit hidden/short code suggestions Should fix #73641. Audit uses of `span_suggestion_short` and `tool_only_span_suggestion` (`span_suggestion_hidden` is already tested with `run-rustfix`). Leave some FIXMEs for futher improvements/fixes. r? @estebank
2020-07-04Update UI testsGuillaume Gomez-8/+11
2020-07-02Add some requested testsVadim Petrochenkov-0/+63
2020-07-02parser: Break float tokens into parts in tuple field positionsVadim Petrochenkov-0/+411
2020-07-02Audit uses of `tool_only_span_suggestion`Yuki Okushi-12/+28
2020-07-02Audit uses of `span_suggestion_short`Yuki Okushi-18/+317
2020-07-01Rollup merge of #73803 - Aaron1011:feature/angle-field-recovery, r=matthewjasperManish Goregaokar-0/+22
Recover extra trailing angle brackets in struct definition This commit applies the existing 'extra angle bracket recovery' logic when parsing fields in struct definitions. This allows us to continue parsing the struct's fields, avoiding spurious 'missing field' errors in code that tries to use the struct.
2020-07-01Rollup merge of #73828 - nop:fix/parameter-name-help, r=estebankManish Goregaokar-3/+3
Fix wording for anonymous parameter name help ``` --> exercises/functions/functions2.rs:8:15 | 8 | fn call_me(num) { | ^ expected one of `:`, `@`, or `|` | = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) help: if this is a `self` type, give it a parameter name | 8 | fn call_me(self: num) { | ^^^^^^^^^ help: if this was a parameter name, give it a type | 8 | fn call_me(num: TypeName) { | ^^^^^^^^^^^^^ help: if this is a type, explicitly ignore the parameter name | 8 | fn call_me(_: num) { | ``` This commit changes "if this was a parameter name" to "if this is a parameter name" to match the wording of similar errors.
2020-06-27Fix wording for anonymous parameter name helpJames Box-3/+3
2020-06-28Rename the lint to clashing_extern_declarations.jumbatm-1/+1
Also, run RustFmt on the clashing_extern_fn test case and update stderrs.
2020-06-27Recover extra trailing angle brackets in struct definitionAaron Hill-0/+22
This commit applies the existing 'extra angle bracket recovery' logic when parsing fields in struct definitions. This allows us to continue parsing the struct's fields, avoiding spurious 'missing field' errors in code that tries to use the struct.
2020-06-26rustc_lexer: Simplify shebang parsing once moreVadim Petrochenkov-0/+9
2020-06-25Rollup merge of #73581 - GuillaumeGomez:add-0766, r=varkorManish Goregaokar-1/+2
Create 0766 error code
2020-06-25Rollup merge of #72770 - crlf0710:mixed_script_confusable, r=ManishearthManish Goregaokar-3/+5
Implement mixed script confusable lint. This implements the mixed script confusable lint defined in RFC 2457. This is blocked on #72069 and https://github.com/unicode-rs/unicode-security/pull/13, and will need a Cargo.toml version bump after those are resolved. The lint message warning is sub-optimal for now. We'll need a mechanism to properly output `AugmentScriptSet` to screen, this is to be added in `unicode-security` crate. r? @Manishearth
2020-06-25Update UI testGuillaume Gomez-1/+2
2020-06-23Refactor non_ascii_idents lints, exclude ascii pair for confusable_idents lint.Charles Lew-3/+5
2020-06-21Update UI testsGuillaume Gomez-1/+2
2020-06-20Update existing test cases.jumbatm-0/+1
- Allow ClashingExternDecl for lint-dead-code-3 - Update test case for #5791 - Update test case for #1866 - Update extern-abi-from-macro test case
2020-06-19Rollup merge of #71420 - RalfJung:specialization-incomplete, r=matthewjasperManish Goregaokar-32/+61
Specialization is unsound As discussed in https://github.com/rust-lang/rust/issues/31844#issuecomment-617013949, it might be a good idea to warn users of specialization that the feature they are using is unsound. I also expanded the "incomplete feature" warning to link the user to the tracking issue.
2020-06-19Rollup merge of #73280 - GuillaumeGomez:add-e0763, r=petrochenkovRalf Jung-2/+3
Add E0763
2020-06-18Rollup merge of #71976 - mibac138:let-recovery, r=estebankManish Goregaokar-0/+28
Improve diagnostics for `let x += 1` Fixes(?) #66736 The code responsible for the `E0404` errors is [here](https://github.com/rust-lang/rust/blob/master/src/librustc_parse/parser/ty.rs#L399-L424) which I don't think can be easily modified to prevent emitting an error in one specific case. Because of this I couldn't get rid of `E0404` and instead added `E0067` along with a help message which will fix the problem. r? @estebank
2020-06-16Update ui testsGuillaume Gomez-2/+3
2020-06-16bless allRalf Jung-30/+50
2020-06-16warn against 'specialization' featureRalf Jung-2/+11
2020-06-12Auto merge of #69478 - avr-rust:avr-support-upstream, r=jonas-schievinkbors-1/+1
Enable AVR as a Tier 3 target upstream Tracking issue: #44052. Things intentionally left out of the initial upstream: * The `target_cpu` flag I have made the cleanup suggestions by @jplatte and @jplatte in https://github.com/avr-rust/rust/commit/043550d9db0582add42e5837f636f61acb26b915. Anybody feel free to give the branch a test and see how it fares, or make suggestions on the code patch itself.
2020-06-10Add tests for E0762Guillaume Gomez-2/+4
2020-06-09[AVR] Add required references for AVR to the parser test suitesDylan McKay-1/+1
2020-06-06Order the Rust and C ABIs first to reduce test churnJake Goulding-1/+1
2020-05-29rustc_lexer: Optimize shebang detection slightlyVadim Petrochenkov-0/+14
2020-05-25Fix bug in shebang handlingRussell Cohen-0/+73
Shebang handling was too agressive in stripping out the first line in cases where it is actually _not_ a shebang, but instead, valid rust (#70528). This is a second attempt at resolving this issue (the first attempt was flawed, for, among other reasons, causing an ICE in certain cases (#71372, #71471). The behavior is now codified by a number of UI tests, but simply: For the first line to be a shebang, the following must all be true: 1. The line must start with `#!` 2. The line must contain a non whitespace character after `#!` 3. The next character in the file, ignoring comments & whitespace must not be `[` I believe this is a strict superset of what we used to allow, so perhaps a crater run is unnecessary, but probably not a terrible idea.
2020-05-21Adjust according to petrochenkov's review commentsmibac138-48/+5
2020-05-20Adjust according to estebank's review commentsmibac138-16/+16
2020-05-20Error recovery for `let` with `+=`mibac138-2/+10
2020-05-20Expand partial error recovery for `let` with `BinOpEq`mibac138-2/+20
2020-05-20Implement partial error recovery for `let` with `BinOpEq`mibac138-0/+45
When parsing `let x: i8 += 1` the compiler interprets `i8` as a trait which makes it more complicated to do error recovery. More advanced error recovery is not implemented in this commit.
2020-05-16Rollup merge of #72254 - ehuss:double-backtick, r=dtolnayRalf Jung-3/+3
Remove redundant backtick in error message. The value passed in already has backticks surrounding the text.
2020-05-15Remove redundant backtick in error message.Eric Huss-3/+3
The value passed in already has backticks surrounding the text.
2020-05-09adjust testsRalf Jung-1/+2