-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement rustc side of report-future-incompat #75534
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
e5aba8d
to
4136251
Compare
Not familiar with this part of the code. r? @pnkfelix maybe? |
This comment has been minimized.
This comment has been minimized.
4136251
to
cd05d1f
Compare
This comment has been minimized.
This comment has been minimized.
cd05d1f
to
ea4b894
Compare
This comment has been minimized.
This comment has been minimized.
ea4b894
to
6b1fbfb
Compare
This comment has been minimized.
This comment has been minimized.
6b1fbfb
to
e20ee5d
Compare
@pnkfelix: This is now ready for review |
e20ee5d
to
6f7453b
Compare
This comment has been minimized.
This comment has been minimized.
6f7453b
to
f86f364
Compare
@pnkfelix: Are there any changes that you'd like me to make? |
☔ The latest upstream changes (presumably #70743) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
f86f364
to
042af45
Compare
@pnkfelix: Do you think you'll be able to review this sometime soon? There are several issues that would benefit from having this available. |
☔ The latest upstream changes (presumably #77557) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
⌛ Testing commit 6db00a2 with merge 7bcd889ebca66a5d5e6224220bc58bca2a240ddf... |
💔 Test failed - checks-actions |
@bors retry |
☀️ Test successful - checks-actions |
Fixes rust-lang#78660 With PR rust-lang#75534 merged, we now run more lint-related code for future-incompat-report, even when their final level is Allow. Some lint-related code was not expecting `Level::Allow`, and had an explicit panic. This PR explicitly tracks the lint level set on the command line before `--cap-lints` is applied. This is used to emit a more precise error note (e.g. we don't say that `-W lint-name` was specified on the command line just because a lint was capped to Warn). As a result, we can now correctly emit a note that `-A` was used if we got `Level::Allow` from the command line (before the cap is applied).
…tmandry Fix ICE when a future-incompat-report has its command-line level capped Fixes rust-lang#78660 With PR rust-lang#75534 merged, we now run more lint-related code for future-incompat-report, even when their final level is Allow. Some lint-related code was not expecting `Level::Allow`, and had an explicit panic. This PR explicitly tracks the lint level set on the command line before `--cap-lints` is applied. This is used to emit a more precise error note (e.g. we don't say that `-W lint-name` was specified on the command line just because a lint was capped to Warn). As a result, we can now correctly emit a note that `-A` was used if we got `Level::Allow` from the command line (before the cap is applied).
…, r=pnkfelix Implement rustc side of report-future-incompat cc rust-lang#71249 This is an alternative to `@pnkfelix's` initial implementation in https://github.com/pnkfelix/rust/commits/prototype-rustc-side-of-report-future-incompat (mainly because I started working before seeing that branch 😄 ). My approach outputs the entire original `Diagnostic`, in a way that is compatible with incremental compilation. This is not yet integrated with compiletest, but can be used manually by passing `-Z emit-future-incompat-report` to `rustc`. Several changes are made to support this feature: * The `librustc_session/lint` module is moved to a new crate `librustc_lint_defs` (name bikesheddable). This allows accessing lint definitions from `librustc_errors`. * The `Lint` struct is extended with an `Option<FutureBreakage>`. When present, it indicates that we should display a lint in the future-compat report. `FutureBreakage` contains additional information that we may want to display in the report (currently, a `date` field indicating when the crate will stop compiling). * A new variant `rustc_error::Level::Allow` is added. This is used when constructing a diagnostic for a future-breakage lint that is marked as allowed (via `#[allow]` or `--cap-lints`). This allows us to capture any future-breakage diagnostics in one place, while still discarding them before they are passed to the `Emitter`. * `DiagnosticId::Lint` is extended with a `has_future_breakage` field, indicating whether or not the `Lint` has future breakage information (and should therefore show up in the report). * `Session` is given access to the `LintStore` via a new `SessionLintStore` trait (since `librustc_session` cannot directly reference `LintStore` without a cyclic dependency). We use this to turn a string `DiagnosticId::Lint` back into a `Lint`, to retrieve the `FutureBreakage` data. Currently, `FutureBreakage.date` is always set to `None`. However, this could potentially be interpreted by Cargo in the future. I've enabled the future-breakage report for the `ARRAY_INTO_ITER` lint, which can be used to test out this PR. The intent is to use the field to allow Cargo to determine the date of future breakage (as described in [RFC 2834](https://github.com/rust-lang/rfcs/blob/master/text/2834-cargo-report-future-incompat.md)) without needing to parse the diagnostic itself. cc `@pnkfelix`
rustc_session: Remove lint store from `Session` It was added in rust-lang#75534, but after the cleanup in rust-lang#87070 it's no longer necessary.
rustc_session: Remove lint store from `Session` It was added in rust-lang#75534, but after the cleanup in rust-lang#87070 it's no longer necessary.
cc #71249
This is an alternative to @pnkfelix's initial implementation in https://github.com/pnkfelix/rust/commits/prototype-rustc-side-of-report-future-incompat (mainly because I started working before seeing that branch 😄 ).
My approach outputs the entire original
Diagnostic
, in a way that is compatible with incremental compilation. This is not yet integrated with compiletest, but can be used manually by passing-Z emit-future-incompat-report
torustc
.Several changes are made to support this feature:
librustc_session/lint
module is moved to a new cratelibrustc_lint_defs
(name bikesheddable). This allows accessing lint definitions fromlibrustc_errors
.Lint
struct is extended with anOption<FutureBreakage>
. When present, it indicates that we should display a lint in the future-compat report.FutureBreakage
contains additional information that we may want to display in the report (currently, adate
field indicating when the crate will stop compiling).rustc_error::Level::Allow
is added. This is used when constructing a diagnostic for a future-breakage lint that is marked as allowed (via#[allow]
or--cap-lints
). This allows us to capture any future-breakage diagnostics in one place, while still discarding them before they are passed to theEmitter
.DiagnosticId::Lint
is extended with ahas_future_breakage
field, indicating whether or not theLint
has future breakage information (and should therefore show up in the report).Session
is given access to theLintStore
via a newSessionLintStore
trait (sincelibrustc_session
cannot directly referenceLintStore
without a cyclic dependency). We use this to turn a stringDiagnosticId::Lint
back into aLint
, to retrieve theFutureBreakage
data.Currently,
FutureBreakage.date
is always set toNone
. However, this could potentially be interpreted by Cargo in the future.I've enabled the future-breakage report for the
ARRAY_INTO_ITER
lint, which can be used to test out this PR. The intent is to use the field to allow Cargo to determine the date of future breakage (as described in RFC 2834) without needing to parse the diagnostic itself.cc @pnkfelix