Skip to content

Commit

Permalink
add comment explaining read permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sikkema, Isaac committed Sep 20, 2022
1 parent 06139e5 commit a2cb8a4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_serialize/src/opaque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ impl FileEncoder {
// shaves an instruction off those code paths (on x86 at least).
assert!(capacity <= usize::MAX - max_leb128_len());

// Create the file for reading and writing, because some encoders do both
// (e.g. the metadata encoder when -Zmeta-stats is enabled)
let file = File::options().read(true).write(true).create(true).truncate(true).open(path)?;

Ok(FileEncoder {
Expand Down

0 comments on commit a2cb8a4

Please sign in to comment.