Skip to content

Commit b9339f4

Browse files
authored
Release 0.19.0 (#1116)
This * updates our version to `0.19.0` * fixes `clippy` warnings * fixes warnings on `stable` (`1.80.1`), including setting `resolver = "2"` * sets `rust-version = "1.65"`, our pinned nightly However, I'm unable to run `cargo update` since the resolver is still MSRV-unaware IIUC. `cargo outdated` also fails: ```shell > cargo outdated -R error: failed to run `rustc` to learn about target-specific information Caused by: process didn't exit successfully: `/home/kkysen/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names -C link-arg=-fuse-ld=/home/kkysen/work/c++/mold/current/bin/mold --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1) --- stderr error: unknown print request `split-debuginfo` ``` Otherwise, this should be everything according to https://github.com/immunant/c2rust/wiki/Release-Process that needs to be checked in.
2 parents df3893f + 9527c7a commit b9339f4

File tree

39 files changed

+141
-144
lines changed

39 files changed

+141
-144
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ marks.*.json
5050
inspect/
5151
*.analysis.txt
5252
analysis.txt
53+
polonius_cache/

Cargo.lock

+13-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[workspace]
2+
resolver = "2"
23
members = [
34
"analysis/runtime",
45
"c2rust",
@@ -23,9 +24,10 @@ exclude = [
2324
]
2425

2526
[workspace.package]
26-
version = "0.18.0"
27+
version = "0.19.0"
2728
authors = ["The C2Rust Project Developers <[email protected]>"]
2829
edition = "2021"
30+
rust-version = "1.65"
2931
readme = "README.md"
3032
homepage = "https://c2rust.com/"
3133
repository = "https://github.com/immunant/c2rust/"

analysis/tests/lighttpd-minimal/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55

66
[dependencies]
77
libc = "0.2"
8-
c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.18.0" }
8+
c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.19.0" }
99

1010
[features]
1111
miri = []

analysis/tests/lighttpd/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55

66
[dependencies]
77
libc = "0.2"
8-
c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.18.0" }
8+
c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.19.0" }
99

1010
[features]
1111
miri = []

analysis/tests/minimal/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66

77
[dependencies]
88
libc = "0.2"
9-
c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.18.0" }
9+
c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.19.0" }
1010

1111
[features]
1212
miri = []

analysis/tests/misc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77

88
[dependencies]
99
libc = "0.2"
10-
c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.18.0" }
10+
c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.19.0" }
1111

1212
[features]
1313
miri = []

c2rust-analyze/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ toml_edit = "0.19.8"
3232
sha2 = "0.10.8"
3333

3434
[build-dependencies]
35-
c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.18.0" }
35+
c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.19.0" }
3636
print_bytes = "1.1"
3737

3838
[dev-dependencies]
39-
c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.18.0" }
39+
c2rust-build-paths = { path = "../c2rust-build-paths", version = "0.19.0" }
4040
clap = { version = "4.1.9", features = ["derive"] }
4141
shlex = "1.3.0"
4242

c2rust-analyze/src/analyze.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ fn mark_foreign_fixed<'tcx>(
370370
make_ty_fixed(gasn, lty);
371371

372372
// Also fix the `addr_of_static` permissions.
373-
let ptr = gacx.addr_of_static[&did];
373+
let ptr = gacx.addr_of_static[did];
374374
gasn.flags[ptr].insert(FlagSet::FIXED);
375375
}
376376
}
@@ -397,7 +397,7 @@ fn mark_all_statics_fixed<'tcx>(gacx: &mut GlobalAnalysisCtxt<'tcx>, gasn: &mut
397397
make_ty_fixed(gasn, lty);
398398

399399
// Also fix the `addr_of_static` permissions.
400-
let ptr = gacx.addr_of_static[&did];
400+
let ptr = gacx.addr_of_static[did];
401401
gasn.flags[ptr].insert(FlagSet::FIXED);
402402
}
403403
}
@@ -425,7 +425,7 @@ fn parse_def_id(s: &str) -> Result<DefId, String> {
425425
let s = s
426426
.strip_prefix("DefId(")
427427
.ok_or("does not start with `DefId(`")?;
428-
let s = s.strip_suffix(")").ok_or("does not end with `)`")?;
428+
let s = s.strip_suffix(')').ok_or("does not end with `)`")?;
429429
let s = match s.find(" ~ ") {
430430
Some(i) => &s[..i],
431431
None => s,
@@ -459,11 +459,11 @@ fn read_fixed_defs_list(fixed_defs: &mut HashSet<DefId>, path: &str) -> io::Resu
459459
for (i, line) in f.lines().enumerate() {
460460
let line = line?;
461461
let line = line.trim();
462-
if line.len() == 0 || line.starts_with('#') {
462+
if line.is_empty() || line.starts_with('#') {
463463
continue;
464464
}
465465

466-
let def_id = parse_def_id(&line).unwrap_or_else(|e| {
466+
let def_id = parse_def_id(line).unwrap_or_else(|e| {
467467
panic!("failed to parse {} line {}: {}", path, i + 1, e);
468468
});
469469
fixed_defs.insert(def_id);
@@ -481,7 +481,7 @@ fn check_rewrite_path_prefixes(tcx: TyCtxt, fixed_defs: &mut HashSet<DefId>, pre
481481
.split(',')
482482
// Exclude empty paths. This allows for leading/trailing commas or double commas within
483483
// the list, which may result when building the list programmatically.
484-
.filter(|prefix| prefix.len() > 0)
484+
.filter(|prefix| !prefix.is_empty())
485485
.map(|prefix| prefix.split("::").map(Symbol::intern).collect::<Vec<_>>())
486486
.collect();
487487
let sym_impl = Symbol::intern("{impl}");
@@ -1510,8 +1510,7 @@ fn run2<'tcx>(
15101510
continue;
15111511
}
15121512

1513-
let adt_rewrites =
1514-
rewrite::gen_adt_ty_rewrites(&gacx, &gasn, &global_pointee_types, def_id);
1513+
let adt_rewrites = rewrite::gen_adt_ty_rewrites(&gacx, &gasn, global_pointee_types, def_id);
15151514
let report = adt_reports.entry(def_id).or_default();
15161515
writeln!(
15171516
report,
@@ -1691,7 +1690,7 @@ fn run2<'tcx>(
16911690
ptrs.push(ptr);
16921691
format!("{{{}}}", ptr)
16931692
});
1694-
if ptrs.len() == 0 {
1693+
if ptrs.is_empty() {
16951694
continue;
16961695
}
16971696
ann.emit(span, format_args!("typeof({}) = {}", name, ty_str));
@@ -1789,7 +1788,7 @@ fn run2<'tcx>(
17891788
all_fn_ldids.len()
17901789
);
17911790

1792-
if known_perm_error_fns.len() > 0 {
1791+
if !known_perm_error_fns.is_empty() {
17931792
eprintln!(
17941793
"saw permission errors in {} known fns",
17951794
known_perm_error_fns.len()
@@ -1893,7 +1892,7 @@ fn apply_test_attr_force_non_null_args(
18931892
let mut updates_forbidden = g_updates_forbidden.and_mut(&mut info.l_updates_forbidden);
18941893

18951894
let lsig = &gacx.fn_sigs[&ldid.to_def_id()];
1896-
for arg_lty in lsig.inputs.iter().copied() {
1895+
for arg_lty in lsig.inputs {
18971896
for lty in arg_lty.iter() {
18981897
let ptr = lty.label;
18991898
if !ptr.is_none() {
@@ -2014,7 +2013,7 @@ fn print_function_pointee_types<'tcx>(
20142013

20152014
for ptr in all_pointer_ids {
20162015
let tys = &pointee_types[ptr];
2017-
if tys.ltys.len() == 0 && !tys.incomplete {
2016+
if tys.ltys.is_empty() && !tys.incomplete {
20182017
continue;
20192018
}
20202019
eprintln!(

c2rust-analyze/src/borrowck/type_check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl<'tcx> TypeChecker<'tcx, '_> {
177177
self.facts,
178178
self.maps,
179179
&self.acx.gacx.adt_metadata,
180-
&self.acx.gacx.static_tys[&did],
180+
self.acx.gacx.static_tys[&did],
181181
);
182182

183183
for l in lty.iter() {
@@ -585,7 +585,7 @@ impl<'tcx> TypeChecker<'tcx, '_> {
585585
}
586586
Callee::Memcpy => {
587587
let _pl_lty = self.visit_place(destination);
588-
let _rv_lty = assert_matches!(&args[..], [dest, src, _] => {
588+
assert_matches!(&args[..], [dest, src, _] => {
589589
self.visit_operand(dest);
590590
self.visit_operand(src);
591591
});

c2rust-analyze/src/context.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ pub fn print_ty_with_pointer_labels_into<L: Copy>(
15031503
// Types with arguments
15041504
Adt(adt_def, _substs) => {
15051505
write!(dest, "{:?}", adt_def.did()).unwrap();
1506-
if lty.args.len() != 0 {
1506+
if !lty.args.is_empty() {
15071507
dest.push('<');
15081508
// TODO: region args
15091509
for (i, &arg_lty) in lty.args.iter().enumerate() {
@@ -1532,31 +1532,31 @@ pub fn print_ty_with_pointer_labels_into<L: Copy>(
15321532
dest.push_str("*mut ");
15331533
}
15341534
let s = f(lty.label);
1535-
if s.len() > 0 {
1535+
if !s.is_empty() {
15361536
dest.push_str(&s);
1537-
dest.push_str(" ");
1537+
dest.push(' ');
15381538
}
15391539
print_ty_with_pointer_labels_into(dest, lty.args[0], f);
15401540
}
15411541
&Ref(_rg, _ty, mutbl) => {
15421542
let s = f(lty.label);
15431543
if mutbl == Mutability::Not {
1544-
dest.push_str("&");
1545-
if s.len() > 0 {
1544+
dest.push('&');
1545+
if !s.is_empty() {
15461546
dest.push(' ');
15471547
}
15481548
} else {
15491549
dest.push_str("&mut ");
15501550
}
1551-
if s.len() > 0 {
1551+
if !s.is_empty() {
15521552
dest.push_str(&s);
1553-
dest.push_str(" ");
1553+
dest.push(' ');
15541554
}
15551555
print_ty_with_pointer_labels_into(dest, lty.args[0], f);
15561556
}
15571557
FnDef(def_id, _substs) => {
15581558
write!(dest, "{:?}", def_id).unwrap();
1559-
if lty.args.len() != 0 {
1559+
if !lty.args.is_empty() {
15601560
dest.push('<');
15611561
// TODO: region args
15621562
for (i, &arg_lty) in lty.args.iter().enumerate() {
@@ -1581,14 +1581,14 @@ pub fn print_ty_with_pointer_labels_into<L: Copy>(
15811581
print_ty_with_pointer_labels_into(dest, ret_lty, f);
15821582
}
15831583
Tuple(_) => {
1584-
dest.push_str("(");
1584+
dest.push('(');
15851585
for (i, &arg_lty) in lty.args.iter().enumerate() {
15861586
if i > 0 {
15871587
dest.push_str(", ");
15881588
}
15891589
print_ty_with_pointer_labels_into(dest, arg_lty, f);
15901590
}
1591-
dest.push_str(")");
1591+
dest.push(')');
15921592
}
15931593

15941594
// Types that aren't actually supported by this code yet

c2rust-analyze/src/dataflow/type_check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ impl<'tcx> TypeChecker<'tcx, '_> {
603603
self.visit_operand(&args[0]);
604604
}
605605
Callee::Null { .. } => {
606-
assert!(args.len() == 0);
606+
assert!(args.is_empty());
607607
self.visit_place(destination, Mutability::Mut);
608608
let pl_lty = self.acx.type_of(destination);
609609
// We are assigning a null pointer to `destination`, so it must not have the

c2rust-analyze/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ fn cargo_wrapper(rustc_wrapper: &Path) -> anyhow::Result<()> {
438438
cmd.env("C2RUST_ANALYZE_FIXED_DEFS_LIST", fixed_defs_list);
439439
}
440440

441-
if rewrite_paths.len() > 0 {
441+
if !rewrite_paths.is_empty() {
442442
let rewrite_paths = rewrite_paths.join(OsStr::new(","));
443443
cmd.env("C2RUST_ANALYZE_REWRITE_PATHS", rewrite_paths);
444444
}

c2rust-analyze/src/pointee_type/solve.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub fn propagate_types<'tcx>(
5656
if new && !ty_sets[ptr1].is_subset(&ty_sets[ptr2]) {
5757
let (tys1, tys2) = index_both(&mut ty_sets, ptr1, ptr2);
5858
for cty in tys1.iter() {
59-
tys2.insert(cty.clone());
59+
tys2.insert(*cty);
6060
}
6161
// Since `ty_sets[ptr2]` was not a subset of `ty_sets[ptr1]`, we must have added at
6262
// least one element to `ty_sets[ptr2]`.
@@ -75,7 +75,7 @@ pub fn propagate_types<'tcx>(
7575
if !ty_sets[ptr1].is_subset(&ty_sets[ptr2]) {
7676
let (tys1, tys2) = index_both(&mut ty_sets, ptr1, ptr2);
7777
for cty in tys1.iter() {
78-
tys2.insert(cty.clone());
78+
tys2.insert(*cty);
7979
}
8080
// Since `ty_sets[ptr2]` was not a subset of `ty_sets[ptr1]`, we must have added at
8181
// least one element to `ty_sets[ptr2]`.

0 commit comments

Comments
 (0)