aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/diagnostics.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs
index a88a978d7..9bde1db8e 100644
--- a/crates/ra_ide/src/diagnostics.rs
+++ b/crates/ra_ide/src/diagnostics.rs
@@ -167,6 +167,9 @@ fn missing_struct_field_fix(
167 }; 167 };
168 168
169 let new_field_type = sema.type_of_expr(&record_expr.expr()?)?; 169 let new_field_type = sema.type_of_expr(&record_expr.expr()?)?;
170 if new_field_type.is_unknown() {
171 return None;
172 }
170 let new_field = make::record_field_def( 173 let new_field = make::record_field_def(
171 record_expr.field_name()?, 174 record_expr.field_name()?,
172 make::type_ref(&new_field_type.display_source_code(sema.db, module.into()).ok()?), 175 make::type_ref(&new_field_type.display_source_code(sema.db, module.into()).ok()?),