Dogfood feature(file_buffered)
This commit is contained in:
parent
1e9a50dde8
commit
0999b019f8
@ -1,7 +1,7 @@
|
|||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::{BufWriter, Write};
|
use std::io::Write;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use polonius_engine::{AllFacts as PoloniusFacts, Atom};
|
use polonius_engine::{AllFacts as PoloniusFacts, Atom};
|
||||||
@ -127,7 +127,7 @@ fn write_facts_to_path<T>(&self, rows: &[T], file_name: &str) -> Result<(), Box<
|
|||||||
T: FactRow,
|
T: FactRow,
|
||||||
{
|
{
|
||||||
let file = &self.dir.join(file_name);
|
let file = &self.dir.join(file_name);
|
||||||
let mut file = BufWriter::new(File::create(file)?);
|
let mut file = File::create_buffered(file)?;
|
||||||
for row in rows {
|
for row in rows {
|
||||||
row.write(&mut file, self.location_table)?;
|
row.write(&mut file, self.location_table)?;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#![feature(assert_matches)]
|
#![feature(assert_matches)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(control_flow_enum)]
|
#![feature(control_flow_enum)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
|
@ -808,8 +808,7 @@ struct ThinLTOKeysMap {
|
|||||||
impl ThinLTOKeysMap {
|
impl ThinLTOKeysMap {
|
||||||
fn save_to_file(&self, path: &Path) -> io::Result<()> {
|
fn save_to_file(&self, path: &Path) -> io::Result<()> {
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
let file = File::create(path)?;
|
let mut writer = File::create_buffered(path)?;
|
||||||
let mut writer = io::BufWriter::new(file);
|
|
||||||
// The entries are loaded back into a hash map in `load_from_file()`, so
|
// The entries are loaded back into a hash map in `load_from_file()`, so
|
||||||
// the order in which we write them to file here does not matter.
|
// the order in which we write them to file here does not matter.
|
||||||
for (module, key) in &self.keys {
|
for (module, key) in &self.keys {
|
||||||
@ -821,8 +820,8 @@ fn save_to_file(&self, path: &Path) -> io::Result<()> {
|
|||||||
fn load_from_file(path: &Path) -> io::Result<Self> {
|
fn load_from_file(path: &Path) -> io::Result<Self> {
|
||||||
use std::io::BufRead;
|
use std::io::BufRead;
|
||||||
let mut keys = BTreeMap::default();
|
let mut keys = BTreeMap::default();
|
||||||
let file = File::open(path)?;
|
let file = File::open_buffered(path)?;
|
||||||
for line in io::BufReader::new(file).lines() {
|
for line in file.lines() {
|
||||||
let line = line?;
|
let line = line?;
|
||||||
let mut split = line.split(' ');
|
let mut split = line.split(' ');
|
||||||
let module = split.next().unwrap();
|
let module = split.next().unwrap();
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#![feature(assert_matches)]
|
#![feature(assert_matches)]
|
||||||
#![feature(exact_size_is_empty)]
|
#![feature(exact_size_is_empty)]
|
||||||
#![feature(extern_types)]
|
#![feature(extern_types)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(hash_raw_entry)]
|
#![feature(hash_raw_entry)]
|
||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
#![feature(iter_intersperse)]
|
#![feature(iter_intersperse)]
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::io::{self, BufWriter};
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::{env, iter, mem, str};
|
use std::{env, io, iter, mem, str};
|
||||||
|
|
||||||
use cc::windows_registry;
|
use cc::windows_registry;
|
||||||
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
|
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
|
||||||
@ -754,7 +753,7 @@ fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType, symbols: &[St
|
|||||||
if self.sess.target.is_like_osx {
|
if self.sess.target.is_like_osx {
|
||||||
// Write a plain, newline-separated list of symbols
|
// Write a plain, newline-separated list of symbols
|
||||||
let res: io::Result<()> = try {
|
let res: io::Result<()> = try {
|
||||||
let mut f = BufWriter::new(File::create(&path)?);
|
let mut f = File::create_buffered(&path)?;
|
||||||
for sym in symbols {
|
for sym in symbols {
|
||||||
debug!(" _{sym}");
|
debug!(" _{sym}");
|
||||||
writeln!(f, "_{sym}")?;
|
writeln!(f, "_{sym}")?;
|
||||||
@ -765,7 +764,7 @@ fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType, symbols: &[St
|
|||||||
}
|
}
|
||||||
} else if is_windows {
|
} else if is_windows {
|
||||||
let res: io::Result<()> = try {
|
let res: io::Result<()> = try {
|
||||||
let mut f = BufWriter::new(File::create(&path)?);
|
let mut f = File::create_buffered(&path)?;
|
||||||
|
|
||||||
// .def file similar to MSVC one but without LIBRARY section
|
// .def file similar to MSVC one but without LIBRARY section
|
||||||
// because LD doesn't like when it's empty
|
// because LD doesn't like when it's empty
|
||||||
@ -781,7 +780,7 @@ fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType, symbols: &[St
|
|||||||
} else {
|
} else {
|
||||||
// Write an LD version script
|
// Write an LD version script
|
||||||
let res: io::Result<()> = try {
|
let res: io::Result<()> = try {
|
||||||
let mut f = BufWriter::new(File::create(&path)?);
|
let mut f = File::create_buffered(&path)?;
|
||||||
writeln!(f, "{{")?;
|
writeln!(f, "{{")?;
|
||||||
if !symbols.is_empty() {
|
if !symbols.is_empty() {
|
||||||
writeln!(f, " global:")?;
|
writeln!(f, " global:")?;
|
||||||
@ -1059,7 +1058,7 @@ fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType, symbols: &[St
|
|||||||
|
|
||||||
let path = tmpdir.join("lib.def");
|
let path = tmpdir.join("lib.def");
|
||||||
let res: io::Result<()> = try {
|
let res: io::Result<()> = try {
|
||||||
let mut f = BufWriter::new(File::create(&path)?);
|
let mut f = File::create_buffered(&path)?;
|
||||||
|
|
||||||
// Start off with the standard module name header and then go
|
// Start off with the standard module name header and then go
|
||||||
// straight to exports.
|
// straight to exports.
|
||||||
@ -1648,7 +1647,7 @@ fn no_default_libraries(&mut self) {}
|
|||||||
fn export_symbols(&mut self, tmpdir: &Path, _crate_type: CrateType, symbols: &[String]) {
|
fn export_symbols(&mut self, tmpdir: &Path, _crate_type: CrateType, symbols: &[String]) {
|
||||||
let path = tmpdir.join("list.exp");
|
let path = tmpdir.join("list.exp");
|
||||||
let res: io::Result<()> = try {
|
let res: io::Result<()> = try {
|
||||||
let mut f = BufWriter::new(File::create(&path)?);
|
let mut f = File::create_buffered(&path)?;
|
||||||
// FIXME: use llvm-nm to generate export list.
|
// FIXME: use llvm-nm to generate export list.
|
||||||
for symbol in symbols {
|
for symbol in symbols {
|
||||||
debug!(" _{symbol}");
|
debug!(" _{symbol}");
|
||||||
@ -1961,7 +1960,7 @@ fn ehcont_guard(&mut self) {}
|
|||||||
fn export_symbols(&mut self, tmpdir: &Path, _crate_type: CrateType, symbols: &[String]) {
|
fn export_symbols(&mut self, tmpdir: &Path, _crate_type: CrateType, symbols: &[String]) {
|
||||||
let path = tmpdir.join("symbols");
|
let path = tmpdir.join("symbols");
|
||||||
let res: io::Result<()> = try {
|
let res: io::Result<()> = try {
|
||||||
let mut f = BufWriter::new(File::create(&path)?);
|
let mut f = File::create_buffered(&path)?;
|
||||||
for sym in symbols {
|
for sym in symbols {
|
||||||
writeln!(f, "{sym}")?;
|
writeln!(f, "{sym}")?;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#![doc(rust_logo)]
|
#![doc(rust_logo)]
|
||||||
#![feature(assert_matches)]
|
#![feature(assert_matches)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![feature(negative_impls)]
|
#![feature(negative_impls)]
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#![feature(cfg_match)]
|
#![feature(cfg_match)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(extend_one)]
|
#![feature(extend_one)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(hash_raw_entry)]
|
#![feature(hash_raw_entry)]
|
||||||
#![feature(macro_metavar_expr)]
|
#![feature(macro_metavar_expr)]
|
||||||
#![feature(map_try_insert)]
|
#![feature(map_try_insert)]
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use std::env::var_os;
|
use std::env::var_os;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::BufWriter;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
|
||||||
@ -33,7 +32,7 @@ pub fn dump_graphviz<P: AsRef<Path>>(&self, dir: P, description: &str) {
|
|||||||
|
|
||||||
let file_path = dir.as_ref().join(format!("{counter:010}_{description}.gv"));
|
let file_path = dir.as_ref().join(format!("{counter:010}_{description}.gv"));
|
||||||
|
|
||||||
let mut gv_file = BufWriter::new(File::create(file_path).unwrap());
|
let mut gv_file = File::create_buffered(file_path).unwrap();
|
||||||
|
|
||||||
dot::render(&self, &mut gv_file).unwrap();
|
dot::render(&self, &mut gv_file).unwrap();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::{BufWriter, Write};
|
use std::io::Write;
|
||||||
|
|
||||||
use rustc_data_structures::fx::FxIndexSet;
|
use rustc_data_structures::fx::FxIndexSet;
|
||||||
use rustc_data_structures::graph::implementation::{Direction, INCOMING, NodeIndex, OUTGOING};
|
use rustc_data_structures::graph::implementation::{Direction, INCOMING, NodeIndex, OUTGOING};
|
||||||
@ -245,7 +245,7 @@ fn dump_graph(query: &DepGraphQuery) {
|
|||||||
{
|
{
|
||||||
// dump a .txt file with just the edges:
|
// dump a .txt file with just the edges:
|
||||||
let txt_path = format!("{path}.txt");
|
let txt_path = format!("{path}.txt");
|
||||||
let mut file = BufWriter::new(File::create(&txt_path).unwrap());
|
let mut file = File::create_buffered(&txt_path).unwrap();
|
||||||
for (source, target) in &edges {
|
for (source, target) in &edges {
|
||||||
write!(file, "{source:?} -> {target:?}\n").unwrap();
|
write!(file, "{source:?} -> {target:?}\n").unwrap();
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||||
#![doc(rust_logo)]
|
#![doc(rust_logo)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(rustdoc_internals)]
|
#![feature(rustdoc_internals)]
|
||||||
#![warn(unreachable_pub)]
|
#![warn(unreachable_pub)]
|
||||||
// tidy-alphabetical-end
|
// tidy-alphabetical-end
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// tidy-alphabetical-start
|
// tidy-alphabetical-start
|
||||||
#![feature(decl_macro)]
|
#![feature(decl_macro)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![feature(try_blocks)]
|
#![feature(try_blocks)]
|
||||||
#![warn(unreachable_pub)]
|
#![warn(unreachable_pub)]
|
||||||
|
@ -519,7 +519,7 @@ fn write_out_deps(tcx: TyCtxt<'_>, outputs: &OutputFilenames, out_filenames: &[P
|
|||||||
write_deps_to_file(&mut file)?;
|
write_deps_to_file(&mut file)?;
|
||||||
}
|
}
|
||||||
OutFileName::Real(ref path) => {
|
OutFileName::Real(ref path) => {
|
||||||
let mut file = BufWriter::new(fs::File::create(path)?);
|
let mut file = fs::File::create_buffered(path)?;
|
||||||
write_deps_to_file(&mut file)?;
|
write_deps_to_file(&mut file)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,8 +128,7 @@ pub fn non_durable_rename(src: &Path, dst: &Path) -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn copy_to_stdout(from: &Path) -> io::Result<()> {
|
pub fn copy_to_stdout(from: &Path) -> io::Result<()> {
|
||||||
let file = fs::File::open(from)?;
|
let mut reader = fs::File::open_buffered(from)?;
|
||||||
let mut reader = io::BufReader::new(file);
|
|
||||||
let mut stdout = io::stdout();
|
let mut stdout = io::stdout();
|
||||||
io::copy(&mut reader, &mut stdout)?;
|
io::copy(&mut reader, &mut stdout)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#![feature(decl_macro)]
|
#![feature(decl_macro)]
|
||||||
#![feature(error_iter)]
|
#![feature(error_iter)]
|
||||||
#![feature(extract_if)]
|
#![feature(extract_if)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
#![feature(iter_from_coroutine)]
|
#![feature(iter_from_coroutine)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#![feature(discriminant_kind)]
|
#![feature(discriminant_kind)]
|
||||||
#![feature(extern_types)]
|
#![feature(extern_types)]
|
||||||
#![feature(extract_if)]
|
#![feature(extract_if)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
#![feature(intra_doc_pointers)]
|
#![feature(intra_doc_pointers)]
|
||||||
#![feature(iter_from_coroutine)]
|
#![feature(iter_from_coroutine)]
|
||||||
|
@ -277,9 +277,9 @@ pub fn create_dump_file<'tcx>(
|
|||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
Ok(io::BufWriter::new(fs::File::create(&file_path).map_err(|e| {
|
Ok(fs::File::create_buffered(&file_path).map_err(|e| {
|
||||||
io::Error::new(e.kind(), format!("IO error creating MIR dump file: {file_path:?}; {e}"))
|
io::Error::new(e.kind(), format!("IO error creating MIR dump file: {file_path:?}; {e}"))
|
||||||
})?))
|
})?)
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -266,7 +266,7 @@ fn write_graphviz_results<'tcx, A>(
|
|||||||
A::Domain: DebugWithContext<A>,
|
A::Domain: DebugWithContext<A>,
|
||||||
{
|
{
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{self, Write};
|
use std::io::Write;
|
||||||
|
|
||||||
let def_id = body.source.def_id();
|
let def_id = body.source.def_id();
|
||||||
let Ok(attrs) = RustcMirAttrs::parse(tcx, def_id) else {
|
let Ok(attrs) = RustcMirAttrs::parse(tcx, def_id) else {
|
||||||
@ -281,8 +281,7 @@ fn write_graphviz_results<'tcx, A>(
|
|||||||
if let Some(parent) = path.parent() {
|
if let Some(parent) = path.parent() {
|
||||||
fs::create_dir_all(parent)?;
|
fs::create_dir_all(parent)?;
|
||||||
}
|
}
|
||||||
let f = fs::File::create(&path)?;
|
fs::File::create_buffered(&path)?
|
||||||
io::BufWriter::new(f)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
None if dump_enabled(tcx, A::NAME, def_id) => {
|
None if dump_enabled(tcx, A::NAME, def_id) => {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#![feature(associated_type_defaults)]
|
#![feature(associated_type_defaults)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(exact_size_is_empty)]
|
#![feature(exact_size_is_empty)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![feature(try_blocks)]
|
#![feature(try_blocks)]
|
||||||
#![warn(unreachable_pub)]
|
#![warn(unreachable_pub)]
|
||||||
|
@ -24,7 +24,7 @@ pub fn emit_mir(tcx: TyCtxt<'_>) -> io::Result<()> {
|
|||||||
write_mir_pretty(tcx, None, &mut f)?;
|
write_mir_pretty(tcx, None, &mut f)?;
|
||||||
}
|
}
|
||||||
OutFileName::Real(path) => {
|
OutFileName::Real(path) => {
|
||||||
let mut f = io::BufWriter::new(File::create(&path)?);
|
let mut f = File::create_buffered(&path)?;
|
||||||
write_mir_pretty(tcx, None, &mut f)?;
|
write_mir_pretty(tcx, None, &mut f)?;
|
||||||
if tcx.sess.opts.json_artifact_notifications {
|
if tcx.sess.opts.json_artifact_notifications {
|
||||||
tcx.dcx().emit_artifact_notification(&path, "mir");
|
tcx.dcx().emit_artifact_notification(&path, "mir");
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(const_type_name)]
|
#![feature(const_type_name)]
|
||||||
#![feature(cow_is_borrowed)]
|
#![feature(cow_is_borrowed)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// tidy-alphabetical-start
|
// tidy-alphabetical-start
|
||||||
#![feature(array_windows)]
|
#![feature(array_windows)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![warn(unreachable_pub)]
|
#![warn(unreachable_pub)]
|
||||||
|
@ -95,7 +95,7 @@
|
|||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::{BufWriter, Write};
|
use std::io::Write;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||||
@ -1243,8 +1243,7 @@ fn dump_mono_items_stats<'tcx>(
|
|||||||
let ext = format.extension();
|
let ext = format.extension();
|
||||||
let filename = format!("{crate_name}.mono_items.{ext}");
|
let filename = format!("{crate_name}.mono_items.{ext}");
|
||||||
let output_path = output_directory.join(&filename);
|
let output_path = output_directory.join(&filename);
|
||||||
let file = File::create(&output_path)?;
|
let mut file = File::create_buffered(&output_path)?;
|
||||||
let mut file = BufWriter::new(file);
|
|
||||||
|
|
||||||
// Gather instantiated mono items grouped by def_id
|
// Gather instantiated mono items grouped by def_id
|
||||||
let mut items_per_def_id: FxIndexMap<_, Vec<_>> = Default::default();
|
let mut items_per_def_id: FxIndexMap<_, Vec<_>> = Default::default();
|
||||||
|
@ -517,7 +517,7 @@ mod cgroups {
|
|||||||
use crate::borrow::Cow;
|
use crate::borrow::Cow;
|
||||||
use crate::ffi::OsString;
|
use crate::ffi::OsString;
|
||||||
use crate::fs::{File, exists};
|
use crate::fs::{File, exists};
|
||||||
use crate::io::{BufRead, BufReader, Read};
|
use crate::io::{BufRead, Read};
|
||||||
use crate::os::unix::ffi::OsStringExt;
|
use crate::os::unix::ffi::OsStringExt;
|
||||||
use crate::path::{Path, PathBuf};
|
use crate::path::{Path, PathBuf};
|
||||||
use crate::str::from_utf8;
|
use crate::str::from_utf8;
|
||||||
@ -690,7 +690,7 @@ fn quota_v1(group_path: PathBuf) -> usize {
|
|||||||
/// If the cgroupfs is a bind mount then `group_path` is adjusted to skip
|
/// If the cgroupfs is a bind mount then `group_path` is adjusted to skip
|
||||||
/// over the already-included prefix
|
/// over the already-included prefix
|
||||||
fn find_mountpoint(group_path: &Path) -> Option<(Cow<'static, str>, &Path)> {
|
fn find_mountpoint(group_path: &Path) -> Option<(Cow<'static, str>, &Path)> {
|
||||||
let mut reader = BufReader::new(File::open("/proc/self/mountinfo").ok()?);
|
let mut reader = File::open_buffered("/proc/self/mountinfo").ok()?;
|
||||||
let mut line = String::with_capacity(256);
|
let mut line = String::with_capacity(256);
|
||||||
loop {
|
loop {
|
||||||
line.clear();
|
line.clear();
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#![doc(test(attr(deny(warnings))))]
|
#![doc(test(attr(deny(warnings))))]
|
||||||
#![doc(rust_logo)]
|
#![doc(rust_logo)]
|
||||||
#![feature(rustdoc_internals)]
|
#![feature(rustdoc_internals)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(internal_output_capture)]
|
#![feature(internal_output_capture)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(process_exitcode_internals)]
|
#![feature(process_exitcode_internals)]
|
||||||
|
@ -3,9 +3,8 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::io::{self, BufReader};
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::{env, error, fmt};
|
use std::{env, error, fmt, io};
|
||||||
|
|
||||||
use parm::{Param, Variables, expand};
|
use parm::{Param, Variables, expand};
|
||||||
use parser::compiled::{msys_terminfo, parse};
|
use parser::compiled::{msys_terminfo, parse};
|
||||||
@ -102,8 +101,7 @@ pub(crate) fn from_path<P: AsRef<Path>>(path: P) -> Result<TermInfo, Error> {
|
|||||||
}
|
}
|
||||||
// Keep the metadata small
|
// Keep the metadata small
|
||||||
fn _from_path(path: &Path) -> Result<TermInfo, Error> {
|
fn _from_path(path: &Path) -> Result<TermInfo, Error> {
|
||||||
let file = File::open(path).map_err(Error::IoError)?;
|
let mut reader = File::open_buffered(path).map_err(Error::IoError)?;
|
||||||
let mut reader = BufReader::new(file);
|
|
||||||
parse(&mut reader, false).map_err(Error::MalformedTerminfo)
|
parse(&mut reader, false).map_err(Error::MalformedTerminfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{self, BufWriter, Write as _};
|
use std::io::{self, Write as _};
|
||||||
use std::iter::once;
|
use std::iter::once;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::path::{Component, Path, PathBuf};
|
use std::path::{Component, Path, PathBuf};
|
||||||
@ -1020,8 +1020,7 @@ fn write_rendered_cci<T: CciPart, F>(
|
|||||||
for part in parts {
|
for part in parts {
|
||||||
template.append(part);
|
template.append(part);
|
||||||
}
|
}
|
||||||
let file = try_err!(File::create(&path), &path);
|
let mut file = try_err!(File::create_buffered(&path), &path);
|
||||||
let mut file = BufWriter::new(file);
|
|
||||||
try_err!(write!(file, "{template}"), &path);
|
try_err!(write!(file, "{template}"), &path);
|
||||||
try_err!(file.flush(), &path);
|
try_err!(file.flush(), &path);
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ fn after_krate(&mut self) -> Result<(), Error> {
|
|||||||
|
|
||||||
self.serialize_and_write(
|
self.serialize_and_write(
|
||||||
output_crate,
|
output_crate,
|
||||||
BufWriter::new(try_err!(File::create(&p), p)),
|
try_err!(File::create_buffered(&p), p),
|
||||||
&p.display().to_string(),
|
&p.display().to_string(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(assert_matches)]
|
#![feature(assert_matches)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
|
#![feature(file_buffered)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
#![feature(iter_intersperse)]
|
#![feature(iter_intersperse)]
|
||||||
|
Loading…
Reference in New Issue
Block a user