File tree Expand file tree Collapse file tree
crates/ide-completion/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,8 +70,11 @@ pub(crate) fn complete_record_expr_fields(
7070 }
7171 _ => {
7272 let missing_fields = ctx. sema . record_literal_missing_fields ( record_expr) ;
73+ let update_exists = record_expr
74+ . record_expr_field_list ( )
75+ . is_some_and ( |list| list. dotdot_token ( ) . is_some ( ) ) ;
7376
74- if !missing_fields. is_empty ( ) {
77+ if !missing_fields. is_empty ( ) && !update_exists {
7578 cov_mark:: hit!( functional_update_field) ;
7679 add_default_update ( acc, ctx, ty) ;
7780 }
Original file line number Diff line number Diff line change @@ -263,6 +263,29 @@ fn main() {
263263 ) ;
264264}
265265
266+ #[ test]
267+ fn functional_update_exist_update ( ) {
268+ check (
269+ r#"
270+ //- minicore:default
271+ struct Foo { foo1: u32, foo2: u32 }
272+ impl Default for Foo {
273+ fn default() -> Self { loop {} }
274+ }
275+
276+ fn main() {
277+ let thing = 1;
278+ let foo = Foo { foo1: 0, foo2: 0 };
279+ let foo2 = Foo { thing, $0 ..Default::default() }
280+ }
281+ "# ,
282+ expect ! [ [ r#"
283+ fd foo1 u32
284+ fd foo2 u32
285+ "# ] ] ,
286+ ) ;
287+ }
288+
266289#[ test]
267290fn empty_union_literal ( ) {
268291 check (
You can’t perform that action at this time.
0 commit comments