You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
"`cargo describe-future-incompatibilities` can only be used on the nightly channel"
25
+
)
26
+
.into());
27
+
}
28
+
29
+
let ws = args.workspace(config)?;
30
+
let report_file = ws.target_dir().open_ro(
31
+
FUTURE_INCOMPAT_FILE,
32
+
ws.config(),
33
+
"Future incompatible report",
34
+
)?;
35
+
36
+
letmut file_contents = String::new();
37
+
report_file
38
+
.file()
39
+
.read_to_string(&mut file_contents)
40
+
.map_err(|e| anyhow!("Failed to read report: {:?}", e))?;
41
+
let on_disk_report:OnDiskReport = serde_json::from_str(&file_contents).unwrap();
42
+
43
+
let id = args.value_of("id").unwrap();
44
+
if id != on_disk_report.id{
45
+
returnErr(anyhow!("Expected an id of `{}`, but `{}` was provided on the command line. Your report may have been overwritten by a different one.", on_disk_report.id, id).into());
0 commit comments