Commit Graph

111 Commits

Author SHA1 Message Date
Jonathan Brouwer fe6816491f Rollup merge of #153801 - ywxt:parallel-test, r=petrochenkov
Add the option to run UI tests with the parallel frontend

This PR adds two arguments for tests:

1. `--parallel-frontend-threads`: specify `-Zthread` to compile test case (currently UI tests only)
2. `--iteration-count`: the number of times to run each test

Also, due to the non-deterministic diagnostic orders and cycle errors, this PR adds the directive `//@ ignore-parallel-frontend` to ignore tests with cycle error when the parallel-frontend is enabled (by `--parallel-frontend-threads`) and enables `//@ compare-output-by-lines` by default.

Context: [#t-compiler/parallel-rustc > Add the parallel front-end test suite @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/Add.20the.20parallel.20front-end.20test.20suite/near/578781369)

This PR should work with https://github.com/rust-lang/rust/pull/153797 together.
2026-03-17 17:51:29 +01:00
ywxt 6a0ce16654 Ignore tests for the parallel frontend 2026-03-17 17:39:59 +08:00
Stuart Cook 1c3429f136 Rollup merge of #153738 - fmease:dyn-ace-gingerly-care, r=BoxyUwU
Don't look for non-type-level assoc consts when checking trait object types

On main, when looking for assoc items that weren't specified in a given trait object type (via binding), we comb through all (eligible) assoc consts whether type-level or not even though you're not allowed to bind non-type-level assoc consts.

That's usually fine because traits containing (eligible) non-type-level assoc consts are dyn incompatible, so the trait object type is ~already considered ill-formed. Therefore, in PR rust-lang/rust#150843, I saved myself the extra effort, esp. since back then it was more annoying to check if the const item was declared type-level.

<sub>(More concretely: In bodies, we check for all dyn compatibility violations when lowering the trait object type, so we will bail out early with an error; in contrast, item signatures / non-bodies get wfchecked (`WellFormed` obligation) after lowering which includes dyn compatiblity checking (`DynCompatible` obligation); however to reduce the amount of diags, during lowering if there are any unspecified assoc items, we'll check them for dyn compatibility and bail out early if any of them tests negative.)</sub>

Now, we obviously don't wfcheck the defsite of (eager) type aliases which breaks the assumption that such trait object types get rejected. This led to the regression found in rust-lang/rust#153731: The ill-formed trait object type doesn't get rejected (as is expected) but we now require the single (non-type-level) assoc const to be bound in the dyn-Trait which we didn't do before. The actual error talks about dyn incompatibility due to the aforementioned extra check that's usually there to contain the number of diags.

Fixes [after beta backport] rust-lang/rust#153731.
2026-03-17 15:53:11 +11:00
León Orell Valerian Liehr f8bce56b39 Don't look for non-type-level assoc consts when checking trait object types 2026-03-17 01:52:28 +01:00
Esteban Küber 87d8f5885b Provide more context on type errors in const context
- On `const` and `static` point at the type (like we do for let bindings)
- On fn calls, point at const parameter in fn definition
- On type, point at const parameter in type definition
- On array type lengths, explain that array length is always `usize`
- On enum variant discriminant, mention `repr`
2026-03-14 20:13:43 +00:00
John Kåre Alsaker fed57899b9 Remove value_from_cycle_error specialization for type_of 2026-03-13 18:52:26 +01:00
Shoyu Vanilla 5f3bdde8e4 Check for region dependent goals on type_op itself as well 2026-03-04 00:02:05 +09:00
reddevilmidzy 8af02e230a mGCA: Validate const literal against expected type
Co-authored-by: Boxy <rust@boxyuwu.dev>
2026-02-14 04:12:40 +00:00
León Orell Valerian Liehr 8d524f096d mGCA: Make traits with type assoc consts dyn compatible...
...but require all assoc consts to be specified via bindings.
2026-01-21 12:53:44 +01:00
mu001999 af76a2456d MGCA: Support tuple expressions as direct const arguments 2026-01-07 08:44:23 +08:00
Rémy Rakic cdf43ad5ef add test from modcholesky breakage 2025-12-10 14:47:49 +00:00
xonx4l 4b000cfacd Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
Christian Poveda b2ab7cf980 Gate 2015 UI tests 2025-11-27 11:19:00 -05:00
Esteban Küber eeadffd926 When more than a single impl and less than 4 could apply, point at them
```
error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
  --> $DIR/issue-67185-2.rs:21:6
   |
LL | impl Foo for FooImpl {}
   |      ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
   |
help: the following other types implement trait `Bar`
  --> $DIR/issue-67185-2.rs:9:1
   |
LL | impl Bar for [u16; 4] {}
   | ^^^^^^^^^^^^^^^^^^^^^ `[u16; 4]`
LL | impl Bar for [[u16; 3]; 3] {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `[[u16; 3]; 3]`
note: required by a bound in `Foo`
  --> $DIR/issue-67185-2.rs:14:30
   |
LL | trait Foo
   |       --- required by a bound in this trait
LL | where
LL |     [<u8 as Baz>::Quaks; 2]: Bar,
   |                              ^^^ required by this bound in `Foo`
```
2025-10-31 20:44:01 +00:00
Cameron Steffen 3bdf45f7db Mark range expr with desugaring 2025-10-21 10:04:34 -05:00
Esteban Küber 4973903cd2 reword note 2025-09-28 20:55:35 +00:00
Esteban Küber 7a0319f01d Point at lifetime requirement origin in more cases 2025-09-28 20:55:34 +00:00
Esteban Küber 049c32797b On E0277, point at type that doesn't implement bound
When encountering an unmet trait bound, point at local type that doesn't implement the trait:

```
error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied
  --> $DIR/issue-64855.rs:9:19
   |
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
   |                   ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
   |
help: the trait `Foo` is not implemented for `Bar<T>`
  --> $DIR/issue-64855.rs:9:1
   |
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
   | ^^^^^^^^^^^^^^^^^
```
2025-08-22 17:55:15 +00:00
Karol Zwolak d14b83e378 bless tests with new lint messages 2025-08-19 21:27:10 +02:00
Rémy Rakic f4094ea252 update test expectations for boring locals + dropckoutlives interactions
The suboptimal error only appears with NLLs due to liveness differences
where polonius cannot have as many boring locals. Sometimes this causes
NLLs to emit a duplicate error as well.
2025-08-08 14:10:41 +00:00
León Orell Valerian Liehr 02ea38cfff Fortify generic param default checks 2025-08-06 01:26:26 +02:00
Camille GILLOT 7c6496145f Check statics' type in type_of. 2025-07-25 23:39:26 +00:00
dianne 41e6f767b6 future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
Oli Scherer 6166cd6b50 Avoid looking at HIR for trait and impl items 2025-06-30 08:45:43 +00:00
Oli Scherer 9b5d57d0a9 Unconditionally run check_item_type on all items 2025-06-30 08:06:08 +00:00
Oli Scherer 1d41c2c01c Merge unboxed trait object error suggestion into regular dyn incompat error 2025-06-13 13:54:06 +00:00
Lukas Wirth 2549962c63 Add missing dyn keywords to tests that do not test for them 2025-06-05 09:41:58 +02:00
Oli Scherer 3fff727e87 Use more detailed spans in dyn compat errors within bodies 2025-05-27 08:18:11 +00:00
Michael Goulet 12d3021ef0 Deeply normalize in the new solver in WF 2025-05-05 15:52:38 +00:00
Vadim Petrochenkov 20faf8532b compiletest: Make diagnostic kind mandatory on line annotations 2025-04-30 10:44:24 +03:00
Vadim Petrochenkov b3f75353a2 UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
Bennet Bleßmann 7dd57f085c update/bless tests 2025-04-06 21:41:47 +02:00
Michael Goulet 0baee2432a Don't typeck during WF, instead check outside of WF in check_crate 2025-03-03 23:09:42 +00:00
Boxy df5b279ca9 Introduce feature(generic_const_parameter_types) 2025-02-28 20:43:15 +00:00
Michael Goulet f3d31f77e4 Remove dyn_compatible_for_dispatch 2025-02-24 18:48:40 +00:00
Matthew Jasper 87e5969572 Update tests for dropck normalization errors
Takes crash tests from #135039, #103899, #91985 and #105299 and turns them into ui tests
2025-02-17 11:33:07 +00: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
DuskyElf 2431977ecf Rename and Move some UI tests to more suitable subdirs 2025-02-04 17:02:37 +05:30
Matthias Krüger 3c4b9122ec Rollup merge of #135900 - compiler-errors:derive-wf, r=lcnr
Manually walk into WF obligations in `BestObligation` proof tree visitor

When we encounter a `WellFormed` obligation in the `BestObligation` proof tree visitor, ignore the proof tree and call `wf::unnormalized_obligations` to derive well-formed obligations with the correct cause codes. This is to avoid having to replicate the somewhat delicate logic that `wf.rs` does to set up its obligation causes... Don't see a better way to do this.

vibes?? r? lcnr
2025-02-01 01:19:19 +01:00
Michael Goulet 304b3cfcb2 Manually walk into WF obligations in BestObligation proof tree visitor 2025-01-31 18:21:58 +00:00
Matthias Krüger 308ea7120b Rollup merge of #135860 - fmease:compiler-mv-obj-save-dyn-compat-ii, r=jieyouxu
Compiler: Finalize dyn compatibility renaming

Update the Reference link to use the new URL fragment from https://github.com/rust-lang/reference/pull/1666 (this change has finally hit stable). Fixes a FIXME.

Follow-up to #130826.
Part of #130852.

~~Blocking it on #133372.~~ (merged)

r? ghost
2025-01-31 12:28:15 +01:00
lcnr fa6b95fc4e update comment 2025-01-30 11:56:29 +01:00
León Orell Valerian Liehr 57b5d3af62 Compiler: Finalize dyn compatibility renaming 2025-01-26 21:20:31 +01:00
Matthias Krüger 318466aec0 Rollup merge of #135866 - BoxyUwU:dont_pick_fnptr_nested_goals, r=lcnr
Don't pick `T: FnPtr` nested goals as the leaf goal in diagnostics for new solver

r? `@lcnr`

See `tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.rs` for a minimized example of what code this affects the diagnostics off. The output of running nightly `-Znext-solver` on that test is the following:
```
error[E0277]: the trait bound `Foo: Trait` is not satisfied
  --> src/lib.rs:14:20
   |
14 |     requires_trait(Foo);
   |     -------------- ^^^ the trait `FnPtr` is not implemented for `Foo`
   |     |
   |     required by a bound introduced by this call
   |
note: required for `Foo` to implement `Trait`
  --> src/lib.rs:7:16
   |
7  | impl<T: FnPtr> Trait for T {}
   |         -----  ^^^^^     ^
   |         |
   |         unsatisfied trait bound introduced here
note: required by a bound in `requires_trait`
  --> src/lib.rs:11:22
   |
11 | fn requires_trait<T: Trait>(_: T) {}
   |                      ^^^^^ required by this bound in `requires_trait`
```

Part of rust-lang/trait-system-refactor-initiative#148
2025-01-22 19:29:43 +01:00
Taylor Cramer d00d4dfe0d Refactor dyn-compatibility error and suggestions
This CL makes a number of small changes to dyn compatibility errors:
- "object safety" has been renamed to "dyn-compatibility" throughout
- "Convert to enum" suggestions are no longer generated when there
  exists a type-generic impl of the trait or an impl for `dyn OtherTrait`
- Several error messages are reorganized for user readability

Additionally, the dyn compatibility error creation code has been
split out into functions.

cc #132713
cc #133267
2025-01-22 09:20:57 -08:00
Boxy 3ef506fb4d Don't pick T: FnPtr nested goals 2025-01-22 06:55:38 +00:00
yukang 865a09d50a remove unnecessary assertion for reference error 2025-01-17 15:41:05 +08:00
Esteban Küber 3f2a63a68b Use trait name instead of full constraint in suggestion message
```
help: consider restricting type parameter `T` with traits `Copy` and `Trait`
   |
LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) {
   |                      ++++++++++++++
```

```
help: consider restricting type parameter `V` with trait `Copy`
   |
LL | fn index<'a, K, V: std::marker::Copy>(map: &'a HashMap<K, V>, k: K) -> &'a V {
   |                  +++++++++++++++++++
```
2024-12-07 21:29:58 +00:00
Esteban Küber d13c34828e reword trait bound suggestion message to include the bounds 2024-12-07 21:26:20 +00:00
Oli Scherer cb72b9bb37 Silence follow-up errors from lit_to_const 2024-12-06 10:50:20 +00:00