Commit Graph

208 Commits

Author SHA1 Message Date
Shoyu Vanilla
e50bdff7cb Bless tests 2026-08-10 10:05:45 +02:00
Jonathan Brouwer
6405791147 Rollup merge of #160176 - zedddie:gsoc-batch-final-meow, r=Kivooeo
No more `tests/ui/issues`!

Part of [GSoC'26 project](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Reorganizing.20tests.2Fui.2Fissues)

r? Kivooeo
@Teapot4195
2026-08-04 18:35:36 +02:00
Nia Deckers
4af1e41c24 Make #[fundamental] only apply to the first argument of Box
* fundamental only on first arg
* woo this made error messages nicer
* oh the test was misnamed lol
* special case only box
* rename tests

Co-authored-by: Nia Deckers <nia-e@haecceity.cc>
2026-07-31 15:31:27 +00:00
zedddie
a8df024fbf bless last batch :3 2026-07-29 17:52:50 +02:00
zedddie
b74fc34a77 move last batch :3 2026-07-29 14:05:05 +02:00
Jacob Pratt
ab0ec83890 Rollup merge of #159531 - zedddie:gsoc-batch-28-meow, r=Kivooeo
Reorganize `tests/ui/issues` [28/N]

Part of [GSoC'26 project](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Reorganizing.20tests.2Fui.2Fissues)

r? Kivooeo
@Teapot4195
2026-07-23 19:18:41 -04:00
Jacob Pratt
445d6002a8 Rollup merge of #159412 - zedddie:gsoc-batch-26-meow, r=Kivooeo
Reorganize `tests/ui/issues` [26/N]

Part of [GSoC'26 project](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Reorganizing.20tests.2Fui.2Fissues)

r? Kivooeo
@Teapot4195
2026-07-23 19:18:34 -04:00
zedddie
cd9fd520d9 bless batch 2026-07-23 19:57:43 +02:00
zedddie
6d6092cd52 bless batch 2026-07-18 18:57:06 +02:00
zedddie
377748d283 move batch 2026-07-18 01:28:15 +02:00
zedddie
75870305c3 move batch 2026-07-16 23:51:04 +02:00
Jonathan Brouwer
d55ab96dac Rollup merge of #158758 - josetorrs:rename-lazy-type-alias, r=lcnr
Rename `lazy_type_alias` feature gate to `checked_type_aliases`

there's not an open issue for it, though happy to create one if desired, but [this](https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/ask.20for.20help.3A.20rename.20.60lazy_type_alias.60.20feature/near/608089932) is the zulip thread. basically just did a cmd+shift+F on VSCode

r? @lcnr

cc: @BoxyUwU
2026-07-16 21:01:48 +02:00
Jose Torres
526787dbbc rename from lazy_type_alias to checked_type_aliases
Co-authored-by: lcnr <rust@lcnr.de>
2026-07-15 11:50:42 -04:00
zedddie
0b38c4508c bless batch 2026-07-14 23:21:50 +02:00
zedddie
827474f3b7 move batch 2026-07-14 21:47:59 +02:00
zedddie
082ff2fc20 bless batch 2026-07-05 21:27:38 +02:00
zedddie
dabab4f18e move batch 2026-07-05 20:49:31 +02:00
Jonathan Brouwer
0676d2efb9 Revert "Rollup merge of #157702 - oli-obk:having-fun-with-expansion-info, r=davidtwco,estebank"
This reverts commit 18509d2489, reversing
changes made to bf0dfb606b.
2026-06-19 10:45:44 +02:00
bors
9e2abe0c6a Auto merge of #157991 - JonathanBrouwer:rollup-vlRn7Dc, r=JonathanBrouwer
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#156538 (Refactor `AliasTy`. `AliasTerm` & `UnevaluatedConst` to use `Alias`)
 - rust-lang/rust#156807 (Add `T: PartialEq` bounds to derived `StructuralPartialEq` impls.)
 - rust-lang/rust#156950 (Staticlib rename internal symbols)
 - rust-lang/rust#156983 (Add `io::Read::read_le` and `io::Read::read_be`)
 - rust-lang/rust#157306 (tests: codegen-llvm: Expect the new mangling scheme in bpf-abi-indirect-return)
 - rust-lang/rust#157702 (Add expansion info to implied bounds)
 - rust-lang/rust#155616 (constify `TryFrom<Vec>` for array)
 - rust-lang/rust#156226 (diagnostics: point to coroutine body on higher-ranked auto trait errors)
 - rust-lang/rust#157870 (std: sys: solid: clamp connect_timeout tv_sec instead of truncating)
 - rust-lang/rust#157952 (Configure Renovate for GitHub Actions)
 - rust-lang/rust#157953 (fix(rustc_codegen_ssa): Use cg_operand for Freeze check)
 - rust-lang/rust#157958 (doc: Document `-Zlint-rust-version`)
 - rust-lang/rust#157974 (Rename `errors.rs` file to `diagnostics.rs` (11/N))
2026-06-16 20:25:59 +00:00
Jonathan Brouwer
18509d2489 Rollup merge of #157702 - oli-obk:having-fun-with-expansion-info, r=davidtwco,estebank
Add expansion info to implied bounds

r? @estebank maybe?

cc @davidtwco for implied bound diagnostics

We used to have various fun ways for testing whether a `Sized` bound was implicit or not (usually by checking if the span was equal to the span of a generic parameter). That felt a bit hacky, so I checked what happens if we explicitly mark the span as being desugared. Turns out a lot of diagnostics break. You can see in the diff where I changed things to make them work again.

Then it became clear that we were missing out on various other implied bound sites, and we just got all of them basically for free now.

I think there are various other good refactorings we can do (probably not special casing `Sized` and not special casing implied bound desugarings, but just reporting all desugarings), but for now this PR is in a state where I'd rather merge it than add more to it
2026-06-16 22:11:04 +02:00
bors
c712ea9462 Auto merge of #156619 - ShoyuVanilla:less-normalizes-to-jank, r=lcnr
`-Znext-solver` Less normalizes-to janks



cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/223#issuecomment-4388459499

r? lcnr
2026-06-16 17:00:26 +00:00
James Barford-Evans
30e608d1fe Update tests to reflect Alias changes 2026-06-16 10:11:17 +01:00
Oli Scherer
d3c8318ff2 Add expansion info to default bounds 2026-06-16 10:41:29 +02:00
León Orell Valerian Liehr
2fda23312d Slightly tweak the diagnostic for uncovered type parameters
The diagnostic is generally very noisy.
This commit tries to make it slightly less cluttered and more legible by

1. stopping to reuse the lengthy primary message as the primary label.
   This duplication didn't increase the information content and only
   turned the diagnostic into a letter and symbol soup.
   Instead, we now pick a succinct label ("uncovered type parameter")
   that immediately(!) signals to the users in red what is wrong with
   the highlighted type parameter.
2. breaking some information-dense notes into multiple lines.

Finally, this rephrases the slightly awkward and confusing
"type parameter […] must be used as a type parameter for […] type" to
"type parameter […] must be used as an argument to […] type".
2026-06-14 11:44:15 +02:00
León Orell Valerian Liehr
5c850e6407 Deduplicate diagnostic impl of an orphanck error+lint
Moreover, don't add the error code to the lint warning(!).
While helpful, it's quite unconventional.
2026-06-14 11:44:14 +02:00
Shoyu Vanilla
61f80759a1 Bless tests 2026-06-14 04:02:35 +09:00
bors
4e391cf242 Auto merge of #157617 - Shourya742:2026-06-08-donot-eagerly-normalize-alias-during-coherence, r=lcnr
Do not eagerly normalize alias during coherence

closes: rust-lang/rust#157407

r? @lcnr
2026-06-12 23:56:07 +00:00
bit-aloo
063fdc0aa1 updating other test error types 2026-06-11 06:31:12 +05:30
Esteban Küber
2c7186a725 Reduce verbosity of cycle errors when possible
When pointing at each step of cycle errors, do not include the code snippet when the note points at the same place as the previous one (by setting the note's span to DUMMY_SP).
2026-06-04 16:10:12 +00:00
Adwin White
1c1372c908 bless diagnostics change 2026-05-02 21:07:23 +08:00
SynapLink
b19b0e5629 tests: mark simple UI tests as check-pass 2026-04-28 23:10:46 +02:00
Waffle Lapkin
59be02e594 bless ui tests 2026-04-21 12:28:25 +02:00
Jacob Pratt
9eb03e5bd2 Rollup merge of #150316 - ShoyuVanilla:fudge-checks, r=lcnr
Do not use non-wf input expectations from fudge when checking function calls

cc https://github.com/rust-lang/rust/issues/149379

r? lcnr

# FCP: Do not use non-wf input expectations from fudge when checking function calls

## What is fudging?

71e00273c0/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs (L168-L170)

Consider this coercion site:

`let _: Box<dyn Fn(&str) -> usize> = Box::new(|s| s.len());`

We rely on the expectation to eagerly infer the type of `s` to be `&str`. However, `dyn Fn(&str) -> usize` is not a valid type as the argument of `Box::new`, as it is not `Sized`.

*Fudging* is the mechanism we use to propagate the expectation through the `Box::new` call without constraining its generic parameter.

Fudging computes the expected argument types by acting as if we're able to propagate the expected return type directly through the function, without any coercions on the return site.

Given that we may actually want to coerce afterwards, we cannot actually commit any constraints here. We therefore compute the expectations for the function arguments in a `probe` and rely on *fudging* to be able to name any inference variables created inside of the probe.

After the fudging step, we weaken the resulting expectation if it is an unsized type in the following lines:
71e00273c0/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs (L354)
71e00273c0/compiler/rustc_hir_typeck/src/expectation.rs (L77-L89)

Because function arguments must be `Sized`, this weakening prevents us from applying wrong, unsized coercions to them.

## How fudging currently goes wrong

We have an opened issue for tracking such cases: https://github.com/rust-lang/rust/issues/149379.

Broadly, the failures seem to fall into two buckets.

### We may end up with non–well-formed expectations

Fudging can produce an expected type that is not well-formed.

That would eventually result in an error failing the well-formedness check, either when we do the coercion with the expected argument types, or when we select the remaining obligations.

```rust
fn foo<T>(x: (T, ())) -> Box<T> {
    Box::new(x.0)
}

fn main() {
    // We use `(dyn Send, ())` as the expectation the argument.
    let _: Box<dyn Send> = foo(((), ()));
}
```

### Weakening fudged expectation is not covering all the cases

```rust
fn field_to_box<T>(x: &(T,)) -> &T {
    &x.0
}
fn main() {
    // `Expectation::rvalue_hint` only checks whether the whole argument
    // itself is `Sized`. It does not check whether the function requires
    // its generic parameters to be `Sized`.
    let _: &dyn Send = field_to_box(&(1,));
}
```

## What this PR fixes

### One of the problematic cases of the issue

This PR fixes the first case, by simply checking well-formedness of the each expected argument types inside the fudge scope.

This is a reasonable change because:
- Non well-formed expectation would result in a well-formedness error so not using such expectation wouldn't make any previously compiled code being not compiled anymore
- Dropping a non well-formed expectation does not mean we stop providing expectations for argument coercions altogether.
  If fudging fails, we still fall back to using the types from the function signature as expectations in the usual path:
  71e00273c0/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs (L330-L336)

#### Related tests

- Fixes [tests/ui/coercion/fudge-inference/fn-ret-trait-object-propagated-to-inputs-issue-149379-1.rs](5668ad597d (diff-1468a6d8495f7adfb4a64508f002bb934c13d13871662de6efd60433649401fd))

### Limited for `-Znext-solver`

Separately (and not directly tied to the above issue), this PR also fixes a next-solver regression tracked at: https://github.com/rust-lang/trait-system-refactor-initiative/issues/259.

That regression was introduced by https://github.com/rust-lang/rust/pull/149320, which started normalizing expected function input types inside the fudge scope.
Because all inference-variable relationships and pending obligations are dropped out when we exit the fudge scope, we drop the ambiguous goal used to normalize, leaving us with an unconstrained inference variable in the expectation.

This PR fixes that by normalizing the expectation outside the fudge scope, so the resulting normalization obligations are preserved to the `InferCtxt`'s `ObligationCtxt`.

#### Related tests

- Fixes [tests/ui/traits/next-solver/fudge-inference/do-not-drop-ambig-normalization.rs](https://github.com/rust-lang/rust/pull/150316/files#diff-42e97f178fbdee7c3405ae12409eb0bca4eec92488971c703b26c083eadf728a)

## Does this PR break anything

I don't think there should be any breakage affecting the old solver.

The separate expectation normalization change only affecting the new solver does break an existing [test](https://github.com/rust-lang/rust/pull/150316/files#diff-3b946a09e063aad2a4fa6b0893508d5ffab78763b8465abfe1f689d349fda815).
This is unfortunate but I think this change should be done because

- The broken test also doesn't compile with the old solver
- The expectation normalization change is necessary to compile stuff supported on stable

## What this PR doesn't fix

This PR doesn't fix the second case -- *Weakening fudged expectation is not covering all the cases*.

@lcnr has [suggested](https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/expectations.20from.20fudging.20are.20a.20mess.20.23149379/near/560625205) the following solution for that problem:
> check whether a function where-bound errors without an out coercion, if so, weaken the expectation to `ExpectRvalueLikeUnsized`

I experimented with this and it works well in many cases.
However, on the old solver, checking where-bounds cannot reliably be treated as speculative: if we hit an overflow while checking the where-bounds, the old solver can fail the entire compilation rather than merely treating the check as failed and relaxing the expectation.

Since this second class of issues affects both the old solver and the next-solver, it seems preferable to keep the conservative behavior for now, at least until the next-solver is stabilized, rather than introducing a next-solver-only relaxation that might create new regressions and complicate stabilization efforts.

#### Related tests

- Does NOT Fix [tests/ui/coercion/fudge-inference/expectated-input-not-satisfying-fn-bounds-issue-89299.rs](https://github.com/rust-lang/rust/pull/150316/files#diff-fdcfa8ab660c052dbe246db279d167ea8a309bfe10ca6163f7fa1836be2b30d6)
- Does NOT Fix [tests/ui/coercion/fudge-inference/expectated-input-not-satisfying-fn-bounds-issue-149881.rs](https://github.com/rust-lang/rust/pull/150316/files#diff-1ccbb181cbf164841ca5af350ecf903c802a4854bda309e83e91c3b917809a55)
- Does NOT Fix [tests/ui/coercion/fudge-inference/fn-ret-trait-object-propagated-to-inputs-issue-149379-3.rs](https://github.com/rust-lang/rust/pull/150316/files#diff-b12e01cc3c265db42f135d67425d8b2bd0d9c44c680b3e8c49d1f845a0b25d09)
2026-04-08 23:03:56 -04:00
Jacob Adam
e27378ca2b Add a test with a negative impl that used to fail to pass coherence but now does 2026-04-04 17:59:54 +01:00
bors
009a6c1e8b Auto merge of #154308 - ShoyuVanilla:undo-fudge-iv, r=jieyouxu
Revert #151380 and #153869

cc https://rust-lang.zulipchat.com/#narrow/channel/474880-t-compiler.2Fbackports/topic/.23153869.3A.20beta-nominated/with/581306395

r? ghost
2026-04-02 00:09:59 +00:00
lcnr
94e58c0979 fix fudging 2026-04-02 00:07:01 +09:00
khyperia
75eeece98c Properly generalize unevaluated consts 2026-03-30 15:47:49 +02:00
Takayuki Maeda
08e064a9cb add regression test for 154189
fix ci errors
2026-03-25 17:39:17 +09:00
Shoyu Vanilla
d5bbeb978e Revert "Auto merge of #151380 - ShoyuVanilla:shallow-resolve-to-root-var, r=lcnr"
This reverts commit 75b9d89c68, reversing
changes made to 7bee525095.
2026-03-24 22:31:37 +09:00
cyrgani
9b0be7857a allow incomplete_features in most UI tests 2026-03-21 20:10:07 +00:00
Guillaume Gomez
4e2a519d12 Remove TyCtxt::node_span_lint usage from rustc_trait_selection 2026-03-09 11:35:33 +01:00
Guillaume Gomez
b8677e22a5 Migrate rustc_hir_analysis to use TyCtxt::emit_diag_node_span_lint 2026-02-23 11:56:45 +01:00
Esteban Küber
c73b3d20c6 Unify wording of resolve error
Remove "failed to resolve" and use the same format we use in other resolution errors "cannot find `name`".

```
error[E0433]: cannot find `nonexistent` in `existent`
  --> $DIR/custom_attr_multisegment_error.rs:5:13
   |
LL | #[existent::nonexistent]
   |             ^^^^^^^^^^^ could not find `nonexistent` in `existent`
```
2026-02-17 16:51:44 +00:00
Shoyu Vanilla
8062bee9e3 Bless tests 2026-02-11 18:08:18 +09:00
Jamie Hill-Daniel
c96ff2d429 Remove uses of cfg(any()/all()) 2025-12-10 23:41:19 +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
Michael Goulet
5508b471bd instantiate predicate binder without recanonicalizing goal in new solver 2025-10-20 10:31:08 +02: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