Skip to content

Commit

Permalink
csharp backend should fail for nested slices
Browse files Browse the repository at this point in the history
  • Loading branch information
arsher authored and ralfbiedert committed Feb 18, 2025
1 parent c2bd388 commit 1db6b72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/backend_csharp/src/converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ pub fn get_slice_type(x: &CompositeType) -> CType {
pub fn get_slice_type_argument(x: &CompositeType) -> String {
let data_field = x.fields().iter().find(|x| x.name() == "data").expect("Slice must have data field");
let t = if let CType::ReadPointer(y) = data_field.the_type() {
to_typespecifier_in_param(y)
if matches!(&**y, CType::Pattern(TypePattern::Slice(_) | TypePattern::SliceMut(_))) {
panic!("Slice data field must not be a slice")
} else {
to_typespecifier_in_param(y)
}
} else {
panic!("Slice data field must be a pointer")
};
Expand Down

0 comments on commit 1db6b72

Please sign in to comment.