Skip to content

Commit 954d530

Browse files
committed
re-added regression test for rust-lang#122638
1 parent 12445e0 commit 954d530

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

tests/ui/const-generics/ice-122683.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ check-fail
2+
#![feature(min_specialization)]
3+
impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> {
4+
//~^ ERROR not all trait items implemented, missing: `Item` [E0046]
5+
fn next(&mut self) -> Option<Self::Item> {}
6+
//~^ ERROR mismatched types [E0308]
7+
}
8+
struct ConstChunksExact<'a, T: '_, const assert: usize> {}
9+
//~^ ERROR `'_` cannot be used here [E0637]
10+
//~| ERROR lifetime parameter `'a` is never used [E0392]
11+
//~| ERROR type parameter `T` is never used [E0392]
12+
impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
13+
//~^ ERROR mismatched types [E0308]
14+
//~| ERROR the const parameter `N` is not constrained by the impl trait, self type, or predicates [E0207]
15+
type Item = &'a [T; N]; }
16+
17+
fn main() {}
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
error[E0637]: `'_` cannot be used here
2+
--> $DIR/ice-122683.rs:8:32
3+
|
4+
LL | struct ConstChunksExact<'a, T: '_, const assert: usize> {}
5+
| ^^ `'_` is a reserved lifetime name
6+
7+
error[E0308]: mismatched types
8+
--> $DIR/ice-122683.rs:12:83
9+
|
10+
LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
11+
| ^^ expected `usize`, found `()`
12+
13+
error[E0046]: not all trait items implemented, missing: `Item`
14+
--> $DIR/ice-122683.rs:3:1
15+
|
16+
LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> {
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Item` in implementation
18+
|
19+
= help: implement the missing item: `type Item = /* Type */;`
20+
21+
error[E0392]: lifetime parameter `'a` is never used
22+
--> $DIR/ice-122683.rs:8:25
23+
|
24+
LL | struct ConstChunksExact<'a, T: '_, const assert: usize> {}
25+
| ^^ unused lifetime parameter
26+
|
27+
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
28+
29+
error[E0392]: type parameter `T` is never used
30+
--> $DIR/ice-122683.rs:8:29
31+
|
32+
LL | struct ConstChunksExact<'a, T: '_, const assert: usize> {}
33+
| ^ unused type parameter
34+
|
35+
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
36+
37+
error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
38+
--> $DIR/ice-122683.rs:12:30
39+
|
40+
LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
41+
| ^^^^^^^^^^^^^^ unconstrained const parameter
42+
|
43+
= note: expressions using a const parameter must map each value to a distinct output value
44+
= note: proving the result of expressions other than the parameter are unique is not supported
45+
46+
error[E0308]: mismatched types
47+
--> $DIR/ice-122683.rs:5:27
48+
|
49+
LL | fn next(&mut self) -> Option<Self::Item> {}
50+
| ---- ^^^^^^^^^^^^^^^^^^ expected `Option<_>`, found `()`
51+
| |
52+
| implicitly returns `()` as its body has no tail or `return` expression
53+
|
54+
= note: expected enum `Option<_>`
55+
found unit type `()`
56+
57+
error: aborting due to 7 previous errors
58+
59+
Some errors have detailed explanations: E0046, E0207, E0308, E0392, E0637.
60+
For more information about an error, try `rustc --explain E0046`.

0 commit comments

Comments
 (0)