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
Auto merge of rust-lang#124686 - saethlin:rust-file-footer, r=fmease
Add a footer in FileEncoder and check for it in MemDecoder
We have a few reports of ICEs due to decoding failures, where the fault does not lie with the compiler. The goal of this PR is to add some very lightweight and on-by-default validation to the compiler's outputs. If validation fails, we emit a fatal error for rmeta files in general that mentions the path that didn't load, and for incremental compilation artifacts we emit a verbose warning that tries to explain the situation and treat the artifacts as outdated.
The validation currently implemented here is very crude, and yet I think we have 11 ICE reports currently open (you can find them by searching issues for `1002111927320821928687967599834759150`) which this simple validation would have detected. The structure of the code changes here should permit the addition of further validation code, such as a checksum, if it is merited. I would like to have code to detect corruption such as reported in rust-lang#124719, but I'm not yet sure how to do that efficiently, and this PR is already a good size.
The ICE reports I have in mind that this PR would have smoothed over are:
rust-lang#124469rust-lang#123352rust-lang#123376 [^1]
rust-lang#99763rust-lang#93900.
---
[^1]: This one might be a compiler bug, but even if it is I think the workflow described is pushing the envelope of what we can support. This issue is one of the reasons this warning still asks people to file an issue.
Copy file name to clipboardexpand all lines: compiler/rustc_driver_impl/messages.ftl
+2
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@ driver_impl_ice_path_error = the ICE couldn't be written to `{$path}`: {$error}
10
10
driver_impl_ice_path_error_env = the environment variable `RUSTC_ICE` is set to `{$env_var}`
11
11
driver_impl_ice_version = rustc {$version} running on {$triple}
12
12
13
+
driver_impl_rlink_corrupt_file = corrupt metadata encountered in `{$file}`
14
+
13
15
driver_impl_rlink_empty_version_number = The input does not contain version number
14
16
15
17
driver_impl_rlink_encoding_version_mismatch = .rlink file was produced with encoding version `{$version_array}`, but the current version is `{$rlink_version}`
Copy file name to clipboardexpand all lines: compiler/rustc_incremental/messages.ftl
+2
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,8 @@ incremental_cargo_help_2 =
21
21
incremental_copy_workproduct_to_cache =
22
22
error copying object file `{$from}` to incremental directory as `{$to}`: {$err}
23
23
24
+
incremental_corrupt_file = corrupt incremental compilation artifact found at `{$path}`. This file will automatically be ignored and deleted. If you see this message repeatedly or can provoke it without manually manipulating the compiler's artifacts, please file an issue. The incremental compilation system relies on hardlinks and filesystem locks behaving correctly, and may not deal well with OS crashes, so whatever information you can provide about your filesystem or other state may be very relevant.
25
+
24
26
incremental_create_dep_graph = failed to create dependency graph at `{$path}`: {$err}
0 commit comments