Commit graph

30 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
Matthias Krüger 13314df21b
Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelix
Detect pub structs never constructed and unused associated constants

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->

Lints never constructed public structs.

If we don't provide public methods to construct public structs with private fields, and don't construct them in the local crate. They would be never constructed. So that we can detect such public structs.

---
Update:

Also lints unused associated constants in traits.
2024-06-07 20:14:28 +02:00
r0cky 35130d7233 Detect pub structs never constructed and unused associated constants in traits 2024-06-05 23:20:09 +08:00
Michael Goulet 0a83764cbd Simplify IntVarValue/FloatVarValue 2024-06-01 10:31:32 -04:00
Michael Goulet dbdef68ddf Make sure we consume a generic arg when checking mistyped turbofish 2024-05-09 10:47:14 -04:00
Ross Smyth 6967d1c0fc Stabilize exclusive_range 2024-05-02 19:42:31 -04:00
Alan Egerton ddcfb94b84
Suppress erroneous suggestion
The suggestion to use `let else` with an uninitialized refutable `let`
statement was erroneous: `let else` cannot be used with deferred
initialization.
2024-04-12 17:45:15 +01:00
León Orell Valerian Liehr 3879acbec0
Suggest assoc ty bound on lifetime in eq constraint 2024-03-23 00:17:30 +01:00
clubby789 8e45d0fe49 Cancel parsing ever made during recovery 2024-03-06 21:59:03 +00:00
Esteban Küber bde2dfb127 Detect more cases of = to : typo
When a `Local` is fully parsed, but not followed by a `;`, keep the `:` span
arround and mention it. If the type could continue being parsed as an
expression, suggest replacing the `:` with a `=`.

```
error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.`
 --> file.rs:2:32
  |
2 |     let _: std::env::temp_dir().join("foo");
  |          -                     ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
  |          |
  |          while parsing the type for `_`
  |          help: use `=` if you meant to assign
```

Fix #119665.
2024-03-01 02:03:00 +00:00
许杰友 Jieyou Xu (Joe) ec2cc761bc
[AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
Esteban Küber 8d4d572e4d Fix msg for verbose suggestions with confusable capitalization
When encountering a verbose/multipart suggestion that has changes
that are only caused by different capitalization of ASCII letters that have
little differenciation, expand the message to highlight that fact (like we
already do for inline suggestions).

The logic to do this was already present, but implemented incorrectly.
2024-02-14 20:15:13 +00:00
Oli Scherer eab2adb660 Continue to borrowck even if there were previous errors 2024-02-08 08:10:43 +00:00
Esteban Küber a9841936fe Deduplicate more sized errors on call exprs
Change the implicit `Sized` `Obligation` `Span` for call expressions to
include the whole expression. This aids the existing deduplication
machinery to reduce the number of errors caused by a single unsized
expression.
2024-01-24 02:53:15 +00:00
George-lewis d56cdd48cb Bless tests
Update tests
2024-01-13 12:46:58 -05:00
Jake Goulding 53eca9fa87 Adjust compiler tests for unused_tuple_struct_fields -> dead_code 2024-01-02 15:34:37 -05:00
surechen 4897d5eccf Simple modification of diagnostic information
fixes #119067
2023-12-21 10:17:11 +08:00
Esteban Küber 4e524386e9 Always emit help when failing to parse enum variant 2023-11-29 18:47:32 +00:00
Esteban Küber 147faa54d5 Fix tidy 2023-11-29 18:47:32 +00:00
Esteban Küber bd1feb8cef Fix test and move to more appropriate directory 2023-11-29 18:47:32 +00:00
Esteban Küber 0ff331bc78 Change how for (x in foo) {} is handled
Use the same approach used for match arm patterns.
2023-11-29 18:47:32 +00:00
Esteban Küber c47318983b Account for (pat if expr) => {}
When encountering match arm (pat if expr) => {}, recover and suggest removing parentheses. Fix #100825.
2023-11-29 18:47:32 +00:00
Esteban Küber db39068ad7 Change enum parse recovery 2023-11-29 18:47:31 +00:00
Esteban Küber 1994abed74 Bubble parse error when expecting ) 2023-11-29 18:47:31 +00:00
Esteban Küber 075c599188 More accurate span for unnecessary parens suggestion 2023-11-29 18:47:31 +00:00
Esteban Küber 44fd3b4d46 Make parse_pat_ident not recover bad name 2023-11-29 18:47:31 +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
Esteban Küber 099eb40932 Fix code indentation 2023-11-16 21:54:04 +00:00
Esteban Küber 8e7d0702a2 Add test for parens around match arm pattern and condition 2023-11-16 16:58:41 +00:00
Esteban Küber ae20897b30 Move tests to subdirectory 2023-11-16 16:58:41 +00:00