mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
add regression test to sure it is fixed
This commit is contained in:
@@ -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();
|
||||
// ^ ()
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user