rust/tests/ui/const-generics/issues/issue-82956.rs
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

34 lines
725 B
Rust

//@ edition:2015
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
pub struct ConstCheck<const CHECK: bool>;
pub trait True {}
impl True for ConstCheck<true> {}
pub trait OrdesDec {
type Newlen;
type Output;
fn pop(self) -> (Self::Newlen, Self::Output);
}
impl<T, const N: usize> OrdesDec for [T; N]
where
ConstCheck<{N > 1}>: True,
[T; N - 1]: Sized,
{
type Newlen = [T; N - 1];
type Output = T;
fn pop(self) -> (Self::Newlen, Self::Output) {
let mut iter = IntoIter::new(self);
//~^ ERROR: cannot find
let end = iter.next_back().unwrap();
let new = [(); N - 1].map(move |()| iter.next().unwrap());
(new, end)
}
}
fn main() {}