Skip to content

Commit 080452a

Browse files
committedMar 31, 2022
replace removed wrapping_offset_from method with offset_from
see rust-lang/rust#73580
1 parent 062d313 commit 080452a

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed
 

‎c2rust-transpile/src/translator/operators.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -736,12 +736,7 @@ impl<'c> Translation<'c> {
736736
"Cannot use wrapping offset from in a const expression",
737737
));
738738
}
739-
// The wrapping_offset_from method is locked behind a feature gate
740-
// and replaces the now deprecated offset_to (opposite argument order)
741-
// wrapping_offset_from panics when the pointee is a ZST
742-
self.use_feature("ptr_wrapping_offset_from");
743-
744-
let mut offset = mk().method_call_expr(lhs, "wrapping_offset_from", vec![rhs]);
739+
let mut offset = mk().method_call_expr(lhs, "offset_from", vec![rhs]);
745740

746741
if let Some(sz) = self.compute_size_of_expr(pointee.ctype) {
747742
let div = cast_int(sz, "isize", false);

‎tests/pointers/src/test_pointers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! feature_c_variadic, feature_ptr_wrapping_offset_from
1+
//! feature_c_variadic
22
33
extern crate libc;
44

0 commit comments

Comments
 (0)