Skip to content

Commit c8e8068

Browse files
committed
peace of mind: be absolutely sure we don't try to emit a 0-part suggestion
(cherry picked from commit 8dcdb3e)
1 parent 909010e commit c8e8068

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: compiler/rustc_mir_build/src/errors.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,9 @@ impl Subdiagnostic for Rust2024IncompatiblePatSugg {
11501150
};
11511151
format!("make the implied reference pattern{plural_derefs}{and_modes} explicit")
11521152
};
1153-
diag.multipart_suggestion_verbose(msg, self.suggestion, applicability);
1153+
// FIXME(dianne): for peace of mind, don't risk emitting a 0-part suggestion (that panics!)
1154+
if !self.suggestion.is_empty() {
1155+
diag.multipart_suggestion_verbose(msg, self.suggestion, applicability);
1156+
}
11541157
}
11551158
}

0 commit comments

Comments
 (0)