Skip to content

Commit eaaa2da

Browse files
authored
Merge pull request #21075 from asukaminato0721/9881
add regression test to ensure #9881 is fixed
2 parents 6b65781 + f3fbace commit eaaa2da

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

crates/hir-ty/src/tests/regression.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,3 +2522,43 @@ fn foo() {
25222522
"#,
25232523
);
25242524
}
2525+
2526+
#[test]
2527+
fn issue_9881_super_trait_blanket_impl() {
2528+
check_types(
2529+
r#"
2530+
pub trait TryStream: Stream {
2531+
fn try_poll_next(&self) {}
2532+
}
2533+
2534+
pub trait Stream {
2535+
type Item;
2536+
fn poll_next(&self) {}
2537+
}
2538+
2539+
trait StreamAlias: Stream<Item = ()> {}
2540+
2541+
impl<S: Stream<Item = ()>> TryStream for S {}
2542+
2543+
impl<S: Stream<Item = ()>> StreamAlias for S {}
2544+
2545+
struct StreamImpl;
2546+
2547+
impl Stream for StreamImpl {
2548+
type Item = ();
2549+
}
2550+
2551+
fn foo() -> impl StreamAlias {
2552+
StreamImpl
2553+
}
2554+
2555+
fn main() {
2556+
let alias = foo();
2557+
let _: () = alias.try_poll_next();
2558+
// ^ ()
2559+
let _: () = alias.poll_next();
2560+
// ^ ()
2561+
}
2562+
"#,
2563+
);
2564+
}

0 commit comments

Comments
 (0)