From c41108a7bda6cf4ca524ab86b169d820cf4413a7 Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Wed, 28 Aug 2024 13:15:10 -0700 Subject: [PATCH 1/7] `.gitignore`: ignore `polonius_cache/` --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 18c446d98c..9a1f3c0bfd 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ marks.*.json inspect/ *.analysis.txt analysis.txt +polonius_cache/ From 202dbd0cac512e1a4da36a341743a3805c56338b Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Wed, 28 Aug 2024 13:16:08 -0700 Subject: [PATCH 2/7] `Cargo.toml`: update to `0.19.0` --- Cargo.lock | 26 +++++++++---------- Cargo.toml | 2 +- analysis/tests/lighttpd-minimal/Cargo.toml | 2 +- analysis/tests/lighttpd/Cargo.toml | 2 +- analysis/tests/minimal/Cargo.toml | 2 +- analysis/tests/misc/Cargo.toml | 2 +- c2rust-analyze/Cargo.toml | 4 +-- c2rust-ast-exporter/Cargo.toml | 2 +- c2rust-bitfields/Cargo.toml | 2 +- c2rust-macros/Cargo.toml | 2 +- c2rust-refactor/Cargo.toml | 10 +++---- c2rust-refactor/runtime/Cargo.toml | 2 +- c2rust-transpile/Cargo.toml | 8 +++--- c2rust/Cargo.toml | 4 +-- dynamic_instrumentation/Cargo.toml | 4 +-- .../robotfindskitten/repo/rust/Cargo.toml | 2 +- pdg/Cargo.toml | 4 +-- tests/asm.aarch64/Cargo.toml | 2 +- tests/asm.x86_64/Cargo.toml | 2 +- tests/structs/Cargo.toml | 2 +- 20 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea76e32fa3..7efd0ec8fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -174,7 +174,7 @@ dependencies = [ [[package]] name = "c2rust" -version = "0.18.0" +version = "0.19.0" dependencies = [ "anyhow", "c2rust-build-paths", @@ -189,7 +189,7 @@ dependencies = [ [[package]] name = "c2rust-analysis-rt" -version = "0.18.0" +version = "0.19.0" dependencies = [ "bincode", "crossbeam-queue", @@ -202,7 +202,7 @@ dependencies = [ [[package]] name = "c2rust-analyze" -version = "0.18.0" +version = "0.19.0" dependencies = [ "anyhow", "assert_matches", @@ -229,11 +229,11 @@ dependencies = [ [[package]] name = "c2rust-asm-casts" -version = "0.18.0" +version = "0.19.0" [[package]] name = "c2rust-ast-builder" -version = "0.18.0" +version = "0.19.0" dependencies = [ "proc-macro2", "syn 1.0.109", @@ -241,7 +241,7 @@ dependencies = [ [[package]] name = "c2rust-ast-exporter" -version = "0.18.0" +version = "0.19.0" dependencies = [ "bindgen", "c2rust-build-paths", @@ -256,7 +256,7 @@ dependencies = [ [[package]] name = "c2rust-ast-printer" -version = "0.18.0" +version = "0.19.0" dependencies = [ "log", "prettyplease 0.1.25", @@ -266,7 +266,7 @@ dependencies = [ [[package]] name = "c2rust-bitfields" -version = "0.18.0" +version = "0.19.0" dependencies = [ "c2rust-bitfields-derive", "libc", @@ -274,7 +274,7 @@ dependencies = [ [[package]] name = "c2rust-bitfields-derive" -version = "0.18.0" +version = "0.19.0" dependencies = [ "proc-macro2", "quote", @@ -283,14 +283,14 @@ dependencies = [ [[package]] name = "c2rust-build-paths" -version = "0.18.0" +version = "0.19.0" dependencies = [ "print_bytes", ] [[package]] name = "c2rust-instrument" -version = "0.18.0" +version = "0.19.0" dependencies = [ "anyhow", "bincode", @@ -310,7 +310,7 @@ dependencies = [ [[package]] name = "c2rust-pdg" -version = "0.18.0" +version = "0.19.0" dependencies = [ "bincode", "c2rust-analysis-rt", @@ -330,7 +330,7 @@ dependencies = [ [[package]] name = "c2rust-transpile" -version = "0.18.0" +version = "0.19.0" dependencies = [ "c2rust-ast-builder", "c2rust-ast-exporter", diff --git a/Cargo.toml b/Cargo.toml index 44f8a068f1..c9d6ce881c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ exclude = [ ] [workspace.package] -version = "0.18.0" +version = "0.19.0" authors = ["The C2Rust Project Developers "] edition = "2021" readme = "README.md" diff --git a/analysis/tests/lighttpd-minimal/Cargo.toml b/analysis/tests/lighttpd-minimal/Cargo.toml index 3c5e850b7c..b279559038 100644 --- a/analysis/tests/lighttpd-minimal/Cargo.toml +++ b/analysis/tests/lighttpd-minimal/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] libc = "0.2" -c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.18.0" } +c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.19.0" } [features] miri = [] diff --git a/analysis/tests/lighttpd/Cargo.toml b/analysis/tests/lighttpd/Cargo.toml index e55bfe86ed..c7e3533db5 100644 --- a/analysis/tests/lighttpd/Cargo.toml +++ b/analysis/tests/lighttpd/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] libc = "0.2" -c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.18.0" } +c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.19.0" } [features] miri = [] diff --git a/analysis/tests/minimal/Cargo.toml b/analysis/tests/minimal/Cargo.toml index 43182983f4..3e9d7e4c84 100644 --- a/analysis/tests/minimal/Cargo.toml +++ b/analysis/tests/minimal/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] libc = "0.2" -c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.18.0" } +c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.19.0" } [features] miri = [] diff --git a/analysis/tests/misc/Cargo.toml b/analysis/tests/misc/Cargo.toml index 8eff9a8f3d..88b94589e4 100644 --- a/analysis/tests/misc/Cargo.toml +++ b/analysis/tests/misc/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] libc = "0.2" -c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.18.0" } +c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.19.0" } [features] miri = [] diff --git a/c2rust-analyze/Cargo.toml b/c2rust-analyze/Cargo.toml index cb69eba6e9..249e37ba06 100644 --- a/c2rust-analyze/Cargo.toml +++ b/c2rust-analyze/Cargo.toml @@ -32,11 +32,11 @@ toml_edit = "0.19.8" sha2 = "0.10.8" [build-dependencies] -c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.18.0" } +c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.19.0" } print_bytes = "1.1" [dev-dependencies] -c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.18.0" } +c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.19.0" } clap = { version = "4.1.9", features = ["derive"] } shlex = "1.3.0" diff --git a/c2rust-ast-exporter/Cargo.toml b/c2rust-ast-exporter/Cargo.toml index 61f751fb95..1bcdfe3e9b 100644 --- a/c2rust-ast-exporter/Cargo.toml +++ b/c2rust-ast-exporter/Cargo.toml @@ -23,7 +23,7 @@ bindgen = { version = "0.65", features = ["logging"] } clang-sys = "1.3" cmake = "0.1.49" env_logger = "0.10" -c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.18.0" } +c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.19.0" } [features] default = [] diff --git a/c2rust-bitfields/Cargo.toml b/c2rust-bitfields/Cargo.toml index ce0994e2a1..19bdaa6391 100644 --- a/c2rust-bitfields/Cargo.toml +++ b/c2rust-bitfields/Cargo.toml @@ -12,7 +12,7 @@ keywords.workspace = true categories.workspace = true [dependencies] -c2rust-bitfields-derive = { version = "0.18.0", path = "../c2rust-bitfields-derive" } +c2rust-bitfields-derive = { version = "0.19.0", path = "../c2rust-bitfields-derive" } [dev-dependencies] libc = "0.2" diff --git a/c2rust-macros/Cargo.toml b/c2rust-macros/Cargo.toml index 5e79c79dc1..243f7ad254 100644 --- a/c2rust-macros/Cargo.toml +++ b/c2rust-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "c2rust-macros" -version = "0.18.0" +version = "0.19.0" authors = ["Stephen Crane ", "The C2Rust Project Developers "] edition = "2021" description = "Procedural macro support crate for C2Rust" diff --git a/c2rust-refactor/Cargo.toml b/c2rust-refactor/Cargo.toml index e337d8af4d..95fcbba643 100644 --- a/c2rust-refactor/Cargo.toml +++ b/c2rust-refactor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "c2rust-refactor" -version = "0.18.0" +version = "0.19.0" authors = [ "The C2Rust Project Developers ", "Stuart Pernsteiner ", @@ -17,18 +17,18 @@ json = "0.12" libc = "0.2" regex = "1.1" ena = "0.13" -c2rust-ast-builder = { version = "0.18.0", path = "../c2rust-ast-builder" } -c2rust-ast-printer = { version = "0.18.0", path = "../c2rust-ast-printer" } +c2rust-ast-builder = { version = "0.19.0", path = "../c2rust-ast-builder" } +c2rust-ast-printer = { version = "0.19.0", path = "../c2rust-ast-printer" } indexmap = { version = "1.0.1", features = ["serde-1"] } cargo = "0.44" clap = {version = "2.33", features = ["yaml"]} -c2rust-analysis-rt = { path = "../analysis/runtime", version = "0.18.0" } +c2rust-analysis-rt = { path = "../analysis/runtime", version = "0.19.0" } env_logger = "0.10" log = "0.4" rlua = "0.17" slotmap = {version = "0.4", features = ["unstable"]} derive_more = "0.99" -c2rust-macros = { version = "0.18.0", path = "../c2rust-macros" } +c2rust-macros = { version = "0.19.0", path = "../c2rust-macros" } flame = { version = "0.2.2", optional = true } flamer = { version = "0.4", optional = true } failure = "0.1" diff --git a/c2rust-refactor/runtime/Cargo.toml b/c2rust-refactor/runtime/Cargo.toml index a7b66edaa0..bfc0debe4a 100644 --- a/c2rust-refactor/runtime/Cargo.toml +++ b/c2rust-refactor/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "c2rust_runtime" -version = "0.18.0" +version = "0.19.0" authors = ["Stuart Pernsteiner "] edition = "2021" diff --git a/c2rust-transpile/Cargo.toml b/c2rust-transpile/Cargo.toml index f013082855..a5f9dadf18 100644 --- a/c2rust-transpile/Cargo.toml +++ b/c2rust-transpile/Cargo.toml @@ -12,10 +12,10 @@ keywords.workspace = true categories.workspace = true [dependencies] -c2rust-ast-builder = { version = "0.18.0", path = "../c2rust-ast-builder" } -c2rust-ast-exporter = { version = "0.18.0", path = "../c2rust-ast-exporter" } -c2rust-ast-printer = { version = "0.18.0", path = "../c2rust-ast-printer" } -c2rust-bitfields = { version = "0.18.0", path = "../c2rust-bitfields" } +c2rust-ast-builder = { version = "0.19.0", path = "../c2rust-ast-builder" } +c2rust-ast-exporter = { version = "0.19.0", path = "../c2rust-ast-exporter" } +c2rust-ast-printer = { version = "0.19.0", path = "../c2rust-ast-printer" } +c2rust-bitfields = { version = "0.19.0", path = "../c2rust-bitfields" } colored = "2.0" dtoa = "1.0" failure = "0.1.5" diff --git a/c2rust/Cargo.toml b/c2rust/Cargo.toml index a763b68382..89def15038 100644 --- a/c2rust/Cargo.toml +++ b/c2rust/Cargo.toml @@ -24,10 +24,10 @@ is_executable = "1.0" log = "0.4" regex = "1.3" shlex = "1.3" -c2rust-transpile = { version = "0.18.0", path = "../c2rust-transpile" } +c2rust-transpile = { version = "0.19.0", path = "../c2rust-transpile" } [build-dependencies] -c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.18.0" } +c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.19.0" } [features] # Force static linking of LLVM diff --git a/dynamic_instrumentation/Cargo.toml b/dynamic_instrumentation/Cargo.toml index 42187a72b2..fab4a52e2e 100644 --- a/dynamic_instrumentation/Cargo.toml +++ b/dynamic_instrumentation/Cargo.toml @@ -14,7 +14,7 @@ categories.workspace = true [dependencies] anyhow = "1.0" bincode = "1.0.1" -c2rust-analysis-rt = { path = "../analysis/runtime", version = "0.18.0" } +c2rust-analysis-rt = { path = "../analysis/runtime", version = "0.19.0" } indexmap = "1.9" itertools = "0.10" once_cell = "1.13" @@ -29,7 +29,7 @@ env_logger = "0.10" tempfile = "3.3" [build-dependencies] -c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.18.0" } +c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.19.0" } [package.metadata.rust-analyzer] rustc_private = true diff --git a/examples/robotfindskitten/repo/rust/Cargo.toml b/examples/robotfindskitten/repo/rust/Cargo.toml index 7824f6bf5e..d0a764eb90 100644 --- a/examples/robotfindskitten/repo/rust/Cargo.toml +++ b/examples/robotfindskitten/repo/rust/Cargo.toml @@ -9,7 +9,7 @@ name = "robotfindskitten" path = "src/robotfindskitten.rs" [dependencies] -c2rust_runtime = { path = "../../../../c2rust-refactor/runtime", version = "0.18.0" } +c2rust_runtime = { path = "../../../../c2rust-refactor/runtime", version = "0.19.0" } rand = "0.5.5" pancurses = "0.16.0" libc = "0.2" diff --git a/pdg/Cargo.toml b/pdg/Cargo.toml index d18cb8d94d..ffcafe6061 100644 --- a/pdg/Cargo.toml +++ b/pdg/Cargo.toml @@ -13,7 +13,7 @@ categories.workspace = true [dependencies] bincode = "1.0" -c2rust-analysis-rt = { path = "../analysis/runtime", version = "0.18.0" } +c2rust-analysis-rt = { path = "../analysis/runtime", version = "0.19.0" } indexed_vec = "1.2" indexmap = "1.8" serde = { version = "1.0", features = ["derive"] } @@ -26,7 +26,7 @@ linked_hash_set = "0.1" clap = { version = "3.2", features = ["derive"] } [build-dependencies] -c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.18.0" } +c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.19.0" } [dev-dependencies] insta = "1.15" diff --git a/tests/asm.aarch64/Cargo.toml b/tests/asm.aarch64/Cargo.toml index 194284ea13..c7c2224183 100644 --- a/tests/asm.aarch64/Cargo.toml +++ b/tests/asm.aarch64/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" [dependencies] libc = "0.2" -c2rust-asm-casts = { path = "../../c2rust-asm-casts", version = "0.18.0" } +c2rust-asm-casts = { path = "../../c2rust-asm-casts", version = "0.19.0" } diff --git a/tests/asm.x86_64/Cargo.toml b/tests/asm.x86_64/Cargo.toml index 194284ea13..c7c2224183 100644 --- a/tests/asm.x86_64/Cargo.toml +++ b/tests/asm.x86_64/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" [dependencies] libc = "0.2" -c2rust-asm-casts = { path = "../../c2rust-asm-casts", version = "0.18.0" } +c2rust-asm-casts = { path = "../../c2rust-asm-casts", version = "0.19.0" } diff --git a/tests/structs/Cargo.toml b/tests/structs/Cargo.toml index 24cb245b38..40fe25ee08 100644 --- a/tests/structs/Cargo.toml +++ b/tests/structs/Cargo.toml @@ -4,6 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] -c2rust-bitfields = { path = "../../c2rust-bitfields", version = "0.18.0" } +c2rust-bitfields = { path = "../../c2rust-bitfields", version = "0.19.0" } memoffset = "0.2" libc = "0.2" From 30457be91e81e6618ba409c5974b7b2799dc06e4 Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Wed, 28 Aug 2024 13:34:49 -0700 Subject: [PATCH 3/7] `cargo clippy --fix` --- c2rust-analyze/src/analyze.rs | 23 ++++++++------- c2rust-analyze/src/borrowck/type_check.rs | 4 +-- c2rust-analyze/src/context.rs | 20 ++++++------- c2rust-analyze/src/dataflow/type_check.rs | 2 +- c2rust-analyze/src/main.rs | 2 +- c2rust-analyze/src/pointee_type/solve.rs | 4 +-- c2rust-analyze/src/pointee_type/type_check.rs | 2 +- c2rust-analyze/src/pointer_id.rs | 12 ++++---- c2rust-analyze/src/rewrite/expr/convert.rs | 22 +++++++-------- .../src/rewrite/expr/hir_only_casts.rs | 18 ++++++------ c2rust-analyze/src/rewrite/expr/mir_op.rs | 28 +++++++++---------- c2rust-analyze/src/rewrite/expr/mod.rs | 2 +- c2rust-analyze/src/rewrite/expr/unlower.rs | 14 ++++------ c2rust-analyze/src/rewrite/mod.rs | 4 +-- c2rust-analyze/src/rewrite/ty.rs | 17 ++++++----- c2rust-transpile/src/lib.rs | 4 +-- 16 files changed, 86 insertions(+), 92 deletions(-) diff --git a/c2rust-analyze/src/analyze.rs b/c2rust-analyze/src/analyze.rs index 51f8dc12f0..ca06002a4c 100644 --- a/c2rust-analyze/src/analyze.rs +++ b/c2rust-analyze/src/analyze.rs @@ -370,7 +370,7 @@ fn mark_foreign_fixed<'tcx>( make_ty_fixed(gasn, lty); // Also fix the `addr_of_static` permissions. - let ptr = gacx.addr_of_static[&did]; + let ptr = gacx.addr_of_static[did]; gasn.flags[ptr].insert(FlagSet::FIXED); } } @@ -397,7 +397,7 @@ fn mark_all_statics_fixed<'tcx>(gacx: &mut GlobalAnalysisCtxt<'tcx>, gasn: &mut make_ty_fixed(gasn, lty); // Also fix the `addr_of_static` permissions. - let ptr = gacx.addr_of_static[&did]; + let ptr = gacx.addr_of_static[did]; gasn.flags[ptr].insert(FlagSet::FIXED); } } @@ -425,7 +425,7 @@ fn parse_def_id(s: &str) -> Result { let s = s .strip_prefix("DefId(") .ok_or("does not start with `DefId(`")?; - let s = s.strip_suffix(")").ok_or("does not end with `)`")?; + let s = s.strip_suffix(')').ok_or("does not end with `)`")?; let s = match s.find(" ~ ") { Some(i) => &s[..i], None => s, @@ -459,11 +459,11 @@ fn read_fixed_defs_list(fixed_defs: &mut HashSet, path: &str) -> io::Resu for (i, line) in f.lines().enumerate() { let line = line?; let line = line.trim(); - if line.len() == 0 || line.starts_with('#') { + if line.is_empty() || line.starts_with('#') { continue; } - let def_id = parse_def_id(&line).unwrap_or_else(|e| { + let def_id = parse_def_id(line).unwrap_or_else(|e| { panic!("failed to parse {} line {}: {}", path, i + 1, e); }); fixed_defs.insert(def_id); @@ -481,7 +481,7 @@ fn check_rewrite_path_prefixes(tcx: TyCtxt, fixed_defs: &mut HashSet, pre .split(',') // Exclude empty paths. This allows for leading/trailing commas or double commas within // the list, which may result when building the list programmatically. - .filter(|prefix| prefix.len() > 0) + .filter(|prefix| !prefix.is_empty()) .map(|prefix| prefix.split("::").map(Symbol::intern).collect::>()) .collect(); let sym_impl = Symbol::intern("{impl}"); @@ -1510,8 +1510,7 @@ fn run2<'tcx>( continue; } - let adt_rewrites = - rewrite::gen_adt_ty_rewrites(&gacx, &gasn, &global_pointee_types, def_id); + let adt_rewrites = rewrite::gen_adt_ty_rewrites(&gacx, &gasn, global_pointee_types, def_id); let report = adt_reports.entry(def_id).or_default(); writeln!( report, @@ -1691,7 +1690,7 @@ fn run2<'tcx>( ptrs.push(ptr); format!("{{{}}}", ptr) }); - if ptrs.len() == 0 { + if ptrs.is_empty() { continue; } ann.emit(span, format_args!("typeof({}) = {}", name, ty_str)); @@ -1789,7 +1788,7 @@ fn run2<'tcx>( all_fn_ldids.len() ); - if known_perm_error_fns.len() > 0 { + if !known_perm_error_fns.is_empty() { eprintln!( "saw permission errors in {} known fns", known_perm_error_fns.len() @@ -1893,7 +1892,7 @@ fn apply_test_attr_force_non_null_args( let mut updates_forbidden = g_updates_forbidden.and_mut(&mut info.l_updates_forbidden); let lsig = &gacx.fn_sigs[&ldid.to_def_id()]; - for arg_lty in lsig.inputs.iter().copied() { + for arg_lty in lsig.inputs { for lty in arg_lty.iter() { let ptr = lty.label; if !ptr.is_none() { @@ -2014,7 +2013,7 @@ fn print_function_pointee_types<'tcx>( for ptr in all_pointer_ids { let tys = &pointee_types[ptr]; - if tys.ltys.len() == 0 && !tys.incomplete { + if tys.ltys.is_empty() && !tys.incomplete { continue; } eprintln!( diff --git a/c2rust-analyze/src/borrowck/type_check.rs b/c2rust-analyze/src/borrowck/type_check.rs index ce3086a37b..fc098acde2 100644 --- a/c2rust-analyze/src/borrowck/type_check.rs +++ b/c2rust-analyze/src/borrowck/type_check.rs @@ -177,7 +177,7 @@ impl<'tcx> TypeChecker<'tcx, '_> { self.facts, self.maps, &self.acx.gacx.adt_metadata, - &self.acx.gacx.static_tys[&did], + self.acx.gacx.static_tys[&did], ); for l in lty.iter() { @@ -585,7 +585,7 @@ impl<'tcx> TypeChecker<'tcx, '_> { } Callee::Memcpy => { let _pl_lty = self.visit_place(destination); - let _rv_lty = assert_matches!(&args[..], [dest, src, _] => { + assert_matches!(&args[..], [dest, src, _] => { self.visit_operand(dest); self.visit_operand(src); }); diff --git a/c2rust-analyze/src/context.rs b/c2rust-analyze/src/context.rs index 7cca944a07..231c403f0d 100644 --- a/c2rust-analyze/src/context.rs +++ b/c2rust-analyze/src/context.rs @@ -1503,7 +1503,7 @@ pub fn print_ty_with_pointer_labels_into( // Types with arguments Adt(adt_def, _substs) => { write!(dest, "{:?}", adt_def.did()).unwrap(); - if lty.args.len() != 0 { + if !lty.args.is_empty() { dest.push('<'); // TODO: region args for (i, &arg_lty) in lty.args.iter().enumerate() { @@ -1532,31 +1532,31 @@ pub fn print_ty_with_pointer_labels_into( dest.push_str("*mut "); } let s = f(lty.label); - if s.len() > 0 { + if !s.is_empty() { dest.push_str(&s); - dest.push_str(" "); + dest.push(' '); } print_ty_with_pointer_labels_into(dest, lty.args[0], f); } &Ref(_rg, _ty, mutbl) => { let s = f(lty.label); if mutbl == Mutability::Not { - dest.push_str("&"); - if s.len() > 0 { + dest.push('&'); + if !s.is_empty() { dest.push(' '); } } else { dest.push_str("&mut "); } - if s.len() > 0 { + if !s.is_empty() { dest.push_str(&s); - dest.push_str(" "); + dest.push(' '); } print_ty_with_pointer_labels_into(dest, lty.args[0], f); } FnDef(def_id, _substs) => { write!(dest, "{:?}", def_id).unwrap(); - if lty.args.len() != 0 { + if !lty.args.is_empty() { dest.push('<'); // TODO: region args for (i, &arg_lty) in lty.args.iter().enumerate() { @@ -1581,14 +1581,14 @@ pub fn print_ty_with_pointer_labels_into( print_ty_with_pointer_labels_into(dest, ret_lty, f); } Tuple(_) => { - dest.push_str("("); + dest.push('('); for (i, &arg_lty) in lty.args.iter().enumerate() { if i > 0 { dest.push_str(", "); } print_ty_with_pointer_labels_into(dest, arg_lty, f); } - dest.push_str(")"); + dest.push(')'); } // Types that aren't actually supported by this code yet diff --git a/c2rust-analyze/src/dataflow/type_check.rs b/c2rust-analyze/src/dataflow/type_check.rs index a27fa00222..2cca9f0658 100644 --- a/c2rust-analyze/src/dataflow/type_check.rs +++ b/c2rust-analyze/src/dataflow/type_check.rs @@ -603,7 +603,7 @@ impl<'tcx> TypeChecker<'tcx, '_> { self.visit_operand(&args[0]); } Callee::Null { .. } => { - assert!(args.len() == 0); + assert!(args.is_empty()); self.visit_place(destination, Mutability::Mut); let pl_lty = self.acx.type_of(destination); // We are assigning a null pointer to `destination`, so it must not have the diff --git a/c2rust-analyze/src/main.rs b/c2rust-analyze/src/main.rs index 3f751031c0..6ccc405f61 100644 --- a/c2rust-analyze/src/main.rs +++ b/c2rust-analyze/src/main.rs @@ -438,7 +438,7 @@ fn cargo_wrapper(rustc_wrapper: &Path) -> anyhow::Result<()> { cmd.env("C2RUST_ANALYZE_FIXED_DEFS_LIST", fixed_defs_list); } - if rewrite_paths.len() > 0 { + if !rewrite_paths.is_empty() { let rewrite_paths = rewrite_paths.join(OsStr::new(",")); cmd.env("C2RUST_ANALYZE_REWRITE_PATHS", rewrite_paths); } diff --git a/c2rust-analyze/src/pointee_type/solve.rs b/c2rust-analyze/src/pointee_type/solve.rs index c915c5513f..7acaeed1d4 100644 --- a/c2rust-analyze/src/pointee_type/solve.rs +++ b/c2rust-analyze/src/pointee_type/solve.rs @@ -56,7 +56,7 @@ pub fn propagate_types<'tcx>( if new && !ty_sets[ptr1].is_subset(&ty_sets[ptr2]) { let (tys1, tys2) = index_both(&mut ty_sets, ptr1, ptr2); for cty in tys1.iter() { - tys2.insert(cty.clone()); + tys2.insert(*cty); } // Since `ty_sets[ptr2]` was not a subset of `ty_sets[ptr1]`, we must have added at // least one element to `ty_sets[ptr2]`. @@ -75,7 +75,7 @@ pub fn propagate_types<'tcx>( if !ty_sets[ptr1].is_subset(&ty_sets[ptr2]) { let (tys1, tys2) = index_both(&mut ty_sets, ptr1, ptr2); for cty in tys1.iter() { - tys2.insert(cty.clone()); + tys2.insert(*cty); } // Since `ty_sets[ptr2]` was not a subset of `ty_sets[ptr1]`, we must have added at // least one element to `ty_sets[ptr2]`. diff --git a/c2rust-analyze/src/pointee_type/type_check.rs b/c2rust-analyze/src/pointee_type/type_check.rs index b0f7f60fdb..612304efa7 100644 --- a/c2rust-analyze/src/pointee_type/type_check.rs +++ b/c2rust-analyze/src/pointee_type/type_check.rs @@ -76,7 +76,7 @@ impl<'tcx> TypeChecker<'tcx, '_> { } _ => {} } - lty = self.acx.projection_lty(lty, &proj); + lty = self.acx.projection_lty(lty, proj); } debug_assert_eq!(lty, self.acx.type_of(pl)); lty diff --git a/c2rust-analyze/src/pointer_id.rs b/c2rust-analyze/src/pointer_id.rs index 110a8fc9b6..3e3fb38173 100644 --- a/c2rust-analyze/src/pointer_id.rs +++ b/c2rust-analyze/src/pointer_id.rs @@ -332,11 +332,11 @@ impl<'a, T> PointerTable<'a, T> { } pub fn global(&self) -> &'a GlobalPointerTable { - &self.global + self.global } pub fn local(&self) -> &'a LocalPointerTable { - &self.local + self.local } pub fn iter(&self) -> impl Iterator { @@ -386,19 +386,19 @@ impl<'a, T> PointerTableMut<'a, T> { } pub fn global(&self) -> &GlobalPointerTable { - &self.global + self.global } pub fn global_mut(&mut self) -> &mut GlobalPointerTable { - &mut self.global + self.global } pub fn local(&self) -> &LocalPointerTable { - &self.local + self.local } pub fn local_mut(&mut self) -> &mut LocalPointerTable { - &mut self.local + self.local } pub fn iter(&self) -> impl Iterator { diff --git a/c2rust-analyze/src/rewrite/expr/convert.rs b/c2rust-analyze/src/rewrite/expr/convert.rs index dcb818acaf..f6ee290821 100644 --- a/c2rust-analyze/src/rewrite/expr/convert.rs +++ b/c2rust-analyze/src/rewrite/expr/convert.rs @@ -372,7 +372,7 @@ impl<'tcx> ConvertVisitor<'tcx> { let closure = Rewrite::Closure1("__ptr".into(), Box::new(body)); hir_rw = Rewrite::MethodCall("map".into(), Box::new(hir_rw), vec![closure]); } - return Ok((hir_rw, mir_rws)); + Ok((hir_rw, mir_rws)) } fn rewrite_from_mir_rws( @@ -423,7 +423,7 @@ impl<'tcx> Visitor<'tcx> for ConvertVisitor<'tcx> { let mut mir_rws = &mir_rws as &[_]; // Emit rewrites on subexpressions up front so we can access them in `get_subexpr`. - self.with_materialize_adjustments(mir_rws.len() > 0, |this| { + self.with_materialize_adjustments(!mir_rws.is_empty(), |this| { intravisit::walk_expr(this, ex); }); @@ -579,16 +579,16 @@ fn generate_zeroize_code(zero_ty: &ZeroizeType, lv: &str) -> String { ZeroizeType::Struct(ref fields) => { eprintln!("zeroize: {} fields on {lv}: {fields:?}", fields.len()); let mut s = String::new(); - write!(s, "{{\n").unwrap(); + writeln!(s, "{{").unwrap(); for (name, field_zero_ty) in fields { - write!( + writeln!( s, - "{};\n", + "{};", generate_zeroize_code(field_zero_ty, &format!("{lv}.{name}")) ) .unwrap(); } - write!(s, "}}\n").unwrap(); + writeln!(s, "}}").unwrap(); s } } @@ -653,12 +653,10 @@ pub fn convert_cast_rewrite(kind: &mir_op::RewriteKind, hir_rw: Rewrite) -> Rewr } else { "as_deref".into() } + } else if mutbl { + "as_mut".into() } else { - if mutbl { - "as_mut".into() - } else { - "as_ref".into() - } + "as_ref".into() }; Rewrite::MethodCall(ref_method, Box::new(hir_rw), vec![]) } @@ -696,7 +694,7 @@ pub fn convert_cast_rewrite(kind: &mir_op::RewriteKind, hir_rw: Rewrite) -> Rewr Box::new(Rewrite::TyPtr( Box::new(Rewrite::TyCtor( "std::cell::Cell".into(), - vec![Rewrite::Print(format!("{}", ty))], + vec![Rewrite::Print(ty.to_string())], )), hir::Mutability::Not, )), diff --git a/c2rust-analyze/src/rewrite/expr/hir_only_casts.rs b/c2rust-analyze/src/rewrite/expr/hir_only_casts.rs index df8a127e72..07a725e27b 100644 --- a/c2rust-analyze/src/rewrite/expr/hir_only_casts.rs +++ b/c2rust-analyze/src/rewrite/expr/hir_only_casts.rs @@ -111,15 +111,15 @@ where if let hir::ExprKind::Cast(src_expr, _dest_ty) = ex.kind { let src_adjusts = self.typeck_results.expr_adjustments(src_expr); if let Some(last_adjust) = src_adjusts.last() { - if matches!(last_adjust.kind, Adjust::Pointer(_)) { - if last_adjust.target == self.typeck_results.expr_ty(ex) { - // `ex` has the form `x as T`, where `x` has a pointer adjustment and its - // final adjusted type is identical to `T`. In this case, rustc skips - // generating MIR for this cast. - if (self.filter)(src_expr) { - self.rewrites - .push((ex.span, Rewrite::Sub(0, src_expr.span))); - } + if matches!(last_adjust.kind, Adjust::Pointer(_)) + && last_adjust.target == self.typeck_results.expr_ty(ex) + { + // `ex` has the form `x as T`, where `x` has a pointer adjustment and its + // final adjusted type is identical to `T`. In this case, rustc skips + // generating MIR for this cast. + if (self.filter)(src_expr) { + self.rewrites + .push((ex.span, Rewrite::Sub(0, src_expr.span))); } } } diff --git a/c2rust-analyze/src/rewrite/expr/mir_op.rs b/c2rust-analyze/src/rewrite/expr/mir_op.rs index c191257c34..afe3b0599a 100644 --- a/c2rust-analyze/src/rewrite/expr/mir_op.rs +++ b/c2rust-analyze/src/rewrite/expr/mir_op.rs @@ -453,11 +453,11 @@ impl<'a, 'tcx> ExprRewriteVisitor<'a, 'tcx> { dest_single, }); - if !pl_ty.label.is_none() { - if v.perms[pl_ty.label].intersects(PermissionSet::USED) { - let dest_lty = v.acx.type_of(&args[0]); - v.emit_cast_lty_lty(dest_lty, pl_ty); - } + if !pl_ty.label.is_none() + && v.perms[pl_ty.label].intersects(PermissionSet::USED) + { + let dest_lty = v.acx.type_of(&args[0]); + v.emit_cast_lty_lty(dest_lty, pl_ty); } }); } @@ -499,11 +499,11 @@ impl<'a, 'tcx> ExprRewriteVisitor<'a, 'tcx> { dest_single, }); - if !pl_ty.label.is_none() { - if v.perms[pl_ty.label].intersects(PermissionSet::USED) { - let dest_lty = v.acx.type_of(&args[0]); - v.emit_cast_lty_lty(dest_lty, pl_ty); - } + if !pl_ty.label.is_none() + && v.perms[pl_ty.label].intersects(PermissionSet::USED) + { + let dest_lty = v.acx.type_of(&args[0]); + v.emit_cast_lty_lty(dest_lty, pl_ty); } }); } @@ -731,7 +731,7 @@ impl<'a, 'tcx> ExprRewriteVisitor<'a, 'tcx> { None => return, }; - debug_assert!(pl.projection.len() >= 1); + debug_assert!(!pl.projection.is_empty()); // `LTy` of the base place, before the last projection. let base_lty = proj_ltys[pl.projection.len() - 1]; // `LTy` resulting from applying `last_proj` to `base_lty`. @@ -1136,18 +1136,18 @@ where Ok(match from.own { Ownership::Box => match to.own { Ownership::Raw | Ownership::Imm => { - return Err(format!("TODO: cast Box to Imm")); + return Err("TODO: cast Box to Imm".to_string()); //Some(Ownership::Imm) } Ownership::RawMut | Ownership::Mut => { - return Err(format!("TODO: cast Box to Mut")); + return Err("TODO: cast Box to Mut".to_string()); //Some(Ownership::Mut) } _ => None, }, Ownership::Rc => match to.own { Ownership::Imm | Ownership::Raw | Ownership::RawMut => { - return Err(format!("TODO: cast Rc to Imm")); + return Err("TODO: cast Rc to Imm".to_string()); //Some(Ownership::Imm) } _ => None, diff --git a/c2rust-analyze/src/rewrite/expr/mod.rs b/c2rust-analyze/src/rewrite/expr/mod.rs index 4bda05dcf9..8ed3fe1d15 100644 --- a/c2rust-analyze/src/rewrite/expr/mod.rs +++ b/c2rust-analyze/src/rewrite/expr/mod.rs @@ -76,7 +76,7 @@ fn debug_print_unlower_map<'tcx>( let sublocs = &k.sub; let ex = tcx.hir().expect_expr(v.hir_id); eprintln!(" {sublocs:?}: {:?}, {:?}", v.desc, ex.span); - for rw_kind in rewrites_by_subloc.remove(&sublocs).unwrap_or(Vec::new()) { + for rw_kind in rewrites_by_subloc.remove(&sublocs).unwrap_or_default() { eprintln!(" {rw_kind:?}"); } } diff --git a/c2rust-analyze/src/rewrite/expr/unlower.rs b/c2rust-analyze/src/rewrite/expr/unlower.rs index 9070c4c164..6a7e634fe2 100644 --- a/c2rust-analyze/src/rewrite/expr/unlower.rs +++ b/c2rust-analyze/src/rewrite/expr/unlower.rs @@ -295,7 +295,7 @@ impl<'a, 'tcx> UnlowerVisitor<'a, 'tcx> { self.visit_expr_operand(arg, loc, sub_loc, mir_arg, &[]); } - if extra_locs.len() > 0 { + if !extra_locs.is_empty() { // Special case: if the receiver of a `MethodCall` has adjustments, they are // emitted with the same span as the `MethodCall` itself, and thus show up as // leftover `extra_locs` here. We associate them with the child instead so all @@ -528,7 +528,7 @@ impl<'a, 'tcx> UnlowerVisitor<'a, 'tcx> { ExprMir::Place(pl.as_ref()), extra_locs, loc, - sub_loc.to_owned(), + sub_loc, ); self.walk_expr(ex, &mut cursor); @@ -898,7 +898,7 @@ fn is_var(pl: mir::Place) -> bool { } fn is_temp_var(mir: &Body, pl: mir::PlaceRef) -> bool { - pl.projection.len() == 0 && mir.local_kind(pl.local) == mir::LocalKind::Temp + pl.projection.is_empty() && mir.local_kind(pl.local) == mir::LocalKind::Temp } fn is_temp_var_operand(mir: &Body, op: &mir::Operand) -> bool { @@ -941,10 +941,8 @@ fn filter_stmt(stmt: &mir::Statement) -> bool { } /// Indicate whether a given MIR terminator should be considered when building the unlowering map. -fn filter_term(term: &mir::Terminator) -> bool { - match term.kind { - _ => true, - } +fn filter_term(_term: &mir::Terminator) -> bool { + true } fn build_span_index(mir: &Body<'_>) -> SpanIndex { @@ -1063,7 +1061,7 @@ pub fn unlower<'tcx>( }; visitor.visit_body(hir); - if visitor.append_extra_locations.len() > 0 { + if !visitor.append_extra_locations.is_empty() { for (&hir_id, locs) in &visitor.append_extra_locations { error!( "leftover locations for {hir_id:?} = {:?}: locs = {locs:?}", diff --git a/c2rust-analyze/src/rewrite/mod.rs b/c2rust-analyze/src/rewrite/mod.rs index 52b3996531..106ed1eddc 100644 --- a/c2rust-analyze/src/rewrite/mod.rs +++ b/c2rust-analyze/src/rewrite/mod.rs @@ -367,13 +367,13 @@ pub fn apply_rewrites( let new_src = apply::apply_rewrites(tcx.sess.source_map(), rewrites); for (filename, file_rw) in new_src { - let annotations = annotations.remove(&filename).unwrap_or(Vec::new()); + let annotations = annotations.remove(&filename).unwrap_or_default(); let new_src = add_annotations(file_rw.new_src, Some(&file_rw.line_map), annotations); emit(filename, new_src); } // Also emit files that have annotations but no rewrites. - if annotations.len() > 0 { + if !annotations.is_empty() { let mut leftover_annotations = annotations.into_iter().collect::>(); leftover_annotations.sort(); let sm = tcx.sess.source_map(); diff --git a/c2rust-analyze/src/rewrite/ty.rs b/c2rust-analyze/src/rewrite/ty.rs index 8b5cf12107..b6a0342c6a 100644 --- a/c2rust-analyze/src/rewrite/ty.rs +++ b/c2rust-analyze/src/rewrite/ty.rs @@ -118,7 +118,7 @@ fn create_rewrite_label<'tcx>( if !pointer_lty.label.is_none() && !flags[pointer_lty.label].contains(FlagSet::FIXED) { if let Some(lty) = pointee_types[pointer_lty.label].get_sole_lty() { let ty = lty.ty; - if lty.args.len() == 0 && !ty_has_adt_lifetime(ty, adt_metadata) { + if lty.args.is_empty() && !ty_has_adt_lifetime(ty, adt_metadata) { // Don't rewrite if the old and new types are the same. if ty != args[0].ty { pointee_ty = Some(ty); @@ -248,10 +248,9 @@ fn deconstruct_hir_ty<'a, 'tcx>( } } - ( - &ty::TyKind::Adt(adt_def, substs), - &hir::TyKind::Path(hir::QPath::Resolved(_, ref path)), - ) if path.res.def_id() == adt_def.did() => { + (&ty::TyKind::Adt(adt_def, substs), &hir::TyKind::Path(hir::QPath::Resolved(_, path))) + if path.res.def_id() == adt_def.did() => + { hir_generic_ty_args(hir_ty).map(|type_args| { if type_args.len() < substs.types().count() { // this situation occurs when there are hidden type arguments @@ -635,7 +634,7 @@ impl<'tcx, 'a> intravisit::Visitor<'tcx> for HirTyVisitor<'a, 'tcx> { &self.pointee_types, self.rw_lcx, lty, - &self.acx.gacx, + self.acx.gacx, ); let hir_ty = hir_local.ty.unwrap(); self.handle_ty(rw_lty, hir_ty); @@ -696,7 +695,7 @@ pub fn gen_ty_rewrites<'tcx>( .zip(input_origin_args.iter()) { let rw_lty = - rw_lcx.zip_labels_with(lty, &origin_args, &mut |pointer_lty, lifetime_lty, args| { + rw_lcx.zip_labels_with(lty, origin_args, &mut |pointer_lty, lifetime_lty, args| { create_rewrite_label( pointer_lty, args, @@ -714,7 +713,7 @@ pub fn gen_ty_rewrites<'tcx>( if let hir::FnRetTy::Return(hir_ty) = hir_sig.decl.output { let output_rw_lty = rw_lcx.zip_labels_with( lty_sig.output, - &output_origin_args, + output_origin_args, &mut |pointer_lty, lifetime_lty, args| { create_rewrite_label( pointer_lty, @@ -904,7 +903,7 @@ pub fn dump_rewritten_local_tys<'tcx>( &pointee_types, rw_lcx, acx.local_tys[local], - &acx.gacx, + acx.gacx, ); let ty = mk_rewritten_ty(rw_lcx, rw_lty); eprintln!( diff --git a/c2rust-transpile/src/lib.rs b/c2rust-transpile/src/lib.rs index 9421232c9d..60525b8f5e 100644 --- a/c2rust-transpile/src/lib.rs +++ b/c2rust-transpile/src/lib.rs @@ -263,7 +263,7 @@ pub fn transpile(tcfg: TranspilerConfig, cc_db: &Path, extra_clang_args: &[&str] let build_dir = get_build_dir(&tcfg, cc_db); - let lcmds = get_compile_commands(&cc_db, &tcfg.filter).unwrap_or_else(|_| { + let lcmds = get_compile_commands(cc_db, &tcfg.filter).unwrap_or_else(|_| { panic!( "Could not parse compile commands from {}", cc_db.to_string_lossy() @@ -330,7 +330,7 @@ pub fn transpile(tcfg: TranspilerConfig, cc_db: &Path, extra_clang_args: &[&str] cmd.abs_file(), &ancestor_path, &build_dir, - &cc_db, + cc_db, &clang_args, ) }) From 1046fca4774d5b59046e09cb44e8e5bf30a04d51 Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Wed, 28 Aug 2024 14:29:53 -0700 Subject: [PATCH 4/7] `transpile`: fix typo in `cfg_attr(tests, test)` (should be `test`) --- c2rust-transpile/src/rust_ast/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c2rust-transpile/src/rust_ast/mod.rs b/c2rust-transpile/src/rust_ast/mod.rs index 828bc37a48..26bc0f351e 100644 --- a/c2rust-transpile/src/rust_ast/mod.rs +++ b/c2rust-transpile/src/rust_ast/mod.rs @@ -127,7 +127,7 @@ struct SpanRepr { /// But hopefully if such circumstances do befall us, we'll at least know what went wrong. /// /// On the plus side, the `fallback::Span` payload is a POD pair of two u32s, so that case is trivial. -#[cfg_attr(tests, test)] +#[cfg_attr(test, test)] fn validate_repr() { let repr: SpanRepr = unsafe { std::mem::transmute(Span::call_site()) }; assert!(repr.compiler_or_fallback == 1); From 0c5bd33ed77d63f6cd39bf83f5a353889e44dfd2 Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Wed, 28 Aug 2024 15:55:25 -0700 Subject: [PATCH 5/7] `transpile`: fix `#[warn(for_loops_over_fallibles)]` --- c2rust-transpile/src/c_ast/iterators.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/c2rust-transpile/src/c_ast/iterators.rs b/c2rust-transpile/src/c_ast/iterators.rs index 22ba07e71c..df1d547f06 100644 --- a/c2rust-transpile/src/c_ast/iterators.rs +++ b/c2rust-transpile/src/c_ast/iterators.rs @@ -214,8 +214,8 @@ fn immediate_stmt_children(kind: &CStmtKind) -> Vec { false_variant: opt_s, } => { let mut res = intos![e, s]; - for &x in &opt_s { - res.push(x.into()) + if let Some(x) = opt_s { + res.push(x.into()); } res } @@ -239,14 +239,14 @@ fn immediate_stmt_children(kind: &CStmtKind) -> Vec { body: d, } => { let mut res = vec![]; - for &x in &a { - res.push(x.into()) + if let Some(x) = a { + res.push(x.into()); } - for &x in &b { - res.push(x.into()) + if let Some(x) = b { + res.push(x.into()); } - for &x in &c { - res.push(x.into()) + if let Some(x) = c { + res.push(x.into()); } res.push(d.into()); res From f827b05eb51003a7a480f3c64a5e9ea2570c0dd9 Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Wed, 28 Aug 2024 15:59:22 -0700 Subject: [PATCH 6/7] `Cargo.toml`: set `resolver = "2"` --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index c9d6ce881c..5c07c866c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "analysis/runtime", "c2rust", From 9527c7a6eedf2dd33b6d019ee9e3cebcf98e1c6f Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Wed, 28 Aug 2024 16:24:36 -0700 Subject: [PATCH 7/7] `Cargo.toml`: set `rust-version` to our pinned nightly --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 5c07c866c8..07e71cab24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ exclude = [ version = "0.19.0" authors = ["The C2Rust Project Developers "] edition = "2021" +rust-version = "1.65" readme = "README.md" homepage = "https://c2rust.com/" repository = "https://github.com/immunant/c2rust/"