Skip to content

Conversation

@kouhe3
Copy link
Contributor

@kouhe3 kouhe3 commented Jan 5, 2026

fix #19780

Add enum and field to track = and ..

Create a new function to determine match and missing msg

behavior

#![feature(default_field_values)]
fn main() {
    let u1 = UserInfo { id: 10, $0 ,.. }; // trigger suggestion: age,email
               ^^^^^^ 💡 missing field 
                    | -email
}

struct UserInfo {
    id: i32,
    age: f32 = 1.0,
    email: String,
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 5, 2026
@kouhe3 kouhe3 marked this pull request as draft January 5, 2026 13:07
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 5, 2026
@kouhe3 kouhe3 force-pushed the default_field_values branch from c06113d to 046077b Compare January 6, 2026 15:53
@kouhe3 kouhe3 marked this pull request as ready for review January 6, 2026 16:36
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 6, 2026
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just rebase, and also please squash with a useful commit message.

- Added `RecordSpread` enum to distinguish between no spread, field defaults, and spread expressions
- Updated `FieldData` to include `default_value` field
- Modified record literal lowering to handle default field values
- Updated diagnostics to check for missing fields considering defaults
- Added methods to get matched fields for records for completions
- Enhanced hover support for struct rest patterns
@kouhe3 kouhe3 force-pushed the default_field_values branch from 77f1415 to 8c5a9eb Compare January 26, 2026 11:04
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Jan 26, 2026
Merged via the queue into rust-lang:master with commit d7666fa Jan 26, 2026
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

incorrect "missing structure fields" on-the-fly diagnostic

3 participants