rust/tests/ui/consts/issue-87046.stderr
Esteban Küber c6205055e0 On const pattern errors, point at the const item definition
Centralize emitting an error in `const_to_pat` so that all errors from that evaluating a `const` in a pattern can add addditional information. With this, now point at the `const` item's definition:

```
error[E0158]: constant pattern depends on a generic parameter
  --> $DIR/associated-const-type-parameter-pattern.rs:20:9
   |
LL | pub trait Foo {
   | -------------
LL |     const X: EFoo;
   |     ------------- constant defined here
...
LL |         A::X => println!("A::X"),
   |         ^^^^
```
2024-12-04 20:29:35 +00:00

12 lines
343 B
Plaintext

error: cannot use unsized non-slice type `Username` in constant patterns
--> $DIR/issue-87046.rs:28:13
|
LL | pub const ROOT_USER: &Username = Username::from_str("root");
| ------------------------------ constant defined here
...
LL | ROOT_USER => true,
| ^^^^^^^^^
error: aborting due to 1 previous error