Commit Graph

25 Commits

Author SHA1 Message Date
reddevilmidzy 79893a050e cleaned up some tests
merged tests/ui/issues/issue-2951.rs with
tests/ui/type/type-parameter-names.rs

Merged
tests/ui/for-loop-while/break-continue-in-loop-while-contiditoin-1.rs
with
tests/ui/for-loop-while/break-continue-in-loop-while-contiditoin-2.rs

Removed tests/ui/issues/issue-2383.rs
duplicated of library\alloc\src\collections\vec_deque\tests.rs

Removed tests/ui/issues/issue-20714.rs
duplicated of tests/ui/empty/empty-struct-unit-expr.rs

Added comment to tests/ui/match/match-option-result-mismatch.rs, tests/ui/numeric/ref-int.rs,
tests/ui/box/self-assignment.rs
2025-12-07 10:37:45 +09:00
reddevilmidzy d3e4dd29a8 Use let...else consistently in user-facing diagnostics 2025-11-24 11:41:52 +09:00
Jonathan Brouwer 66b8a9db1f Update uitests with new unused_attributes warnings
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-18 21:17:48 +02:00
Jana Dönszelmann b3631e1174 improve empty attribute diagnostic 2025-09-27 19:32:14 +02:00
Jonathan Brouwer 3fa0ec91d8 Rewrite empty attribute lint
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 09:51:35 +02:00
Noratrieb 01503d0c1e Avoid extra path trimming in method not found error
Method errors have an extra check that force trim paths whenever the
normal string is longer than 10 characters, which can be quite unhelpful
when multiple items have the same name (for example an `Error`).

A user reported this force trimming as being quite unhelpful when they
had a method error where the precise path of the `Error` mattered.

The code uses `tcx.short_string` already to get the normal path, which
tries to be clever around trimming paths if necessary, so there is no
reason for this extra force trimming.
2025-05-24 23:31:07 +02:00
Vadim Petrochenkov 20faf8532b compiletest: Make diagnostic kind mandatory on line annotations 2025-04-30 10:44:24 +03:00
Michael Goulet 6d71251cf9 Trim suggestion parts to the subset that is purely additive 2025-02-14 00:44:10 -08:00
Michael Goulet f6406dfd4e Consider add-prefix replacements too 2025-02-14 00:27:17 -08:00
Michael Goulet b480a9214a Use underline suggestions for purely 'additive' replacements 2025-02-14 00:27:13 -08:00
Esteban Küber f0845adb0c Show diff suggestion format on verbose replacement
```
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
  --> $DIR/attempted-access-non-fatal.rs:7:15
   |
LL |     let _ = 2.l;
   |               ^
   |
help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix
   |
LL -     let _ = 2.l;
LL +     let _ = 2.0f64;
   |
```
2025-02-10 20:21:39 +00:00
Chris Krycho d4275e08e7 Update tests for new TRPL chapter order 2024-11-23 08:57:25 -07:00
tunawasabi 2ddcbca0e6 Suggest the struct variant pattern syntax on usage of unit variant pattern for a struct variant 2024-08-28 22:55:57 +09:00
Esteban Küber ec7a188f16 More accurate suggestions when writing wrong style of enum variant literal
```
error[E0533]: expected value, found struct variant `E::Empty3`
  --> $DIR/empty-struct-braces-expr.rs:18:14
   |
LL |     let e3 = E::Empty3;
   |              ^^^^^^^^^ not a value
   |
help: you might have meant to create a new value of the struct
   |
LL |     let e3 = E::Empty3 {};
   |                        ++
```
```
error[E0533]: expected value, found struct variant `E::V`
  --> $DIR/struct-literal-variant-in-if.rs:10:13
   |
LL |     if x == E::V { field } {}
   |             ^^^^ not a value
   |
help: you might have meant to create a new value of the struct
   |
LL |     if x == (E::V { field }) {}
   |             +              +
```
```
error[E0618]: expected function, found enum variant `Enum::Unit`
  --> $DIR/suggestion-highlights.rs:15:5
   |
LL |     Unit,
   |     ---- enum variant `Enum::Unit` defined here
...
LL |     Enum::Unit();
   |     ^^^^^^^^^^--
   |     |
   |     call expression requires function
   |
help: `Enum::Unit` is a unit enum variant, and does not take parentheses to be constructed
   |
LL -     Enum::Unit();
LL +     Enum::Unit;
   |
```
```
error[E0599]: no variant or associated item named `tuple` found for enum `Enum` in the current scope
  --> $DIR/suggestion-highlights.rs:36:11
   |
LL | enum Enum {
   | --------- variant or associated item `tuple` not found for this enum
...
LL |     Enum::tuple;
   |           ^^^^^ variant or associated item not found in `Enum`
   |
help: there is a variant with a similar name
   |
LL |     Enum::Tuple(/* i32 */);
   |           ~~~~~~~~~~~~~~~~;
   |
```
2024-07-18 18:20:35 +00:00
xFrednet 8b14e23dce RFC 2383: Stabilize lint_reasons 🎉 2024-06-25 17:22:22 +02:00
许杰友 Jieyou Xu (Joe) ec2cc761bc [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +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
Mu001999 5bd8ba8493 Make "consider importing" consistent for macros 2023-06-10 00:06:34 +08:00
Vadim Petrochenkov b3ee735993 resolve: Remove struct_field_names_untracked 2023-03-13 17:31:55 +04:00
Esteban Küber 153ed09fb3 Tweak use of trimmed paths 2023-01-30 20:12:21 +00: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
Michael Goulet 21725774a2 note -> help 2023-01-17 03:09:49 +00:00
mejrs 8476c517c0 Don't recommend if let if let else works 2023-01-11 14:40:07 -08:00
mejrs 31c20210b9 Migrate pattern matching 2023-01-11 14:40:02 -08:00
Albert Larsan cf2dff2b1e Move /src/test to /tests 2023-01-11 09:32:08 +00:00