-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Tracking Issue for cargo report future-incompat #71249
Comments
I'm interested in working on this. Would it be better to add additional data to each JSON diagnostic message (e.g. |
Hi @Aaron1011 ; come on over to the zulip thread for the MCP and we can discuss more. (In the MCP I went with "single summary" at the end, but we can talk more about the options on zulip.) |
I have a pull request up at #75534 |
…ge, 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
…, 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`
Implement rustc side of report-future-incompat cc rust-lang/rust#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`
The rustc side of this was implemented in #75534 |
@Aaron1011 I was wondering if you are interested in stabilizing this. I don't think there are any major blockers, and at least on the Cargo side we feel comfortable moving forward as long as the compiler team is very conservative with enabling new lints until we've had some more real-world experience. |
@ehuss: I'm currently working on a PR that improves the output, based on @LukasKalbertodt's suggestion in #71249 (comment). Once that's done, I think this feature should be ready to stabilize. |
When `cargo report future-incompatibilities` is stabilized (see rust-lang#71249), this will cause dependencies that trigger this lint to be included in the report.
…esleywiser Make `proc_macro_derive_resolution_fallback` a future-breakage lint When `cargo report future-incompatibilities` is stabilized (see rust-lang#71249), this will cause dependencies that trigger this lint to be included in the report.
…esleywiser Make `proc_macro_derive_resolution_fallback` a future-breakage lint When `cargo report future-incompatibilities` is stabilized (see rust-lang#71249), this will cause dependencies that trigger this lint to be included in the report.
@ehuss: Now that rust-lang/cargo#9953 has been merged, I think this should be ready for stabilization. |
Sure, let's go ahead and do an FCP on this issue with both teams. @rfcbot fcp merge Stabilization ReportThis is a proposal to stabilize the future-incompat feature. Example usageTo test it out (please do, this has had little testing), create a Cargo project with: [dependencies]
rental = "=0.5.5" And run
To view the report, run Report Output
Running with
The report command also supports the When stabilized, the Report interfaceCurrently, {
/* An array of objects describing a warning that will become a hard error
in the future.
*/
"future_incompat_report":
[
{
/* A diagnostic structure as defined in
https://doc.rust-lang.org/rustc/json.html#diagnostics
*/
"diagnostic": {...},
}
]
} This structure is somewhat bare now, but is intended to support additions in the future. This is emitted towards the end of compilation. Cargo intercepts these messages and stores them on disk, and reports a message to the console before exiting. Warning silencingIn situations where a user cannot update the offending code, they can silence the warning using a cargo config value: [future-incompat-report]
# Value is "never" or "always"
frequency = "never" Warning opt-inCurrently there are only two warnings which will trigger a report: A lint must explicitly opt-in to triggering a report using the ImplementationInternally, rustc buffers any lint that fires that is marked with Cargo intercepts these messages here. It has a module here for generating reports and saving them to disk and displaying them. Warning transitionsThe Cargo team is willing to stabilize this with the understanding from the compiler team that they will be very conservative in adding new lints to be reported as this is rolled out. We would like to get some experience with users for a while on the stable channel so that we can respond to any changes that are needed to the reporting experience. This also has the potential to be a sensitive issue, as Rust emphasizes being stable, but this is explicitly breaking that stability (though hopefully for justified reasons). Future incompatible lints should have a lifecycle, perhaps something like the following:
I think it is up to the compiler team what the timeframes in-between steps should be, but hopefully conservative (and depending on the severity and urgency of making the change). RFC deviations
Known bugs
Unresolved questionsThe questions above that aren't resolved:
Other notes
|
Team member @ehuss has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
cc @estebank @michaelwoerister @nagisa @nikomatsakis @pnkfelix @wesleywiser - when you get a chance, can you review the FCP? |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
…, r=nagisa Stabilize `-Z emit-future-incompat` as `--json future-incompat` The FCP was completed in rust-lang#71249
This has now been stabilized in both rustc and cargo! |
🎉 This is now available in the latest nightly release (2021-12-09). Thanks @Aaron1011! Closing as this is now complete. |
This is a tracking issue for the RFC "Cargo report future-incompat" (rust-lang/rfcs#2834).
There is no feature gate for the issue (the changes are not language visible).
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
Unresolved Questions
cargo describe-future-incompatibilities
, they do that, and the message isn't colored. Ideally I would think the report data would be saved to the file in a more raw form, and then just re-render it as requested (instead of capturing the color at build time). DONE: Updates to future-incompatible reporting. cargo#9606cargo watch
), it doesn't make it difficult to view a report. I think it should save the reports as an array, and just trim it to at most N reports. It could also use monotonic numeric IDs instead of the strange random IDs (the next ID could be computed by 1+ the max ID in the file). Then the report command could default to showing the report with the greatest ID when not given an ID. DONE: Updates to future-incompatible reporting. cargo#9606cargo report
subcommand that would subsume all user-report functionality (rather than having a bunch of top-level subcommands). This could replacedescribe-future-incompatibilities
with something likecargo report future-incompatibilities
. Addreport
subcommand. cargo#9438--future-incompat-report
, if there are zero warnings, it should probably say so. Emit note when--future-incompat-report
had nothing to report cargo#9263Implementation history
--future-incompat-report
had nothing to report cargo#9263: Emit note when--future-incompat-report
had nothing to reportreport
subcommand. cargo#9438: Rename tocargo report future-incompatibilities
The text was updated successfully, but these errors were encountered: