fix(dfir_lang): Add FusedStream requirement to source_stream#2552
Draft
fix(dfir_lang): Add FusedStream requirement to source_stream#2552
Conversation
Co-authored-by: MingweiSamuel <6778341+MingweiSamuel@users.noreply.github.com>
…tream> Co-authored-by: MingweiSamuel <6778341+MingweiSamuel@users.noreply.github.com>
Co-authored-by: MingweiSamuel <6778341+MingweiSamuel@users.noreply.github.com>
Co-authored-by: MingweiSamuel <6778341+MingweiSamuel@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] fix(dfir_lang)!: source_stream to require FusedStream
fix(dfir_lang): Add FusedStream requirement to source_stream
Feb 6, 2026
Comment on lines
+58
to
+59
| fn check_stream<Stream: #root::futures::stream::Stream<Item = Item> + #root::futures::stream::FusedStream + ::std::marker::Unpin, Item>(stream: Stream) | ||
| -> impl #root::futures::stream::Stream<Item = Item> + #root::futures::stream::FusedStream + ::std::marker::Unpin |
Member
There was a problem hiding this comment.
Suggested change
| fn check_stream<Stream: #root::futures::stream::Stream<Item = Item> + #root::futures::stream::FusedStream + ::std::marker::Unpin, Item>(stream: Stream) | |
| -> impl #root::futures::stream::Stream<Item = Item> + #root::futures::stream::FusedStream + ::std::marker::Unpin | |
| fn check_stream<Stream: #root::futures::stream::FusedStream<Item = Item> + ::std::marker::Unpin, Item>(stream: Stream) | |
| -> impl #root::futures::stream::FusedStream<Item = Item> + ::std::marker::Unpin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
source_streamconvertsPendingtoReady(None)when polling (line 76), effectively re-polling after termination. This violates the Stream contract unless the stream implementsFusedStream, which guaranteesReady(None)is stable.Changes
FusedStreamtrait bound tosource_streamcodegen incheck_streamhelperFuse<T>wrappers:unbounded_channel(),unsync_channel()iter_batches_stream()tcp_framed,udp_framed, etc.)new_inbox()in simulation modulesource_stream:source_interval,source_stdin,source_filesurface_source_stream_not_fused.rsdemonstrating the error when using non-fused streamsExample
Before this change, the following would compile but could panic at runtime:
After this change, it correctly fails compilation with a clear error about the missing
FusedStreambound.Original prompt
source_streamshould requireFusedStreambut doesn't #2419💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.