Files
rust/tests/ui/coherence
Jacob Pratt bab437e0ae Rollup merge of #160767 - Omar1H1:diagnostics/e0117-label-fix, r=petrochenkov
Unify E0117 foreign-trait label for ADT/primitive types with existing Slice/Array/Tuple handling

### What this does

`emit_orphan_check_error` (in `compiler/rustc_hir_analysis/src/coherence/orphan.rs`) already has an `is_foreign` flag, true whenever a non-local type sits in one of the *trait's own* parameter positions rather than `Self`. The `Slice`, `Array`, and `Tuple` arms already use it to switch their label to a generic "this is not defined in the current crate because this is a foreign trait" message instead of naming the type. The `Adt` arm and the catch-all `_` arm (covering primitives) never checked `is_foreign` and always named the type, even in the same non-Self position.

This PR extends the same `is_foreign` branch to those two arms, so all four are consistent. No new types or subdiagnostics reuses the existing `OnlyCurrentTraitsForeign` struct already used a few lines above.

LLM use :
I used LLM to explore the project and find where code that tags labels

### Before / after

```rust
impl PartialEq for u32 {
    fn eq(&self, _other: &Self) -> bool { todo!() }
}
```
Before :
```Plaintext
   |      |             `u32` is not defined in the current crate
   |      `u32` is not defined in the current crate
```

After :
```Plaintext
   |      |       `u32` is not defined in the current crate
   |      this is not defined in the current crate because this is a foreign trait
```
Addresses rust-lang/rust#160648

r? compiler
2026-08-18 22:10:45 -04:00
..
2026-07-29 17:52:50 +02:00
2026-07-18 18:57:06 +02:00
2025-11-27 11:19:00 -05:00
2025-11-27 11:19:00 -05:00
2025-11-27 11:19:00 -05:00
2026-07-05 21:27:38 +02:00