Fix continue-in-closure compile errors in Windows encoder paths#1578
Merged
richiemcilroy merged 2 commits intomainfrom Feb 4, 2026
Merged
Fix continue-in-closure compile errors in Windows encoder paths#1578richiemcilroy merged 2 commits intomainfrom
richiemcilroy merged 2 commits intomainfrom
Conversation
Co-authored-by: richiemcilroy <33632126+richiemcilroy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix continue statement usage inside closure
Fix continue-in-closure compile errors in Windows encoder paths
Feb 4, 2026
| let frame_time = duration_to_timespan(normalized_ts); | ||
| return Ok(Some((texture, frame_time))); | ||
| } | ||
| Ok(None) | Err(_) => return Ok(None), |
There was a problem hiding this comment.
This collapses end-of-stream and channel close into the same path and also drops the disconnect signal. Tiny thing, but having separate branches with a trace! makes debugging encoder shutdown/startup a lot easier (same pattern shows up in the camera closure below).
Suggested change
| Ok(None) | Err(_) => return Ok(None), | |
| Ok(None) => { | |
| trace!("End of stream signal received"); | |
| return Ok(None); | |
| } | |
| Err(e) => { | |
| trace!("Channel disconnected: {e}"); | |
| return Ok(None); | |
| } |
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.
Rust E0267 errors occurred because
continuewas used inside closure bodies in the Windows output pipeline. This broke build steps in the recording crate.continuelegal while preserving pause/reuse logic.continue.Example pattern:
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Greptile Overview
Greptile Summary
fixed
continue-in-closure compile errors (E0267) by wrapping closure bodies in an explicitloopand usingreturnstatements to exitcrates/recording/src/output_pipeline/win.rs:317-370): wrapped inloop, preserved pause/timeout/reuse logiccrates/recording/src/output_pipeline/win.rs:842-900): applied same pattern for pause handling and timestamp normalizationthe fix maintains identical runtime behavior while satisfying Rust's control flow rules
Confidence Score: 5/5
Important Files Changed
Sequence Diagram
sequenceDiagram participant Encoder as Hardware Encoder participant Closure as Frame Closure participant Channel as video_rx Channel participant PauseFlag as pause_flag Encoder->>Closure: run(closure) loop Frame Processing Loop Closure->>Channel: recv_timeout(frame_interval) alt Receive Frame Channel-->>Closure: Ok(Some((frame, timestamp))) Closure->>Closure: Store last_texture/timestamp else End of Stream Channel-->>Closure: Ok(None) Closure-->>Encoder: return Ok(None) [exit] else Timeout Channel-->>Closure: Err(RecvTimeoutError::Timeout) Closure->>PauseFlag: load(Ordering::Acquire) alt Paused PauseFlag-->>Closure: true Closure->>Closure: last_timestamp = None Note over Closure: continue loop else Not Paused, Has Last Frame PauseFlag-->>Closure: false Closure->>Closure: Increment timestamp + frames_reused Note over Closure: Fall through to return frame end else Disconnected Channel-->>Closure: Err(RecvTimeoutError::Disconnected) Closure-->>Encoder: return Ok(None) [exit] end alt Has Both Texture and Timestamp Closure->>Closure: normalize_timestamp() Closure-->>Encoder: return Ok(Some((texture, time))) [exit] else No Frame Yet Closure->>Channel: recv() [blocking] alt First Frame Received Channel-->>Closure: Ok(Some((frame, timestamp))) Closure->>Closure: Initialize frame_count = 1 Closure-->>Encoder: return Ok(Some((texture, time))) [exit] else Channel Closed Channel-->>Closure: Ok(None) | Err(_) Closure-->>Encoder: return Ok(None) [exit] end end end