Commit Graph

65 Commits

Author SHA1 Message Date
Kivooeo c0597fbd80 cleaned up some tests
Reverting file name weird-exprs.rs due to its historical use, recognition in community and references
2025-07-17 15:51:32 +05:00
Kivooeo b7d024b056 moved tests 2025-07-14 02:28:43 +05:00
dianqk 0952f86de3 Rollup merge of #143118 - Kivooeo:tf15, r=tgross35
`tests/ui`: A New Order [15/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? `@jieyouxu`
2025-06-30 19:23:17 +08:00
Kivooeo 580bc12844 cleaned up some tests 2025-06-30 11:16:18 +05:00
Trevor Gross 74657a4a1a Move some UI tests to more apropriate directories
Prepare for rework done in the rest of [PR143118].

[PR143118]: https://www.github.com/rust-lang/rust/pull/143118

Co-authored-by: Kivooeo <Kivooeo123@gmail.com>
2025-06-28 19:07:29 -05:00
mejrs b1d18129d1 Implement DesugaringKind::FormatLiteral 2025-06-22 10:58:25 +02:00
Kivooeo c6c55cc0cb cleaned up some tests 2025-06-11 20:51:49 +05:00
Vadim Petrochenkov 8d5109aa6e compiletest: Support matching on diagnostics without a span 2025-03-25 17:33:09 +03:00
Esteban Küber f0b8e13b59 Do not suggest using -Zmacro-backtrace for builtin macros
For macros that are implemented on the compiler, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros.
2025-03-14 19:50:03 +00:00
Michael Goulet 0a7ab1d6df More sophisticated span trimming 2025-02-21 00:41:17 +00:00
Michael Goulet 6d71251cf9 Trim suggestion parts to the subset that is purely additive 2025-02-14 00:44:10 -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
Davis Muro 62c3c9a5ae add suggestion for wrongly ordered format parameters 2024-12-30 06:14:26 -08:00
Eric Huss f94142b366 Update tests to use new proc-macro header 2024-11-27 07:18:25 -08:00
Esteban Küber 5b54286640 Remove detail from label/note that is already available in other note
Remove the "which is required by `{root_obligation}`" post-script in
"the trait `X` is not implemented for `Y`" explanation in E0277. This
information is already conveyed in the notes explaining requirements,
making it redundant while making the text (particularly in labels)
harder to read.

```
error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
  --> $DIR/wf-static-type.rs:10:13
   |
LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
   |             ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`
   |
   = note: required for `Option<NotCopy>` to implement `Copy`
note: required by a bound in `IsCopy`
  --> $DIR/wf-static-type.rs:7:17
   |
LL | struct IsCopy<T:Copy> { t: T }
   |                 ^^^^ required by this bound in `IsCopy`
```
vs the prior

```
error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
  --> $DIR/wf-static-type.rs:10:13
   |
LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
   |             ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy`
   |
   = note: required for `Option<NotCopy>` to implement `Copy`
note: required by a bound in `IsCopy`
  --> $DIR/wf-static-type.rs:7:17
   |
LL | struct IsCopy<T:Copy> { t: T }
   |                 ^^^^ required by this bound in `IsCopy`
```
2024-10-29 16:26:57 +00:00
Jubilee 763fbf8a90 Rollup merge of #131697 - ShE3py:rt-arg-lifetimes, r=Amanieu
`rt::Argument`: elide lifetimes

`@rustbot` label +C-cleanup
2024-10-21 20:32:01 -07:00
Lieselotte dda3066805 Remove 'apostrophes' from rustc_parse_format 2024-10-14 23:22:51 +02:00
Lieselotte 1364631584 rt::Argument: elide lifetimes 2024-10-14 20:24:30 +02:00
Kornel 88b9edc9db fmt-debug option
Allows disabling `fmt::Debug` derive and debug formatting.
2024-08-28 23:32:40 +01:00
Esteban Küber 692bc344d5 Make parse error suggestions verbose and fix spans
Go over all structured parser suggestions and make them verbose style.

When suggesting to add or remove delimiters, turn them into multiple suggestion parts.
2024-07-12 03:02:57 +00:00
lukas 3e9c9a05a8 Mark format! with must_use hint 2024-07-06 14:24:20 +02:00
joboet 2c9556d28a fix UI test, simplify error message 2024-06-25 23:43:19 +02:00
ninad 38c4885c39 Add more test cases 2024-04-14 21:34:14 +05:30
ninad 857f5dd475 Don't inline integer literals when out of range 2024-04-14 20:17:44 +05:30
joboet 0f52cd0e71 core: get rid of USIZE_MARKER 2024-04-12 12:00:14 +02:00
Oli Scherer ae24fef028 Use TraitRef::to_string sorting in favor of TraitRef::ord, as the latter compares DefIds which we need to avoid 2024-03-27 14:02:15 +00:00
Matthias Krüger 45e005df42 Rollup merge of #122556 - jieyouxu:non-identifier-format-arg, r=petrochenkov
Extend format arg help for simple tuple index access expression

The help is only applicable for simple field access `a.b` and (with this PR) simple tuple index access expressions `a.0`.

Closes #122535.
2024-03-19 18:03:50 +01:00
Rémy Rakic f3e9dfaed6 add non-regression test for issue 122674 2024-03-18 10:01:35 +00:00
许杰友 Jieyou Xu (Joe) 52a1125036 Extend format arg help for simple tuple index access expression 2024-03-16 22:33:02 +00:00
Nilstrieb f6b4080592 Rollup merge of #121241 - reitermarkus:generic-nonzero-traits, r=dtolnay
Implement `NonZero` traits generically.

Tracking issue: https://github.com/rust-lang/rust/issues/120257

r? ````@dtolnay````
2024-02-20 15:13:52 +01:00
Vadim Petrochenkov 9f8d05f29f macro_rules: Preserve all metavariable spans in a global side table 2024-02-18 11:19:24 +03:00
Markus Reiter f12d248a6a Implement NonZero traits generically. 2024-02-17 21:58:56 +01:00
许杰友 Jieyou Xu (Joe) ec2cc761bc [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
Caio 0e9aa75bcd Move tests 2024-02-13 18:08:25 -03:00
Esteban Küber 6efddac288 Provide more context on derived obligation error primary label
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote:

```
error[E0277]: the trait bound `i32: Bar` is not satisfied
 --> f100.rs:6:6
  |
6 |     <i32 as Foo>::foo();
  |      ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo`
  |
help: this trait has no implementations, consider adding one
 --> f100.rs:2:1
  |
2 | trait Bar {}
  | ^^^^^^^^^
note: required for `i32` to implement `Foo`
 --> f100.rs:3:14
  |
3 | impl<T: Bar> Foo for T {}
  |         ---  ^^^     ^
  |         |
  |         unsatisfied trait bound introduced here
```

Fix #40120.
2024-01-30 21:28:18 +00:00
Mads Ravn 506c06636b Removing redudant note from parse error 2024-01-08 19:41:01 +01:00
Mads Ravn 5b30586ba8 Adding alignment to the list of cases to test for specific error message. Covers >, ^ and <. 2024-01-07 20:39:46 +01:00
Esteban Küber 9d846fcc11 Tweak short_ty_string to reduce number of files
When shortening types and writing them to disk, make `short_ty_string`
capable of reusing the same file, instead of writing a file per
shortened type.
2023-12-13 23:07:10 +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
Lukas Markeffsky d990eee0c8 add diagnostic for raw identifiers in format string 2023-09-06 18:55:45 +02:00
David Tolnay 823bacb6e3 Revert "Suggest using Arc on !Send/!Sync types"
This reverts commit 9de1a472b6.
2023-08-28 03:16:48 -07:00
bors e286f25ec0 Auto merge of #114507 - sebastiantoh:issue-114235, r=jackh726
Add suggestion to quote inlined format argument as string literal

Fixes #114235
2023-08-11 01:41:30 +00:00
Esteban Kuber 9de1a472b6 Suggest using Arc on !Send/!Sync types 2023-08-09 14:04:10 +00:00
Sebastian Toh d003fd9859 Add suggestion to quote inlined format argument as string literal 2023-08-05 17:29:06 +08:00
Michael Goulet a872762151 Improve error message when closing bracket interpreted as formatting fill character 2023-07-19 16:37:09 +00:00
Michael Goulet fe4d1f9fe9 Fix quotes in output 2023-07-19 16:27:28 +00:00
Michael Goulet 2c33dfea76 Don't sort strings right after we just sorted by types 2023-06-27 23:31:06 +00:00
Jubilee Young 4499daac77 Bless tests for portable-simd sync
API changes resulted in subtle MIR and impl differences
2023-05-11 12:14:57 -07:00
Vadim Petrochenkov 6f6c379ee0 rustc_middle: Fix opt_item_ident for non-local def ids 2023-05-03 20:09:10 +03:00