From 6c3e7af8568a382c5d714bc4ef00ce80e2eb9a14 Mon Sep 17 00:00:00 2001 From: Stuart Pernsteiner Date: Mon, 3 Jun 2024 10:27:31 -0700 Subject: [PATCH] analyze: rewrite::convert: clarify comment about nested OptionMapBegin/End --- c2rust-analyze/src/rewrite/expr/convert.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/c2rust-analyze/src/rewrite/expr/convert.rs b/c2rust-analyze/src/rewrite/expr/convert.rs index d1c3ff94a..2a9991cb0 100644 --- a/c2rust-analyze/src/rewrite/expr/convert.rs +++ b/c2rust-analyze/src/rewrite/expr/convert.rs @@ -323,7 +323,10 @@ impl<'tcx> ConvertVisitor<'tcx> { ) -> Option<(&[DistRewrite], &[DistRewrite])> { for (i, mir_rw) in mir_rws.iter().enumerate() { match mir_rw.rw { - // Bail out if we see nested delimiters. + // Bail out if we see nested delimiters. This prevents the special + // `Option::map` rewrite from applying, so the caller will fall back on the + // `unwrap()` + `Some(_)` rewrites for `OptionMapBegin/End` that are + // implemented in `convert_cast_rewrite`. mir_op::RewriteKind::OptionMapBegin => return None, mir_op::RewriteKind::OptionMapEnd => { let (a, b) = mir_rws.split_at(i);