Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/expr_store/lower/format_args.rs')
-rw-r--r--crates/hir-def/src/expr_store/lower/format_args.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/hir-def/src/expr_store/lower/format_args.rs b/crates/hir-def/src/expr_store/lower/format_args.rs
index 51616afb38..beb1267173 100644
--- a/crates/hir-def/src/expr_store/lower/format_args.rs
+++ b/crates/hir-def/src/expr_store/lower/format_args.rs
@@ -867,11 +867,14 @@ impl<'db> ExprCollector<'db> {
};
let width =
RecordLitField { name: Name::new_symbol_root(sym::width), expr: width_expr };
- self.alloc_expr_desugared(Expr::RecordLit {
- path: self.lang_path(lang_items.FormatPlaceholder).map(Box::new),
- fields: Box::new([position, flags, precision, width]),
- spread: RecordSpread::None,
- })
+ match self.lang_path(lang_items.FormatPlaceholder) {
+ Some(path) => self.alloc_expr_desugared(Expr::RecordLit {
+ path,
+ fields: Box::new([position, flags, precision, width]),
+ spread: RecordSpread::None,
+ }),
+ None => self.missing_expr(),
+ }
} else {
let format_placeholder_new =
self.ty_rel_lang_path_desugared_expr(lang_items.FormatPlaceholder, sym::new);