Skip to content

Commit 621e123

Browse files
committed
re-added test for rust-lang#122638
1 parent 12445e0 commit 621e123

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

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

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

0 commit comments

Comments
 (0)