|
1 |
| -//! Support for future-incompatible warning reporting. |
| 1 | +//! Support for [future-incompatible warning reporting][1]. |
| 2 | +//! |
| 3 | +//! Here is an overview of how Cargo handles future-incompatible reports. |
| 4 | +//! |
| 5 | +//! ## Receive reports from the compiler |
| 6 | +//! |
| 7 | +//! When receiving a compiler message during a build, if it is effectively |
| 8 | +//! a [`FutureIncompatReport`], Cargo gathers and forwards it as a |
| 9 | +//! `Message::FutureIncompatReport` to the main thread. |
| 10 | +//! |
| 11 | +//! To have the correct layout of strucutures for deserializing a report |
| 12 | +//! emitted by the compiler, most of structure definitions, for example |
| 13 | +//! [`FutureIncompatReport`], are copied either partially or entirely from |
| 14 | +//! [compiler/rustc_errors/src/json.rs][2] in rust-lang/rust repository. |
| 15 | +//! |
| 16 | +//! ## Persist reports on disk |
| 17 | +//! |
| 18 | +//! When a build comes to an end, by calling [`save_and_display_report`] |
| 19 | +//! Cargo saves the report on disk, and displays it directly if requested |
| 20 | +//! via command line or configuration. The information of the on-disk file can |
| 21 | +//! be found in [`FUTURE_INCOMPAT_FILE`]. |
| 22 | +//! |
| 23 | +//! During the persistent process, Cargo will attempt to query the source of |
| 24 | +//! each package emitting the report, for the sake of providing an upgrade |
| 25 | +//! information as a solution to fix the incompatibility. |
| 26 | +//! |
| 27 | +//! ## Display reports to users |
| 28 | +//! |
| 29 | +//! Users can run `cargo report future-incompat` to retrieve a report. This is |
| 30 | +//! done by [`OnDiskReports::load`]. Cargo simply prints reports to the |
| 31 | +//! standard output. |
| 32 | +//! |
| 33 | +//! [1]: https://doc.rust-lang.org/nightly/cargo/reference/future-incompat-report.html |
| 34 | +//! [2]: https://github.com/rust-lang/rust/blob/9bb6e60d1f1360234aae90c97964c0fa5524f141/compiler/rustc_errors/src/json.rs#L312-L315 |
2 | 35 |
|
3 | 36 | use crate::core::compiler::BuildContext;
|
4 | 37 | use crate::core::{Dependency, PackageId, QueryKind, Workspace};
|
|
0 commit comments