Skip to content

Conversation

chenyukang
Copy link
Member

Fixes #118145

@rustbot
Copy link
Collaborator

rustbot commented Nov 28, 2023

r? @davidtwco

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 28, 2023
@chenyukang chenyukang changed the title fix the issue of suggest unwrap/expect for shorthand field Fix the issue of suggesting unwrap/expect for shorthand field Nov 28, 2023
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

r=me when green

@compiler-errors
Copy link
Member

It would be really cool if you checked other suggestion code for this bug as well

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 28, 2023

📌 Commit 9386e14 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 28, 2023
@compiler-errors
Copy link
Member

@bors rollup

@chenyukang
Copy link
Member Author

It would be really cool if you checked other suggestion code for this bug as well

I reviewed some other suggestions in this file, and added several new fix.
Not sure we have fixed all issue, is there any possible general solution?
maybe we can have a try on this scenario:

suggesting add xxx to result of "a.xxx", and a is a shorthand field we should suggest: a: a.xxx.

@compiler-errors
Copy link
Member

I don't know if the compiler currently has the machinery to allow us to make this fix in general :/

This is good for now. Thanks for the detailed tests.

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 29, 2023

📌 Commit 3a4edf0 has been approved by compiler-errors

It is now in the queue for this repository.

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#118342 (Dont suggest `!` for path in function call if it has generic args)
 - rust-lang#118383 (Address unused tuple struct fields in the standard library)
 - rust-lang#118401 (`rustc_ast_lowering` cleanups)
 - rust-lang#118409 (format_foreign.rs: unwrap return Option value for `fn position`, as it always returns Some)
 - rust-lang#118413 (Fix the issue of suggesting unwrap/expect for shorthand field)
 - rust-lang#118425 (Update cargo)
 - rust-lang#118429 (Fix a typo in a `format_args!` note)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8727538 into rust-lang:master Nov 29, 2023
@rustbot rustbot added this to the 1.76.0 milestone Nov 29, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2023
Rollup merge of rust-lang#118413 - chenyukang:yukang-fix-118145-unwrap-for-shorthand, r=compiler-errors

Fix the issue of suggesting unwrap/expect for shorthand field

Fixes rust-lang#118145
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestion to add the question mark operator creates invalid code for structs that use the shorthand syntax
5 participants