We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 14b27cf + a2cb8a4 commit 3f377d3Copy full SHA for 3f377d3
compiler/rustc_serialize/src/opaque.rs
@@ -193,7 +193,9 @@ impl FileEncoder {
193
// shaves an instruction off those code paths (on x86 at least).
194
assert!(capacity <= usize::MAX - max_leb128_len());
195
196
- let file = File::create(path)?;
+ // Create the file for reading and writing, because some encoders do both
197
+ // (e.g. the metadata encoder when -Zmeta-stats is enabled)
198
+ let file = File::options().read(true).write(true).create(true).truncate(true).open(path)?;
199
200
Ok(FileEncoder {
201
buf: Box::new_uninit_slice(capacity),
0 commit comments