Skip to content

Commit 917c89d

Browse files
committed
add non-regression test for issue 126670
1 parent 595550a commit 917c89d

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// This is a non-regression test for issue #126670 where RPITIT refinement checking encountered
2+
// errors during resolution and ICEd.
3+
4+
//@ edition: 2018
5+
6+
pub trait A {}
7+
8+
pub trait Mirror {
9+
type Assoc: ?Sized;
10+
}
11+
impl<T: ?Sized> Mirror for dyn A {
12+
//~^ ERROR the type parameter `T` is not constrained
13+
type Assoc = T;
14+
}
15+
16+
pub trait First {
17+
async fn first() -> <dyn A + 'static as Mirror>::Assoc;
18+
//~^ ERROR type annotations needed
19+
}
20+
21+
impl First for dyn A {
22+
async fn first() {}
23+
}
24+
25+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
2+
--> $DIR/refine-resolution-errors.rs:11:6
3+
|
4+
LL | impl<T: ?Sized> Mirror for dyn A {
5+
| ^ unconstrained type parameter
6+
7+
error[E0282]: type annotations needed
8+
--> $DIR/refine-resolution-errors.rs:17:5
9+
|
10+
LL | async fn first() -> <dyn A + 'static as Mirror>::Assoc;
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
12+
13+
error: aborting due to 2 previous errors
14+
15+
Some errors have detailed explanations: E0207, E0282.
16+
For more information about an error, try `rustc --explain E0207`.

0 commit comments

Comments
 (0)