From acc2819c10ce1eb9daadac606c3ab6cfbfa91851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 22 Jun 2020 18:16:00 +0300 Subject: Don't offer to add missing fields of unknown types --- crates/ra_ide/src/diagnostics.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/ra_ide/src/diagnostics.rs') 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( }; let new_field_type = sema.type_of_expr(&record_expr.expr()?)?; + if new_field_type.is_unknown() { + return None; + } let new_field = make::record_field_def( record_expr.field_name()?, make::type_ref(&new_field_type.display_source_code(sema.db, module.into()).ok()?), -- cgit v1.2.3