This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix handling of discriminantless univariant enums in Rust

>>>>> "Manish" == Manish Goregaokar <> writes:

Manish> +  else if (TYPE_NFIELDS (type) == 1) {
Manish> +    /* Sometimes univariant enums are encoded without a
Manish> +    discriminant. In that case, treating it as an encoded enum
Manish> +    with the first field being the actual type works.  */
Manish> +    const char* field_name = TYPE_NAME (TYPE_FIELD_TYPE (type, 0));
Manish> + = concat (TYPE_NAME (type), "::",
Manish> +                       rust_last_path_segment (field_name),
Manish> +                       (char *) NULL);
Manish> +    ret.field_no = RUST_ENCODED_ENUM_REAL;
Manish> +    ret.is_encoded = 1;
Manish> +    return ret;
Manish> +  }

This needs some small changes to conform to the GNU coding style.

Also, I suspect this will wind up doing the wrong thing in the
STRUCTOP_ANONYMOUS case in rust_evaluate_subexp.  In particular I wonder
if an additional "print univariant.0.a" test will work correctly?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]