diff options
| author | bors <bors@rust-lang.org> | 2024-09-25 04:57:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-25 04:57:12 +0000 |
| commit | 4c62024cd5dbafb64941bded422e4fbc2a100e73 (patch) | |
| tree | d53288325071e253910a6b5ffbdef798a43a08a1 /compiler/rustc_mir_dataflow/src | |
| parent | 1b5aa96d6016bafe50e071b45d4d2e3c90fd766f (diff) | |
| parent | 458537ebc0e7d893103e03450f8830061bab1b2d (diff) | |
| download | rust-4c62024cd5dbafb64941bded422e4fbc2a100e73.tar.gz rust-4c62024cd5dbafb64941bded422e4fbc2a100e73.zip | |
Auto merge of #130803 - cuviper:file-buffered, r=joshtriplett
Add `File` constructors that return files wrapped with a buffer In addition to the light convenience, these are intended to raise visibility that buffering is something you should consider when opening a file, since unbuffered I/O is a common performance footgun to Rust newcomers. ACP: https://github.com/rust-lang/libs-team/issues/446 Tracking Issue: #130804
Diffstat (limited to 'compiler/rustc_mir_dataflow/src')
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/framework/engine.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/lib.rs | 1 |
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_mir_dataflow/src/framework/engine.rs b/compiler/rustc_mir_dataflow/src/framework/engine.rs index 947bdf860b5..da01a974094 100644 --- a/compiler/rustc_mir_dataflow/src/framework/engine.rs +++ b/compiler/rustc_mir_dataflow/src/framework/engine.rs @@ -266,7 +266,7 @@ where A::Domain: DebugWithContext<A>, { use std::fs; - use std::io::{self, Write}; + use std::io::Write; let def_id = body.source.def_id(); let Ok(attrs) = RustcMirAttrs::parse(tcx, def_id) else { @@ -281,8 +281,7 @@ where if let Some(parent) = path.parent() { fs::create_dir_all(parent)?; } - let f = fs::File::create(&path)?; - io::BufWriter::new(f) + fs::File::create_buffered(&path)? } None if dump_enabled(tcx, A::NAME, def_id) => { diff --git a/compiler/rustc_mir_dataflow/src/lib.rs b/compiler/rustc_mir_dataflow/src/lib.rs index cb7c7edc413..cd926c07641 100644 --- a/compiler/rustc_mir_dataflow/src/lib.rs +++ b/compiler/rustc_mir_dataflow/src/lib.rs @@ -3,6 +3,7 @@ #![feature(associated_type_defaults)] #![feature(box_patterns)] #![feature(exact_size_is_empty)] +#![feature(file_buffered)] #![feature(let_chains)] #![feature(try_blocks)] #![warn(unreachable_pub)] |
