Skip to content

Avoid invalid suggestion in case of macro expansion without inferrable generic type - #161587

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
lsunsi:issue129756
Sep 9, 2026
Merged

Avoid invalid suggestion in case of macro expansion without inferrable generic type#161587
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
lsunsi:issue129756

Conversation

@lsunsi

@lsunsi lsunsi commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Closes #129756 .

The main challenge for me in this PR was figuring out how to pass down the information of the code being generated from expansion. I went for the simplest approach I could think of, but I questioned myself if the boolean should be placed inside the Visitor. I don't have enough information to figure this out, if it's badly placed I'd be happy to fix and learn!

About the test, I split the two commits because we can see the issue being reproduced in the first commit but being fixed on the second. I also added a non-expansion example of the same code to show it won't get altered.

Oh, also I didn't know the best place to place the test. I went for the place with same kind of errors, but I guess proc-macros could also be a place.

@rustbot

rustbot commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in need_type_info.rs

cc @lcnr

@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 Aug 23, 2026
@rustbot

rustbot commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

r? @ShoyuVanilla

rustbot has assigned @ShoyuVanilla.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 19 candidates

@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@lsunsi

lsunsi commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@bors reroll

@rust-bors

rust-bors Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Unknown command "reroll". Run @bors help or go to https://bors.rust-lang.org/help to see available commands.

@lsunsi

lsunsi commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot reroll

@rustbot rustbot assigned jieyouxu and unassigned ShoyuVanilla Sep 8, 2026

@ShoyuVanilla ShoyuVanilla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for the delay, I have been reviewing this 😅
Looks good to me. Thanks!

@bors r+ rollup

View changes since this review

@rust-bors

rust-bors Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 3d5f173 has been approved by ShoyuVanilla

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Sep 9, 2026
@jieyouxu jieyouxu assigned ShoyuVanilla and unassigned jieyouxu Sep 9, 2026
mu001999 added a commit to mu001999/rust that referenced this pull request Sep 9, 2026
Avoid invalid suggestion in case of macro expansion without inferrable generic type

Closes rust-lang#129756 .

The main challenge for me in this PR was figuring out how to pass down the information of the code being generated from expansion. I went for the simplest approach I could think of, but I questioned myself if the boolean should be placed inside the Visitor. I don't have enough information to figure this out, if it's badly placed I'd be happy to fix and learn!

About the test, I split the two commits because we can see the issue being reproduced in the first commit but being fixed on the second. I also added a non-expansion example of the same code to show it won't get altered.

Oh, also I didn't know the best place to place the test. I went for the place with same kind of errors, but I guess `proc-macros` could also be a place.
rust-bors Bot pushed a commit that referenced this pull request Sep 9, 2026
Rollup of 6 pull requests

Successful merges:

 - #162482 (Make `run-make` testsuite work with other codegen backend than LLVM)
 - #161587 (Avoid invalid suggestion in case of macro expansion without inferrable generic type)
 - #162363 (Use correct `dir_path` when parsing module from path)
 - #162408 (add crashtests [7/N])
 - #162502 (triagebot: Subscribe me to amdgpu changes)
 - #162505 (Revert "fuchsia: Add safestack as a supported sanitizer for x86_64 fuchsia")
@rust-bors
rust-bors Bot merged commit 100c013 into rust-lang:main Sep 9, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 9, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 9, 2026
Rollup merge of #161587 - lsunsi:issue129756, r=ShoyuVanilla

Avoid invalid suggestion in case of macro expansion without inferrable generic type

Closes #129756 .

The main challenge for me in this PR was figuring out how to pass down the information of the code being generated from expansion. I went for the simplest approach I could think of, but I questioned myself if the boolean should be placed inside the Visitor. I don't have enough information to figure this out, if it's badly placed I'd be happy to fix and learn!

About the test, I split the two commits because we can see the issue being reproduced in the first commit but being fixed on the second. I also added a non-expansion example of the same code to show it won't get altered.

Oh, also I didn't know the best place to place the test. I went for the place with same kind of errors, but I guess `proc-macros` could also be a place.
@lsunsi
lsunsi deleted the issue129756 branch September 9, 2026 09:51
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.

Invalid suggestion when using serde serialize_with

5 participants