Skip to content

Commit

Permalink
re-added test for rust-lang#122638
Browse files Browse the repository at this point in the history
  • Loading branch information
ranger-ross committed Jan 12, 2025
1 parent 12445e0 commit 621e123
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/ui/const-generics/ice-122683.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ known-bug: #122638
#![feature(min_specialization)]
impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> {
fn next(&mut self) -> Option<Self::Item> {}
}
struct ConstChunksExact<'a, T: '_, const assert: usize> {}
impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
type Item = &'a [T; N];
}
66 changes: 66 additions & 0 deletions tests/ui/const-generics/ice-122683.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
error[E0637]: `'_` cannot be used here
--> $DIR/ice-122683.rs:6:32
|
LL | struct ConstChunksExact<'a, T: '_, const assert: usize> {}
| ^^ `'_` is a reserved lifetime name

error[E0601]: `main` function not found in crate `ice_122683`
--> $DIR/ice-122683.rs:9:2
|
LL | }
| ^ consider adding a `main` function to `$DIR/ice-122683.rs`

error[E0308]: mismatched types
--> $DIR/ice-122683.rs:7:83
|
LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
| ^^ expected `usize`, found `()`

error[E0046]: not all trait items implemented, missing: `Item`
--> $DIR/ice-122683.rs:3:1
|
LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Item` in implementation
|
= help: implement the missing item: `type Item = /* Type */;`

error[E0392]: lifetime parameter `'a` is never used
--> $DIR/ice-122683.rs:6:25
|
LL | struct ConstChunksExact<'a, T: '_, const assert: usize> {}
| ^^ unused lifetime parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`

error[E0392]: type parameter `T` is never used
--> $DIR/ice-122683.rs:6:29
|
LL | struct ConstChunksExact<'a, T: '_, const assert: usize> {}
| ^ unused type parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`

error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
--> $DIR/ice-122683.rs:7:30
|
LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
| ^^^^^^^^^^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported

error[E0308]: mismatched types
--> $DIR/ice-122683.rs:4:27
|
LL | fn next(&mut self) -> Option<Self::Item> {}
| ---- ^^^^^^^^^^^^^^^^^^ expected `Option<_>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected enum `Option<_>`
found unit type `()`

error: aborting due to 8 previous errors

Some errors have detailed explanations: E0046, E0207, E0308, E0392, E0601, E0637.
For more information about an error, try `rustc --explain E0046`.

0 comments on commit 621e123

Please sign in to comment.