add regression test to sure it is fixed

This commit is contained in:
Asuka Minato
2025-11-20 22:33:37 +09:00
parent 57c0f1f1f4
commit caf28ca320
@@ -2522,3 +2522,43 @@ mod my_mod {
"#,
);
}
#[test]
fn issue_9881_super_trait_blanket_impl() {
check_types(
r#"
pub trait TryStream: Stream {
fn try_poll_next(&self) {}
}
pub trait Stream {
type Item;
fn poll_next(&self) {}
}
trait StreamAlias: Stream<Item = ()> {}
impl<S: Stream<Item = ()>> TryStream for S {}
impl<S: Stream<Item = ()>> StreamAlias for S {}
struct StreamImpl;
impl Stream for StreamImpl {
type Item = ();
}
fn foo() -> impl StreamAlias {
StreamImpl
}
fn main() {
let alias = foo();
let _: () = alias.try_poll_next();
// ^ ()
let _: () = alias.poll_next();
// ^ ()
}
"#,
);
}