121 Commits

Author SHA1 Message Date
León Orell Valerian Liehr 07d015e566 Syntactically reject tuple index shorthands in struct patterns to fix a correctness regression 2026-04-23 22:28:00 +02:00
cyrgani 5bdde380cc move many tests from structs-enums to structs or enum 2026-03-28 12:38:35 +00:00
ywxt 6a0ce16654 Ignore tests for the parallel frontend 2026-03-17 17:39:59 +08:00
Esteban Küber 2e4a420db0 Explain that default field values aren't compatible with type parameters unless going through the type parameter
```
error[E0308]: mismatched types
  --> $DIR/struct-type-parameter-with-default.rs:5:12
   |
LL | struct Foo<T = String> {
   |            ---------- expected this type parameter
LL |     x: T = String::new(),
   |            ^^^^^^^^^^^^^ expected type parameter `T`, found `String`
   |
   = note: expected type parameter `T`
                      found struct `String`
   = note: the type of default fields referencing type parameters can't be assumed inside the struct defining them
```
2026-03-14 20:13:43 +00:00
Kevin Reid 072bd694ad Fix ICEs due to incomplete typechecking on struct literals with syntax errors. 2026-03-05 09:50:13 -08:00
Tony Kan 20768d802e fix(thir): Include NoneWithError in enum struct tail assertion 2026-03-04 02:11:04 -08:00
Kevin Reid f5d3b158b9 Don’t report missing fields in struct exprs with syntax errors.
This prevents spurious errors when a field is intended to be present
but a preceding syntax error caused it not to be parsed. For example,

    StructName { foo: 1 bar: 2 }

will not successfully parse a field `bar`, and we will report the syntax
error but not the missing field.
2026-02-28 20:32:20 -08:00
delta17920 158410457f renamed few tests 2026-02-04 04:45:52 +00:00
delta17920 ddd8f92c8d moved 8 tests to organized locations 2026-02-04 03:33:25 +00:00
delta17920 a7dea5504b rename various regression tests 2026-02-01 04:09:25 +00:00
delta17920 85ae47f83e moved 7 tests to organized locations 2026-01-31 06:44:24 +00:00
Esteban Küber 9750d22c17 Silence unused type param and inference errors on struct parse error 2026-01-15 21:16:48 +00:00
Kivooeo 84f2854bc3 remove fixme & update stderr files 2025-12-16 13:23:48 +00:00
Matthias Krüger b826d06771 Rollup merge of #149791 - clubby789:cfg-bool-lints, r=jdonszelmann
Remove uses of `cfg({any()/all()})`

~~This implements the followup warning suggested in https://github.com/rust-lang/rfcs/pull/3695~~
~~Lint against an empty `cfg(any/all)`, suggest the boolean literal equivalents.~~
https://github.com/rust-lang/rust/pull/149791#issuecomment-3638624348

Tracking issue: https://github.com/rust-lang/rust/issues/131204
2025-12-12 12:19:09 +01:00
Jamie Hill-Daniel c96ff2d429 Remove uses of cfg(any()/all()) 2025-12-10 23:41:19 +00:00
Esteban Küber 6cd44a472c Make typo in field and name suggestions verbose 2025-12-09 17:29:23 +00:00
xonx4l 4b000cfacd Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
Stuart Cook 06b18db01b Rollup merge of #148735 - chenyukang:yukang-fix-ice-148732, r=nnethercote
Fix ICE caused by invalid spans for shrink_file

Fixes rust-lang/rust#148732

There are two issues in this function:
1. the original issue is caused by a typo error, which is fixed in the first commit
2. another different ice(Patch span `7..7` is beyond the end of buffer `0`) will be reported after fixing the first one, is caused by spans cross file boundaries due to macro expansion. It is fixed in the second commit.

r? `@nnethercote`

edited: also fixes rust-lang/rust#148684, added a new testcase for it in the last commit.
2025-11-13 11:57:07 +11:00
yukang 4a2c9a11d5 skip invalid span in error emitter 2025-11-12 17:47:15 +08:00
yukang 725b213606 add regression test for 148684 2025-11-10 09:23:11 +08:00
León Orell Valerian Liehr c262920059 Remove #[const_trait] 2025-11-08 07:37:15 +01:00
yukang c00b4ba5ef Fix ICE caused by associated_item_def_ids on wrong type in resolve diag 2025-10-14 22:39:10 +08:00
Jacob Pratt 82bb6d523b Rollup merge of #145896 - Oneirical:uncountable-integer-10, r=jieyouxu
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#3 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-09-13 03:26:02 -04:00
Oneirical 957fa10d50 Add test batch 3 2025-09-12 14:45:12 -04:00
Matthias Krüger 47f1df5ca3 Rollup merge of #145676 - Oneirical:uncountable-integer-9, r=jieyouxu
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#2 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-08-29 12:37:30 +02:00
Oneirical 2dc4638c46 Add test batch 2 2025-08-27 15:06:05 -04:00
Oneirical 2e659f5894 Add test batch 1 2025-08-27 00:23:26 -04:00
Oneirical 75e0263af9 Rehome tests/ui/issues/ tests [5/?] 2025-08-17 13:01:02 -04:00
Esteban Küber caadc8df35 Do not ICE on private type in field of unresolved struct 2025-08-14 15:59:32 +00:00
bors 21a19c297d Auto merge of #135846 - estebank:non-exhaustive-dfv-ctor-2, r=BoxyUwU
Detect struct construction with private field in field with default

When trying to construct a struct that has a public field of a private type, suggest using `..` if that field has a default value.

```
error[E0603]: struct `Priv1` is private
  --> $DIR/non-exhaustive-ctor-2.rs:19:39
   |
LL |     let _ = S { field: (), field1: m::Priv1 {} };
   |                            ------     ^^^^^ private struct
   |                            |
   |                            while setting this field
   |
note: the struct `Priv1` is defined here
  --> $DIR/non-exhaustive-ctor-2.rs:14:4
   |
LL |    struct Priv1 {}
   |    ^^^^^^^^^^^^
help: the type `Priv1` of field `field1` is private, but you can construct the default value defined for it in `S` using `..` in the struct initializer expression
   |
LL |     let _ = S { field: (), .. };
   |                            ~~
```
2025-08-10 23:47:25 +00:00
Jacob Pratt 5bd4e832d3 Rollup merge of #144553 - Oneirical:uncountable-integer-4, r=jieyouxu
Rehome 32 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`

rust-lang/rust#143902 divided into smaller, easier to review chunks.

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-08-10 15:43:52 -04:00
Esteban Küber 464a6b1b4a Detect struct construction with private field in field with default
When trying to construct a struct that has a public field of a private type, suggest using `..` if that field has a default value.

```
error[E0603]: struct `Priv1` is private
  --> $DIR/non-exhaustive-ctor.rs:25:39
   |
LL |     let _ = S { field: (), field1: m::Priv1 {} };
   |                            ------     ^^^^^ private struct
   |                            |
   |                            while setting this field
   |
note: the struct `Priv1` is defined here
  --> $DIR/non-exhaustive-ctor.rs:14:4
   |
LL |    struct Priv1 {}
   |    ^^^^^^^^^^^^
help: the field `field1` you're trying to set has a default value, you can use `..` to use it
   |
LL |     let _ = S { field: (), .. };
   |                            ~~
```
2025-08-10 19:15:18 +00:00
Oneirical aa543963c6 Rehome tests/ui/issues/ tests [4/?] 2025-08-10 11:54:15 -04:00
Esteban Küber a17e8cfe8f Do not provide field typo suggestions for tuples and tuple structs 2025-08-07 21:39:00 +00:00
Jakub Beránek e89ae47b97 Rollup merge of #144552 - Oneirical:uncountable-integer-3, r=jieyouxu
Rehome 33 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`

rust-lang/rust#143902 divided into smaller, easier to review chunks.

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that ``@Kivooeo`` was using.

r? ``@jieyouxu``
2025-08-06 15:55:42 +02:00
Oneirical 7196d8cd66 Rehome tests/ui/issues/ tests [3/?] 2025-08-04 16:43:53 -04:00
Matthias Krüger a08ced3856 Rollup merge of #144151 - Kivooeo:issue1, r=jieyouxu
`tests/ui/issues/`: The Issues Strike Back [1/N]

I believe I’ve finally brought [my program](https://github.com/Kivooeo/test-manager) to life -- it now handles multiple test moves in one go: plain moves first, then a gentle touch on each file depends on given options. The process should be much smoother now.

Of course, I won’t rush through everything in a few days -- that would be unkind to `@Oneirical.` I’ll pace myself. And also I can't have more than one such PR because `issues.txt` will conflict with previous parts after merging them which is not fun as well.

This PR is just that: first commit - moves; second - regression comments and the occasional .stderr reblesses, also issue.txt and tidy changes. Nothing special, but progress nonetheless. This is for the purpose of preserving test file history during restructuring

Part of https://github.com/rust-lang/rust/issues/133895.

r? `@jieyouxu`
2025-07-28 08:36:51 +02:00
Kivooeo e9959aa74e comments 2025-07-25 20:38:54 +05:00
Kivooeo 9f38ca97ea move 28 tests 2025-07-25 20:38:54 +05:00
Oneirical a924d44115 Rehome tests/ui/issues/ tests [1/?] 2025-07-24 17:01:44 -04:00
Esteban Küber c375244038 Add test for default_field_values and const_default
Add a test showing `#![feature(default_field_values)]` using `#[const_trait] trait Default` (`#![feature(const_default)]` + `#![feature(const_trait_impl)]`).
2025-07-17 19:26:45 +00:00
Kivooeo bf5910d9bb cleaned up some tests 2025-06-30 11:50:19 +05:00
Kivooeo 4b6c3d923f moved & deleted some tests 2025-06-29 22:47:01 +05:00
Jieyou Xu 2dd9cc1130 Reject union default field values 2025-06-17 07:27:58 +08:00
Jieyou Xu 32c0cb0f5a Add union with default field values case test
In particular, there should be no additional errors (default field
values for `union` fields are currently erroneously accepted).
2025-06-16 17:54:13 +08: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
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
León Orell Valerian Liehr 8c37c8c3e6 Preserve generic args in suggestions for ambiguous associated items
Most notably, this preserves the `(..)` of ambiguous RTN paths.
2025-05-06 17:04:03 +02:00
Vadim Petrochenkov 20faf8532b compiletest: Make diagnostic kind mandatory on line annotations 2025-04-30 10:44:24 +03:00