Skip to content

Commit 2b57403

Browse files
committed
add test for #112823
Fixes #112823
1 parent 4d9ce7a commit 2b57403

2 files changed

+61
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// test for ICE #112823
2+
// Unexpected parameter Type(Repr) when substituting in region
3+
4+
#![feature(impl_trait_in_assoc_type)]
5+
6+
use std::future::Future;
7+
8+
trait Stream {}
9+
10+
trait X {
11+
type LineStream<'a, Repr>
12+
where
13+
Self: 'a;
14+
type LineStreamFut<'a, Repr>
15+
where
16+
Self: 'a;
17+
}
18+
19+
struct Y;
20+
21+
impl X for Y {
22+
type LineStream<'c, 'd> = impl Stream;
23+
//~^ ERROR type `LineStream` has 0 type parameters but its trait declaration has 1 type parameter
24+
type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>;
25+
fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
26+
//~^ ERROR `()` is not a future
27+
//~^^ method `line_stream` is not a member of trait `X`
28+
}
29+
30+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error[E0407]: method `line_stream` is not a member of trait `X`
2+
--> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:25:5
3+
|
4+
LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `X`
6+
7+
error[E0049]: type `LineStream` has 0 type parameters but its trait declaration has 1 type parameter
8+
--> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:22:21
9+
|
10+
LL | type LineStream<'a, Repr>
11+
| -- ----
12+
| |
13+
| expected 1 type parameter
14+
...
15+
LL | type LineStream<'c, 'd> = impl Stream;
16+
| ^^ ^^
17+
| |
18+
| found 0 type parameters
19+
20+
error[E0277]: `()` is not a future
21+
--> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:25:43
22+
|
23+
LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
24+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
25+
|
26+
= help: the trait `Future` is not implemented for `()`
27+
28+
error: aborting due to 3 previous errors
29+
30+
Some errors have detailed explanations: E0049, E0277, E0407.
31+
For more information about an error, try `rustc --explain E0049`.

0 commit comments

Comments
 (0)