Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate run make const fn mir #126270

Merged
merged 3 commits into from
Jun 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update run-make-support/diff to new fs_wrapper API
GuillaumeGomez committed Jun 13, 2024

Verified

This commit was signed with the committer’s verified signature.
myii Imran Iqbal
commit 5f4111f781abcd8faca117e18e25c633f9effdcc
10 changes: 4 additions & 6 deletions src/tools/run-make-support/src/diff/mod.rs
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ use similar::TextDiff;
use std::path::{Path, PathBuf};

use crate::drop_bomb::DropBomb;
use crate::fs_wrapper;

#[cfg(test)]
mod tests;
@@ -42,7 +43,7 @@ impl Diff {
/// Specify the expected output for the diff from a file.
pub fn expected_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
let path = path.as_ref();
let content = std::fs::read_to_string(path).expect("failed to read file");
let content = fs_wrapper::read_to_string(path);
let name = path.to_string_lossy().to_string();

self.expected_file = Some(path.into());
@@ -61,10 +62,7 @@ impl Diff {
/// Specify the actual output for the diff from a file.
pub fn actual_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
let path = path.as_ref();
let content = match std::fs::read_to_string(path) {
Ok(c) => c,
Err(e) => panic!("failed to read `{}`: {:?}", path.display(), e),
};
let content = fs_wrapper::read_to_string(path);
let name = path.to_string_lossy().to_string();

self.actual = Some(content);
@@ -112,7 +110,7 @@ impl Diff {
if let Some(ref expected_file) = self.expected_file {
if std::env::var("RUSTC_BLESS_TEST").is_ok() {
println!("Blessing `{}`", expected_file.display());
std::fs::write(expected_file, actual).unwrap();
fs_wrapper::write(expected_file, actual);
return;
}
}