Skip to content

suggest code action fixes produced from diagnostics under cursor, even if they have effects elsewhere#22726

Merged
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
bend-n:pr2
Jul 8, 2026
Merged

suggest code action fixes produced from diagnostics under cursor, even if they have effects elsewhere#22726
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
bend-n:pr2

Conversation

@bend-n

@bend-n bend-n commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

the point of this, at least for me, is mostly the
"feature(x) is unstable" errors.
this allows you to code-action fix them from the point of feature usage.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 5, 2026
@ChayimFriedman2

Copy link
Copy Markdown
Contributor

I cannot get rustc to emit fixes for unstable features used; did you verify this patch works?

@bend-n

bend-n commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

yeah

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

What was the code?

@bend-n

bend-n commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author
image
const fn x() -> &'static [u8] {
    unsafe { core::intrinsics::transmute_unchecked::<u32, u8>(4) };
    todo!()
}

@Veykril

Veykril commented Jul 8, 2026

Copy link
Copy Markdown
Member

You only get those on nightly toolchains I think

@ChayimFriedman2 ChayimFriedman2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Alright. I accept the idea, but please put the new range inside Fix::ranges instead (and increase it's SmallVec size to 2).

View changes since this review

@bend-n

bend-n commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

should i just like. fix.ranges[1] = diagnostic.range?

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

No, of course not. You need to push() it.

@bend-n

bend-n commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

yeah but like. would there never be two things in the fix.ranges? was it basically just an option before?

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

No, that's why it's a vector.

@ChayimFriedman2 ChayimFriedman2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ChayimFriedman2
ChayimFriedman2 enabled auto-merge July 8, 2026 10:40
@ChayimFriedman2
ChayimFriedman2 added this pull request to the merge queue Jul 8, 2026
Merged via the queue into rust-lang:master with commit a944473 Jul 8, 2026
18 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 8, 2026
@bend-n
bend-n deleted the pr2 branch July 8, 2026 11:45
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.

4 participants