-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add coverage to continue statements #84295
Conversation
`continue` statements were missing coverage. This was particularly noticeable in a match pattern that contained only a `continue` statement, leaving the branch appear uncounted. This PR addresses the problem and adds tests to prove it.
b320332
to
448e52d
Compare
And make the LocalDecl internal, to avoid needing to declare storage. (For multiple `continue` stateuemtns, it must also be mutable.)
9b8d490
to
d1d7fb1
Compare
@@ -643,6 +650,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { | |||
self.cfg.start_new_block().unit() | |||
} | |||
|
|||
// Add a dummy `Assign` statement to the CFG, with the span for the source code's `continue` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the function itself doesn't know about continue
9| | true => { | ||
10| 10| continue; | ||
11| | } | ||
12| 0| _ => { | ||
13| 0| x = 1; | ||
14| 0| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small detail, but can you think of why the beginning/end of the block have counters for the _
/ x = 1
case, but not the continue?
This makes sense to me. Comments above shouldn't block merging, so @bors r+ |
📌 Commit d1d7fb1 has been approved by |
☀️ Test successful - checks-actions |
continue
statements were missing coverage. This was particularlynoticeable in a match pattern that contained only a
continue
statement, leaving the branch appear uncounted. This PR addresses the
problem and adds tests to prove it.
r? @tmandry
cc: @wesleywiser