Skip to content

Refactor how lints define future incompatibility - #163555

Open
WaffleLapkin wants to merge 4 commits into
rust-lang:mainfrom
WaffleLapkin:fcw
Open

WaffleLapkin wants to merge 4 commits into
rust-lang:mainfrom
WaffleLapkin:fcw

Conversation

@WaffleLapkin

Copy link
Copy Markdown
Member

The main changes are:

r? @RalfJung
cc @jdonszelmann

@rustbot

rustbot commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

The rustc-dev-guide subtree was changed. If your future PRs only touch the subtree, consider submitting them directly to rust-lang/rustc-dev-guide, which is where the document is primarily maintained (and has faster CI).

cc @BoxyUwU, @tshepang

@rustbot rustbot added A-rustc-dev-guide Area: rustc-dev-guide 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 Sep 30, 2026
@rustbot

rustbot commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

RalfJung is not on the review rotation at the moment.
They may take a while to respond.

Comment on lines +517 to 525
const fn edition_from_u16(x: u16) -> Edition {
match x {
2015 => Edition::Edition2015,
2018 => Edition::Edition2018,
2021 => Edition::Edition2021,
2024 => Edition::Edition2024,
_ => panic!("invalid edition number"),
}
}

@WaffleLapkin WaffleLapkin Sep 30, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This feels like a hack tbh. Maybe we should just accept Edition and use use Edition::* on the callsite?

View changes since the review

@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung 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.

This seems fine, but it is touching the edition logic that I don't know much about.

r? @jdonszelmann maybe?

View changes since this review

Comment on lines +344 to +345
/// After a lint has been in this state for a while, consider setting this to true, so it
/// warns for everyone. It is a good signal that it is ready if you can determine that all

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.

Suggested change
/// After a lint has been in this state for a while, consider setting this to true, so it
/// warns for everyone. It is a good signal that it is ready if you can determine that all
/// After a lint has been in this state for a while, consider setting this to true, so it
/// warns for everyone. Typically, the default lint level is set to `Deny` at that point.
/// It is a good signal that it is ready if you can determine that all

/// [`EditionSemanticsChange`]: FutureIncompatibilityReason::EditionSemanticsChange
/// [`FutureReleaseSemanticsChange`]: FutureIncompatibilityReason::FutureReleaseSemanticsChange
EditionAndFutureReleaseSemanticsChange(EditionFcw),
EditionAndFutureReleaseSemanticsChange(EditionFcw, ReleaseFcw),

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.

Why did this change? Is this variant even used?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This changed because this represents both an edition and a future release change (i.e. what we did with some never type things). For this kind of change it is reasonable to report it in dependencies, and since that is now stored in ReleaseFcw, it also needs to store that. (IMO it should have already stored it, but oh well).

It is not currently used, no.

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.

But this means we're storing the issue number twice, doesn't it?

..$crate::Lint::default_fields_for_macro()
$vis static $NAME: &$crate::Lint = {
#[allow(unused_imports)]
use $crate::{future_release_error, future_release_semantics_change, edition_error, edition_semantics_change};

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.

Regarding #163555 (comment), the edition enum variants could be imported here?

@rustbot rustbot assigned jdonszelmann and unassigned RalfJung Oct 1, 2026
@rustbot

rustbot commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

jdonszelmann is currently at their maximum review capacity.
They may take a while to respond.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustc-dev-guide Area: rustc-dev-guide 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants