]> git.lizzy.rs Git - rust.git/commitdiff
add comment explaining read permissions
authorSikkema, Isaac <sikkemaic@ornl.gov>
Tue, 20 Sep 2022 14:06:50 +0000 (10:06 -0400)
committerSikkema, Isaac <sikkemaic@ornl.gov>
Tue, 20 Sep 2022 14:06:50 +0000 (10:06 -0400)
compiler/rustc_serialize/src/opaque.rs

index f9edb073a2df7c813acab17fb88f8f259e977687..f35cc08f4fbfe61eb663c4f53bfd0b0ff8021424 100644 (file)
@@ -193,6 +193,8 @@ pub fn with_capacity<P: AsRef<Path>>(path: P, capacity: usize) -> io::Result<Sel
         // 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 {