Commit Graph

28 Commits

Author SHA1 Message Date
Esteban Küber
9fd7784b97 Fix ... in multline code-skips in suggestions
When we have long code skips, we write `...` in the line number gutter.

For suggestions, we were "centering" the `...` with the line, but that was consistent with what we do in every other case.
2024-06-20 04:25:17 +00:00
surechen
8fde7e3b64 For OutsideLoop we should not suggest add 'block label in if block, or we wiil get another err: block label not supported here.
fixes #123261
2024-05-22 19:47:32 +08:00
Gary Guo
cfee72aa24 Fix tests and bless 2024-04-24 13:12:33 +01:00
Michael Goulet
8a981b6fee Use /* value */ as a placeholder 2024-04-15 21:36:52 -04:00
Esteban Küber
1eda0565fa Handle more cases of "values to suggest" given a type
Add handling for `String`, `Box`, `Option` and `Result`.
2024-04-10 23:58:36 +00:00
Esteban Küber
e17388b809 Handle more cases of value suggestions 2024-04-10 20:36:14 +00:00
Esteban Küber
a983dd8563 Tweak value suggestions in borrowck and hir_analysis
Unify the output of `suggest_assign_value` and `ty_kind_suggestion`.

Ideally we'd make these a single function, but doing so would likely require modify the crate dependency tree.
2024-04-09 23:37:13 +00:00
Caio
4c0aea0d47 Move some tests 2024-03-31 14:58:17 -03:00
Alex Crichton
cf6d6050f7 Update test directives for wasm32-wasip1
* The WASI targets deal with the `main` symbol a bit differently than
  native so some `codegen` and `assembly` tests have been ignored.
* All `ignore-emscripten` directives have been updated to
  `ignore-wasm32` to be more clear that all wasm targets are ignored and
  it's not just Emscripten.
* Most `ignore-wasm32-bare` directives are now gone.
* Some ignore directives for wasm were switched to `needs-unwind`
  instead.
* Many `ignore-wasm32*` directives are removed as the tests work with
  WASI as opposed to `wasm32-unknown-unknown`.
2024-03-11 09:36:35 -07:00
Caio
2aab000105 Move tests 2024-03-03 16:30:48 -03:00
许杰友 Jieyou Xu (Joe)
ec2cc761bc
[AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
Esteban Küber
37d2ea2fa0 Properly handle async blocks and fns in if exprs without else
When encountering a tail expression in the then arm of an `if` expression
without an `else` arm, account for `async fn` and `async` blocks to
suggest `return`ing the value and pointing at the return type of the
`async fn`.

We now also account for AFIT when looking for the return type to point at.

Fix #115405.
2024-02-12 20:26:34 +00:00
Oli Scherer
eab2adb660 Continue to borrowck even if there were previous errors 2024-02-08 08:10:43 +00:00
Nilstrieb
41e8d152dc Show number in error message even for one error
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Michael Goulet
137b6d0b01 Point to where missing return type should go 2023-10-04 21:09:54 +00:00
Esteban Küber
4b15959218 Add context to let: Ty = loop { break };
We weren't accounting for the case where `break` was immediately within
the `loop` block.
2023-09-26 23:46:10 +00:00
Esteban Küber
ddb3b7e70a Use verbose suggestion for break without value 2023-09-25 22:10:08 +00:00
Esteban Küber
3747ef5d6f Handle all arbitrary loop nesting in break type errors 2023-09-25 21:57:22 +00:00
Esteban Küber
58adfd84e2 Account for more cases of nested loops for break type mismatches 2023-09-25 18:21:52 +00:00
Esteban Küber
2e0ad2025f Handle yet another case of break type mismatch 2023-09-25 15:55:59 +00:00
Esteban Küber
f6d4950fee Point at previous breaks that have the expected type 2023-09-25 15:55:59 +00:00
Esteban Küber
d3dea30cb4 Point at cause of expectation of break value when possible
Fix #115905.
2023-09-22 22:20:53 +00:00
Caio
5a69151d7d Move tests 2023-08-28 17:47:37 -03:00
Michael Goulet
0a51ab93cf Don't suggest break through nested items 2023-05-31 16:51:25 +00:00
y21
0758c05c97 recover from for-else and while-else 2023-03-01 13:26:59 +01:00
Caio
d75e43c371 Move tests 2023-02-16 11:42:35 -03:00
Esteban Küber
62ba3e70a1 Modify primary span label for E0308
The previous output was unintuitive to users.
2023-01-30 20:12:19 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00