Files
rust/tests/ui/type-alias-impl-trait
Jonathan Brouwer 09300b8057 Rollup merge of #157835 - Dnreikronos:orphan_auto_trait_free_alias_expansion, r=fmease
expand free alias types in the auto-trait orphan check

fixes rust-lang/rust#157756.

auto-trait impls are only allowed on nominal types. the check for that looked at the self type as written, without expanding it, so a lazy type alias got rejected even when it pointed straight at a type that's fine on its own:

```rust
#![feature(lazy_type_alias)]
struct Local;
type Alias = Local;
unsafe impl Sync for Alias {} // used to be E0321
```

the locality check right above it already normalizes the self type, so the two were looking at different things. imo the cleanest fix is to expand free aliases first, with the same `expand_free_alias_tys` coherence already calls in a couple of other spots. anything that should still be rejected (trait objects, opaque types, bare type params) survives the expansion and errors like before.

one thing worth a second look: `impl_for_weak_alias.rs` used `type Alias = (impl Sized, u8)` and expected an error. idk if that was deliberate, but the alias expands to a tuple, and a tuple is fine for a local auto trait if you write it by hand, so it passes now and i made it check-pass. lmk if i'm missing why it should still be rejected.
2026-07-05 14:12:04 +02:00
..
…
…
2026-03-11 21:54:42 +11:00
2026-02-22 20:20:33 +01:00
2026-06-28 03:56:28 -05:00
2026-06-28 03:48:49 -05:00
…
…