67 Commits

Author SHA1 Message Date
Esteban Küber b849e10d38 Make span_suggestions always verbose
`span_suggestions` is to provide mutually exclusive suggestions. When it was introduced, we made its behavior be that if a single suggestion is given to it, we present the suggestion inline, otherwise in patch format. Changing this to make all of its uses be verbose, as that is closer in intent of output.
2026-04-15 01:38:14 +00:00
ywxt 6a0ce16654 Ignore tests for the parallel frontend 2026-03-17 17:39:59 +08:00
Kivooeo 919fd6b64c add new unstable flag for minimal recursion 2026-03-12 20:48:26 +00:00
Redddy e63664773c Move some ui tests
* Move dyn-drop to dyn-keyword
* Reorganize `tests/ui/empty` into specific dirs

remove tests/ui/empty/empty-linkname.rs duplicate of tests/ui/error-codes/E0454.rs
* Move `missing-trait-bounds` to `trait-bound/missing-trait-bounds`
* bless traits/missing-trait-bounds tests
* Move `recursion_limit` to `recursion/recursion_limit`
* Move `version` to `compile-flags`
2026-03-09 09:11:06 +00:00
Daniel Smith 291d0a9a4b diagnostics: make implicit Sized bounds explicit in E0277
When a trait parameter depends upon Sized, the error message only
referred to the full trait itself and didn't mention Sized. This makes
the failure to implement Sized explicit. It also notes when the Sized
trait bound is explicit or implicit.
2026-01-08 16:07:18 -05:00
xonx4l 4b000cfacd Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
reddevilmidzy d3e4dd29a8 Use let...else consistently in user-facing diagnostics 2025-11-24 11:41:52 +09:00
Ben Kimock 9cbfbb164e Accept trivial consts based on trivial consts 2025-10-27 13:36:57 -04:00
Oneirical 75e0263af9 Rehome tests/ui/issues/ tests [5/?] 2025-08-17 13:01:02 -04:00
Trevor Gross f5dda19775 Rollup merge of #144039 - estebank:short-paths, r=fee1-dead
Use `tcx.short_string()` in more diagnostics

`TyCtxt::short_string` ensures that user visible type paths aren't overwhelming on the terminal output, and properly saves the long name to disk as a side-channel. We already use these throughout the compiler and have been using them as needed when users find cases where the output is verbose. This is a proactive search of some cases to use `short_string`.

We add support for shortening the path of "trait path only".

Every manual use of `short_string` is a bright marker that that error should be using structured diagnostics instead (as they have proper handling of long types without the maintainer having to think abou tthem).
2025-08-08 14:22:43 -05:00
Esteban Küber 99196657fc Use tcx.short_string() in more diagnostics
`TyCtxt::short_string` ensures that user visible type paths aren't overwhelming on the terminal output, and properly saves the long name to disk as a side-channel. We already use these throughout the compiler and have been using them as needed when users find cases where the output is verbose. This is a proactive search of some cases to use `short_string`.

We add support for shortening the path of "trait path only".

Every manual use of `short_string` is a bright marker that that error should be using structured diagnostics instead (as they have proper handling of long types without the maintainer having to think abou tthem).

When we don't actually print out a shortened type we don't need the "use `--verbose`" note.

On E0599 show type identity to avoid expanding the receiver's generic parameters.

Unify wording on `long_ty_path` everywhere.
2025-08-07 21:18:00 +00:00
Esteban Küber 025fbe8f69 Add support for shortening Instance and use it
Replace ad-hoc type path shortening logic for recursive mono instantiation errors to use `tcx.short_string()` instead.
2025-08-06 22:21:49 +00:00
Oneirical a924d44115 Rehome tests/ui/issues/ tests [1/?] 2025-07-24 17:01:44 -04:00
Kivooeo 98934707eb cleaned up some tests
Additionally, remove unused `tests/ui/auxiliary/svh-*` crates that are duplicates of `tests/ui/svh/auxiliary/svh-*`.
2025-07-13 00:03:31 +05:00
Kivooeo 47b8a32ca3 moved tests 2025-07-13 00:03:31 +05:00
Ralf Jung ed4f01ed2e const-eval: error when initializing a static writes to that static 2025-06-27 14:39:35 +02:00
Ralf Jung 17946c22b1 const-eval error: always say in which item the error occurred
also adjust the wording a little so that we don't say "the error occurred here" for two different spans
2025-06-07 13:42:30 +02:00
Matthias Krüger be2d382158 Rollup merge of #141960 - ferrocene:lw/2015-paths2, r=compiler-errors
Use non-2015 edition paths in tests that do not test for their resolution

This allows for testing these tests on editions other than 2015

Follow up to https://github.com/rust-lang/rust/pull/141888
2025-06-04 19:50:21 +02:00
Lukas Wirth eae7fe1bdb Use non-2015 edition paths in tests that do not test for their resolution
This allows for testing these tests on editions other than 2015
2025-06-03 13:35:31 +02:00
Oli Scherer 020216c31c Clarify why we are talking about a failed const eval at a random place 2025-06-02 15:37:15 +00:00
Oli Scherer b331b8b96d Use the informative error as the main const eval error message 2025-06-02 15:37:15 +00:00
reddevilmidzy dd2d6b222b Cleaned up 5 tests in tests/ui 2025-04-21 16:16:38 +09:00
许杰友 Jieyou Xu (Joe) 83429144fc tests: remove explicit long type filename hash normalization from some ui tests 2025-03-04 00:21:02 +08:00
Rémy Rakic 4fcae667d6 normalize long-type.txt in tests
this allows compare-mode to share the same subdirectory and removes
differences due to that
2025-01-30 17:10:19 +00:00
León Orell Valerian Liehr 0b18b4fbbc Remove all dead files inside tests/ui/ 2025-01-27 02:28:04 +01:00
Zalathar 835fbcbcab Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
Rémy Rakic 91cf0cb729 bless test expectations
(in a separate commit for easier review, one of them is huge)
2024-12-08 20:21:46 +00:00
Rémy Rakic 95a1351c4a mark previously hanging tests as good to go 2024-12-08 20:21:46 +00:00
Ben Kimock 711c8cc690 Remove polymorphization 2024-12-06 16:42:09 -05:00
许杰友 Jieyou Xu (Joe) 95ff642797 tests: remove //@ pretty-expanded usages
Done with

```bash
sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs
```

and

```
sd '//@pretty-expanded.*\n' '' tests/ui/**/*.rs
```
2024-11-26 02:50:48 +08:00
Chris Krycho d4275e08e7 Update tests for new TRPL chapter order 2024-11-23 08:57:25 -07:00
Esteban Küber dceb3fc9fa Tweak E0320 overflow error wording
Surrount type with backticks as we should in every error.
2024-11-05 21:54:45 +00: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
Michael Goulet 938ed369ad Gate the type length limit check behind a nightly flag 2024-07-12 21:16:09 -04:00
Michael Goulet 0f7f3f4045 Re-implement a type-size based limit 2024-07-02 15:48:48 -04:00
Caio 3aaa3941fd Move some tests 2024-04-21 15:43:43 -03:00
Caio ab8994d93e Move tests 2024-04-07 17:38:07 -03:00
许杰友 Jieyou Xu (Joe) ec2cc761bc [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
Oli Scherer 73b38c661d Do not allocate a second "background" alloc id for the main allocation of a static.
Instead we re-use the static's alloc id within the interpreter for its initializer to refer to the `Allocation` that only exists within the interpreter.
2024-02-15 10:25:18 +00:00
Oli Scherer e2386270df Return ConstAllocation from eval_static_initializer query directly 2024-02-15 10:25:18 +00:00
Oli Scherer 95004e5ae2 Add new query just for static initializers 2024-02-15 10:25:18 +00: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
Oli Scherer 867831a170 Always use RevealAll for const eval queries 2024-01-19 11:32:34 +00:00
Michael Goulet e1c03e9bda Adjust the ignore-compare-mode-next-solver for hangs 2023-12-18 23:55:47 +00:00
Nilstrieb 9b80d85722 Manual find replace updates 2023-11-24 21:04:51 +01: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
Ralf Jung c4ec12f4b7 adjust how closure/generator types and rvalues are printed 2023-09-21 22:20:58 +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
Esteban Kuber 9de1a472b6 Suggest using Arc on !Send/!Sync types 2023-08-09 14:04:10 +00:00
bors bd1ae282f1 Auto merge of #113893 - mdibaiee:type-name-spill-flag, r=compiler-errors
new unstable option: -Zwrite-long-types-to-disk

This option guards the logic of writing long type names in files and instead using short forms in error messages in rustc_middle/ty/error behind a flag. The main motivation for this change is to disable this behaviour when running ui tests.

This logic can be triggered by running tests in a directory that has a long enough path, e.g. /my/very-long-path/where/rust-codebase/exists/

This means ui tests can fail depending on how long the path to their file is.

Some ui tests actually rely on this behaviour for their assertions, so for those we enable the flag manually.
2023-07-26 00:46:06 +00:00