about summary refs log tree commit diff
path: root/src/test/ui/expr
AgeCommit message (Collapse)AuthorLines
2021-09-16Fix rebaseEsteban Kuber-3/+12
2021-09-09Emit proper errors on missing closure bracesSasha Pourcelot-0/+110
This commit focuses on emitting clean errors for the following syntax error: ``` Some(42).map(|a| dbg!(a); a ); ``` Previous implementation tried to recover after parsing the closure body (the `dbg` expression) by replacing the next `;` with a `,`, which made the next expression belong to the next function argument. As such, the following errors were emitted (among others): - the semicolon token was not expected, - a is not in scope, - Option::map is supposed to take one argument, not two. This commit allows us to gracefully handle this situation by adding giving the parser the ability to remember when it has just parsed a closure body inside a function call. When this happens, we can treat the unexpected `;` specifically and try to parse as much statements as possible in order to eat the whole block. When we can't parse statements anymore, we generate a clean error indicating that the braces are missing, and return an ExprKind::Err.
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-34/+20
2021-08-11Modify structured suggestion outputEsteban Küber-12/+16
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-07-30Use multispan suggestions more oftenEsteban Küber-32/+48
* Use more accurate span for `async move` suggestion * Use more accurate span for deref suggestion * Use `multipart_suggestion` more often
2021-05-12Show macro name in 'this error originates in macro' messageAaron Hill-2/+2
When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
2021-02-18Add explanations and suggestions to `irrefutable_let_patterns` lintCamelid-0/+16
2021-02-18Rollup merge of #82215 - TaKO8Ki:replace-if-let-while-let, r=varkorDylan DPC-16/+16
Replace if-let and while-let with `if let` and `while let` This pull request replaces if-let and while-let with `if let` and `while let`. closes https://github.com/rust-lang/rust/issues/82205
2021-02-17replace if-let and while-let with `if let` and `while let`Takayuki Maeda-16/+16
2021-02-16Move some tests to more reasonable directoriesCaio-0/+45
2020-12-04Move format machinery tests to where they belongAleksey Kladov-486/+0
2020-11-24Move src/test/ui/if-*.rs to src/test/expr/if/if-*.rsHavvy (Ryan Scheel)-0/+195
2020-11-24Move src/test/ui/if-attrs to src/test/ui/expr/if/attrsHavvy (Ryan Scheel)-0/+176
2020-11-24Move src/test/ui/if to src/test/ui/expr/ifHavvy (Ryan Scheel)-0/+1025
2020-11-22Add test for eval order for a+=bHavvy (Ryan Scheel)-0/+76
Yes, the order of evaluation *does* change depending on the types of the operands. Cursed, I know. I've elected to place this test into `expr/compound-assignment` creating both the `expr` directory and the `compound-assignment` directory. I plan in a future PR to also move the `if` directory and the loose `if` tests into `expr/if` and other similar cleanups of the `test/ui` directory. Future work: Test more than just `+=`, but all operators. I don't know if using a macro to generate these tests cases would be okay or not, but it'd be boilerplatey without it. I'm also confident you cannot change the evaluation order of one operator without changing all of them. Future work: Additionally, test more than just `i32 += i32` for the primitive version. I don't actually know the full set of primitive implementations, but I imagine there's enough to cause a combinatorial explosion with the previous future work item. Somewhere on the order of one to two hundred individual functions.