Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bilge-impl/src/bitsize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ fn check_type_is_supported(ty: &Type) {
Tuple(tuple) => tuple.elems.iter().for_each(check_type_is_supported),
Array(array) => check_type_is_supported(&array.elem),
// Probably okay (compilation would validate that this type is also Bitsized)
Path(_) => (),
Path(type_path) => {
for segment in &type_path.path.segments {
if !segment.arguments.is_none() {
abort!(ty, "generic arguments are not supported");
}
}
}
// These don't work with structs or aren't useful in bitfields.
BareFn(_) | Group(_) | ImplTrait(_) | Infer(_) | Macro(_) | Never(_) |
// We could provide some info on error as to why Ptr/Reference won't work due to safety.
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/field-type-is-not-supported.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ struct A {

// Paren(_)
m: (u8),

// Path(type_path) where type_path has a segment with angle brackets
n: Box<dyn Write>,
}

fn main() {}