File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments