Skip to content

Commit 6c3e7af

Browse files
committed
analyze: rewrite::convert: clarify comment about nested OptionMapBegin/End
1 parent c7d0f2f commit 6c3e7af

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

c2rust-analyze/src/rewrite/expr/convert.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,10 @@ impl<'tcx> ConvertVisitor<'tcx> {
323323
) -> Option<(&[DistRewrite], &[DistRewrite])> {
324324
for (i, mir_rw) in mir_rws.iter().enumerate() {
325325
match mir_rw.rw {
326-
// Bail out if we see nested delimiters.
326+
// Bail out if we see nested delimiters. This prevents the special
327+
// `Option::map` rewrite from applying, so the caller will fall back on the
328+
// `unwrap()` + `Some(_)` rewrites for `OptionMapBegin/End` that are
329+
// implemented in `convert_cast_rewrite`.
327330
mir_op::RewriteKind::OptionMapBegin => return None,
328331
mir_op::RewriteKind::OptionMapEnd => {
329332
let (a, b) = mir_rws.split_at(i);

0 commit comments

Comments
 (0)