Allow empty struct expressions in Rust
[deliverable/binutils-gdb.git] / gdb / rust-lang.c
index 3deb52586ee40d50d91a354735af82694974c2c7..481a4fc59430ca319c5b00b72382461002423915 100644 (file)
@@ -294,7 +294,10 @@ rust_underscore_fields (struct type *type, int offset)
 int
 rust_tuple_struct_type_p (struct type *type)
 {
-  return rust_underscore_fields (type, 0);
+  /* This is just an approximation until DWARF can represent Rust more
+     precisely.  We exclude zero-length structs because they may not
+     be tuple structs, and there's no way to tell.  */
+  return TYPE_NFIELDS (type) > 0 && rust_underscore_fields (type, 0);
 }
 
 /* Return true if a variant TYPE is a tuple variant, false otherwise.  */
This page took 0.024618 seconds and 4 git commands to generate.