Allow indexing of &str in Rust
rust_slice_type_p was not recognizing &str as a slice type, so indexing into (or making a slice of) a slice was not working. 2017-10-02 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_slice_type_p): Recognize &str as a slice type. 2017-10-02 Tom Tromey <tom@tromey.com> * gdb.rust/simple.exp: Test index of slice.
This commit is contained in:
parent
888e3ddb20
commit
01af5e0d09
4 changed files with 12 additions and 1 deletions
|
@ -340,7 +340,8 @@ rust_slice_type_p (struct type *type)
|
|||
{
|
||||
return (TYPE_CODE (type) == TYPE_CODE_STRUCT
|
||||
&& TYPE_TAG_NAME (type) != NULL
|
||||
&& strncmp (TYPE_TAG_NAME (type), "&[", 2) == 0);
|
||||
&& (strncmp (TYPE_TAG_NAME (type), "&[", 2) == 0
|
||||
|| strcmp (TYPE_TAG_NAME (type), "&str") == 0));
|
||||
}
|
||||
|
||||
/* Return true if TYPE is a range type, otherwise false. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue