Repository: rust
Issue: `..` should be suggested when attempting to ignore a private enum variant with `_`
Labels: A-diagnostics,T-compiler

### Code

```Rust
mod foo {
    struct Bar;
    pub enum Foo {
        #[allow(private_interfaces)]
        A(Bar),
    }
}
fn foo_bar(v: foo::Foo) {
    match v {
        foo::Foo::A(_) => {}
    }
}
```

### Current output

```Shell
rustc: error: type `jobs::purge_old_event_summaries::foo::Bar` is private
   --> platform/spec-proxy-sidekick/src/jobs/purge_old_event_summaries.rs:454:21
    |
454 |         foo::Foo::A(_) => {}
    |                     ^ private type
```

### Desired output

```Shell
rustc: you might want to ignore the private value by using `..`
```

### Rationale and extra context

On ignoring a pattern in a match, the [reference](https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html#ignoring-values-in-a-pattern) reads:

> There are a few ways to ignore entire values or parts of values in a pattern: using the _ pattern (which you’ve seen), using the _ pattern within another pattern, using a name that starts with an underscore, or using .. to ignore remaining parts of a value. Let’s explore how and why to use each of these patterns.

Their detailed sections read, in part:

> We can also use _ inside another pattern to ignore just part of a value, for example, when we want to test for only part of a value but have no use for the other parts in the corresponding code we want to run.

and 

> With values that have many parts, we can use the .. syntax to use specific parts and ignore the rest, avoiding the need to list underscores for each ignored value. The .. pattern ignores any parts of a value that we haven’t explicitly matched in the rest of the pattern.

All of this makes ignoring a value via `_` and `..` seem functionally equivalent, and generally this is true, except for when you are ignoring a value whose type is private. In that case, `_` causes an error, while `..` is fine. 

I would have assumed that the compiler was able to entirely ignore your "use" of the private type in either case, but given that it isn't so, it would be nice to have a helpful message pointing in that direction. It seems like `_` sufficiently expresses the intent to ignore the private value such that it would justify suggesting `..` as an alternative. This would be a reasonable suggestion for 1-tuple data enums and for N-tuple data enums, where assigning a private type to `_` can also be replaced with `..`.

A real world example of where this would have been useful can be seen here: https://github.com/mlua-rs/mlua/issues/502, where I opened an Issue with the mlua project asking for a workaround to allow exhaustive pattern matching in a public enum that had been updated to contain a private type. The library was updated to make the type public but undocumented, but another commenter later pointed out that `..` would have also been an option.

It would also be nice to provide similar hints for structs, for example:

```rust
mod foo {
    struct Bar;
    pub struct Baz {
        #[allow(private_interfaces)]
        pub a: Bar,
    }
}
fn struct_baz(v: foo::Baz) {
    let foo::Baz { a: _ } = v;
}
```

In addition to the current error of:

```
rustc: error: type `jobs::purge_old_event_summaries::foo::Bar` is private
   --> platform/spec-proxy-sidekick/src/jobs/purge_old_event_summaries.rs:467:23
    |
467 |     let foo::Baz { a: _ } = v;
    |                       ^ private type
```

To add something like: "you might want to ignore the field 'a' entirely by using `..`"

### Other cases

```Rust

```

### Rust Version

```Shell
❯ rustc --version --verbose
rustc 1.84.0 (9fc6b4312 2025-01-07)
binary: rustc
commit-hash: 9fc6b43126469e3858e2fe86cafb4f0fd5068869
commit-date: 2025-01-07
host: x86_64-unknown-linux-gnu
release: 1.84.0
LLVM version: 19.1.5
```

### Anything else?

_No response_