Allow subscripting raw pointers

This will be useful for dealing with vectors; regardless of our final solution
for the Index trait.

2016-07-06  Manish Goregaokar  <manish@mozilla.com>

gdb/ChangeLog:
    * rust-lang.c (rust_subscript): Allow subscripting pointers

gdb/testsuite/ChangeLog:
    * simple.rs: Add test for raw pointer subscripting
    * simple.exp: Add test expectations
This commit is contained in:
Manish Goregaokar 2016-07-06 10:55:10 +05:30
parent 6949d8a719
commit 42d940118a
No known key found for this signature in database
GPG key ID: 3BBF4D3E2EF79F98
5 changed files with 17 additions and 0 deletions

View file

@ -1415,6 +1415,12 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
low_bound = 0;
high_bound = value_as_long (len);
}
else if (TYPE_CODE (type) == TYPE_CODE_PTR)
{
base = lhs;
low_bound = 0;
high_bound = LONGEST_MAX;
}
else
error (_("Cannot subscript non-array type"));