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

Update rustc version incrementally to nightly-2022-12-06 #811

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
867db8b
Updated to `nightly-2022-08-22`, the latest version not requiring any…
kkysen Jan 4, 2023
74f703f
Used `Default::default()` instead of `Vec::new()` so that `ThinVec::n…
kkysen Jan 4, 2023
9416506
Updated to `nightly-2022-08-23` after the `Vec::new()` => `Default::d…
kkysen Jan 4, 2023
9f4e406
Updated to `nightly-2022-08-29`, the latest version not requiring any…
kkysen Jan 4, 2023
a2738de
Updated to `nightly-2022-09-30`, changing `.basic_blocks()` => `.basi…
kkysen Jan 4, 2023
de457a9
Updated to `nightly-2022-09-08`, changing `StatementKind::{CopyNonOve…
kkysen Jan 4, 2023
23d9928
`cargo clippy --fix` after the update to `nightly-2022-09-08`.
kkysen Jan 4, 2023
848a7e9
Updated to `nightly-2022-09-17`, the latest version not requiring an…
kkysen Jan 4, 2023
bf95e95
`cargo clippy --fix && cargo fmt` after the update to `nightly-2022-0…
kkysen Jan 5, 2023
4a740ab
In `c2rust_instrument::into_operand::make_const`, use `ConstantKind::…
kkysen Jan 5, 2023
76be307
Updated to `nightly-2022-09-19`, which seems to change the PDG by eli…
kkysen Jan 5, 2023
674d0e2
Updated to `nightly-2022-09-21`, adding a `match` arm for `Projection…
kkysen Jan 5, 2023
5ea3998
Updated to `nightly-2022-10-08`, the latest version not requiring any…
kkysen Jan 5, 2023
6ede894
`cargo clippy --fix` after the update to `nightly-2022-10-08`.
kkysen Jan 5, 2023
78d36f2
Trivial `clippy` fixes after the update to `nightly-2022-10-08`.
kkysen Jan 5, 2023
7fd06e3
Updated to `nightly-2022-10-09`, changing `CastKind{Misc => PtrToPtr}…
kkysen Jan 5, 2023
9e6a899
Updated to `nightly-2022-12-06`, the latest version not requiring any…
kkysen Jan 5, 2023
3bb66d6
`cargo clippy --fix && cargo fmt` after the update to `nightly-2022-1…
kkysen Jan 5, 2023
d835ba6
Trivial `clippy` fixes after the update to `nightly-2022-12-06`.
kkysen Jan 5, 2023
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
Next Next commit
cargo clippy --fix after the update to nightly-2022-09-08.
  • Loading branch information
kkysen committed Feb 1, 2023
commit 23d992888c05e086b81618594b12fff04cab6dfa
10 changes: 5 additions & 5 deletions c2rust-ast-exporter/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl LLVMInfo {
let lib_dir = {
let path_str = env::var("LLVM_LIB_DIR")
.ok()
.or_else(|| invoke_command(llvm_config.as_deref(), &["--libdir"]))
.or_else(|| invoke_command(llvm_config.as_deref(), ["--libdir"]))
.expect(llvm_config_missing);
String::from(
Path::new(&path_str)
Expand All @@ -263,7 +263,7 @@ impl LLVMInfo {
)
};

let llvm_shared_libs = invoke_command(llvm_config.as_deref(), &["--libs", "--link-shared"]);
let llvm_shared_libs = invoke_command(llvm_config.as_deref(), ["--libs", "--link-shared"]);

// <sysroot>/lib/rustlib/<target>/lib/ contains a libLLVM DSO for the
// rust compiler. On MacOS, this lib is named libLLVM.dylib, which will
Expand All @@ -288,7 +288,7 @@ impl LLVMInfo {
dylib_file.push_str(dylib_suffix);
let sysroot = invoke_command(
env::var_os("RUSTC").map(PathBuf::from).as_deref(),
&["--print=sysroot"],
["--print=sysroot"],
)
.unwrap();

Expand Down Expand Up @@ -323,7 +323,7 @@ impl LLVMInfo {

let llvm_major_version = {
let version =
invoke_command(llvm_config.as_deref(), &["--version"]).expect(llvm_config_missing);
invoke_command(llvm_config.as_deref(), ["--version"]).expect(llvm_config_missing);
let emsg = format!("invalid version string {}", version);
version
.split('.')
Expand Down Expand Up @@ -362,7 +362,7 @@ impl LLVMInfo {
libs.extend(
env::var("LLVM_SYSTEM_LIBS")
.ok()
.or_else(|| invoke_command(llvm_config.as_deref(), &["--system-libs", link_mode]))
.or_else(|| invoke_command(llvm_config.as_deref(), ["--system-libs", link_mode]))
.unwrap_or_default()
.split_whitespace()
.map(|lib| String::from(lib.trim_start_matches("-l"))),
Expand Down
2 changes: 1 addition & 1 deletion c2rust-build-paths/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl SysRoot {
pub fn resolve() -> Self {
let rustc = env::var_os("RUSTC").unwrap_or_else(|| "rustc".into());
let output = Command::new(rustc)
.args(&["--print", "sysroot"])
.args(["--print", "sysroot"])
.output()
.expect("could not invoke `rustc` to find rust sysroot");
// trim, but `str::trim` doesn't exist on `[u8]`
Expand Down
4 changes: 2 additions & 2 deletions c2rust-transpile/src/build_files/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn emit_build_files<'lcmd>(
.unwrap();

if !build_dir.exists() {
fs::create_dir_all(&build_dir)
fs::create_dir_all(build_dir)
.unwrap_or_else(|_| panic!("couldn't create build directory: {}", build_dir.display()));
}

Expand Down Expand Up @@ -316,7 +316,7 @@ fn maybe_write_to_file(output_path: &Path, output: String, overwrite: bool) -> O
return None;
}

let mut file = match File::create(&output_path) {
let mut file = match File::create(output_path) {
Ok(file) => file,
Err(e) => panic!("Unable to open file for writing: {}", e),
};
Expand Down
6 changes: 3 additions & 3 deletions c2rust-transpile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ fn get_extra_args_macos() -> Vec<String> {
let usr_incl = Path::new("/usr/include");
if !usr_incl.exists() {
let output = process::Command::new("xcrun")
.args(&["--show-sdk-path"])
.args(["--show-sdk-path"])
.output()
.expect("failed to run `xcrun` subcommand");
let mut sdk_path = String::from_utf8(output.stdout).unwrap();
Expand Down Expand Up @@ -416,7 +416,7 @@ fn reorganize_definitions(
invoke_refactor(build_dir)?;
// fix the formatting of the output of `c2rust-refactor`
let status = process::Command::new("cargo")
.args(&["fmt"])
.args(["fmt"])
.current_dir(build_dir)
.status()?;
if !status.success() {
Expand Down Expand Up @@ -556,7 +556,7 @@ fn get_output_path(
// Create the parent directory if it doesn't exist
let parent = output_path.parent().unwrap();
if !parent.exists() {
fs::create_dir_all(&parent).unwrap_or_else(|_| {
fs::create_dir_all(parent).unwrap_or_else(|_| {
panic!("couldn't create source directory: {}", parent.display())
});
}
Expand Down
2 changes: 1 addition & 1 deletion c2rust-transpile/src/translator/assembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ fn parse_constraints(
}

// Handle register names
let mut constraints = constraints.replace('{', "\"").replace('}', "\"");
let mut constraints = constraints.replace(['{', '}'], "\"");

// Convert (simple) constraints to ones rustc understands
match &*constraints {
Expand Down
3 changes: 1 addition & 2 deletions c2rust-transpile/src/translator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,7 @@ fn clean_path(mod_names: &RefCell<IndexMap<String, PathBuf>>, path: Option<&path
.unwrap()
.to_str()
.unwrap()
.replace('.', "_")
.replace('-', "_")
.replace(['.', '-'], "_")
}

let mut file_path: String = path.map_or("internal".to_string(), path_to_str);
Expand Down
2 changes: 1 addition & 1 deletion c2rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl SubCommand {
self.name
)
})?;
let status = Command::new(&path).args(args).status()?;
let status = Command::new(path).args(args).status()?;
process::exit(status.code().unwrap_or(1));
}
}
Expand Down
6 changes: 3 additions & 3 deletions dynamic_instrumentation/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn exit_with_status(status: ExitStatus) {
fn resolve_sysroot() -> anyhow::Result<PathBuf> {
let rustc = env::var_os("RUSTC").unwrap_or_else(|| "rustc".into());
let output = Command::new(rustc)
.args(&["--print", "sysroot"])
.args(["--print", "sysroot"])
.output()
.context("could not invoke `rustc` to find rust sysroot")?;
// trim, but `str::trim` doesn't exist on `[u8]`
Expand Down Expand Up @@ -496,14 +496,14 @@ fn cargo_wrapper(rustc_wrapper: &Path) -> anyhow::Result<()> {

if set_runtime {
cargo.run(|cmd| {
cmd.args(&["add", "--optional", "c2rust-analysis-rt"]);
cmd.args(["add", "--optional", "c2rust-analysis-rt"]);
if let Some(mut runtime) = runtime_path {
if manifest_dir.is_some() {
runtime = fs_err::canonicalize(runtime)?;
}
// Since it's a local path, we don't need the internet,
// and running it offline saves a slow index sync.
cmd.args(&["--offline", "--path"]).arg(runtime);
cmd.args(["--offline", "--path"]).arg(runtime);
}
if let Some(manifest_path) = manifest_path {
cmd.arg("--manifest-path").arg(manifest_path);
Expand Down
10 changes: 5 additions & 5 deletions pdg/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ mod tests {

let mut cmd = Command::new("cargo");
cmd.current_dir(repo_dir()?)
.args(&[
.args([
"run",
"--bin",
"c2rust-instrument",
Expand All @@ -329,11 +329,11 @@ mod tests {
"--metadata",
])
.arg(&metadata_path)
.args(&["--runtime-path"])
.args(["--runtime-path"])
.arg(&runtime_path)
.args(&["--", "run", "--manifest-path"])
.args(["--", "run", "--manifest-path"])
.arg(&manifest_path)
.args(&["--profile", profile.name()])
.args(["--profile", profile.name()])
.arg("--")
.args(args)
.env("METADATA_FILE", &metadata_path)
Expand Down Expand Up @@ -390,7 +390,7 @@ mod tests {
init();
let mut cmd = Command::new("cargo");
cmd.current_dir(repo_dir()?.join("analysis/tests/misc"))
.args(&["miri", "run", "--features", "miri"])
.args(["miri", "run", "--features", "miri"])
.env("MIRIFLAGS", "");
let status = cmd.status()?;
ensure!(status.success(), eyre!("{cmd:?} failed: {status}"));
Expand Down