Skip to content

Commit 7281bf3

Browse files
committed
Remove last remains of C++-side mutable slice type
1 parent 431dec1 commit 7281bf3

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

gen/src/write.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,9 @@ fn pick_includes_and_builtins(out: &mut OutFile, apis: &[Api]) {
168168
Type::CxxVector(_) => out.include.vector = true,
169169
Type::Fn(_) => out.builtin.rust_fn = true,
170170
Type::Slice(_) => out.builtin.rust_slice = true,
171-
Type::SliceRefU8(ty) => {
171+
Type::SliceRefU8(_) => {
172172
out.include.cstdint = true;
173-
out.builtin.rust_slice |= ty.mutability.is_none();
174-
out.builtin.rust_mut_slice |= ty.mutability.is_some();
173+
out.builtin.rust_slice = true;
175174
}
176175
Type::Ref(_) | Type::Void(_) => {}
177176
}
@@ -436,7 +435,7 @@ fn write_cxx_function_shim<'a>(out: &mut OutFile<'a>, efn: &'a ExternFn) {
436435
write!(out, "::rust::impl<::rust::Slice<const uint8_t>>::repr(")
437436
}
438437
Some(Type::SliceRefU8(_)) if !indirect_return => {
439-
out.builtin.rust_mut_slice_repr = true;
438+
out.builtin.rust_slice_repr = true;
440439
write!(out, "::rust::impl<::rust::Slice<uint8_t>>::repr(")
441440
}
442441
_ => {}
@@ -698,14 +697,10 @@ fn write_rust_function_shim_impl(
698697
out.builtin.rust_str_new_unchecked = true;
699698
write!(out, "::rust::impl<::rust::Str>::new_unchecked(");
700699
}
701-
Type::SliceRefU8(ty) if ty.mutability.is_none() => {
700+
Type::SliceRefU8(_) => {
702701
out.builtin.rust_slice_new = true;
703702
write!(out, "::rust::impl<::rust::Slice<const uint8_t>>::slice(");
704703
}
705-
Type::SliceRefU8(_) => {
706-
out.builtin.rust_mut_slice_new = true;
707-
write!(out, "::rust::impl<::rust::Slice<uint8_t>>::slice(");
708-
}
709704
_ => {}
710705
}
711706
}
@@ -728,13 +723,13 @@ fn write_rust_function_shim_impl(
728723
out.builtin.rust_str_repr = true;
729724
write!(out, "::rust::impl<::rust::Str>::repr(");
730725
}
731-
Type::SliceRefU8(ty) if ty.mutability.is_none() => {
726+
Type::SliceRefU8(ty) => {
732727
out.builtin.rust_slice_repr = true;
733-
write!(out, "::rust::impl<::rust::Slice<const uint8_t>>::repr(");
734-
}
735-
Type::SliceRefU8(_) => {
736-
out.builtin.rust_mut_slice_repr = true;
737-
write!(out, "::rust::impl<::rust::Slice<uint8_t>>::repr(");
728+
if ty.mutability.is_none() {
729+
write!(out, "::rust::impl<::rust::Slice<const uint8_t>>::repr(");
730+
} else {
731+
write!(out, "::rust::impl<::rust::Slice<uint8_t>>::repr(");
732+
}
738733
}
739734
ty if out.types.needs_indirect_abi(ty) => write!(out, "&"),
740735
_ => {}

0 commit comments

Comments
 (0)