summaryrefslogtreecommitdiff
path: root/gdb/rust-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/rust-parse.c')
-rw-r--r--gdb/rust-parse.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c
index 648e48dda40..427169611d3 100644
--- a/gdb/rust-parse.c
+++ b/gdb/rust-parse.c
@@ -1682,6 +1682,16 @@ rust_parser::parse_slice_type ()
{
assume ('&');
+ /* Handle &str specially. This is an important type in Rust. While
+ the compiler does emit the "&str" type in the DWARF, just "str"
+ itself isn't always available -- but it's handy if this works
+ seamlessly. */
+ if (current_token == IDENT && get_string () == "str")
+ {
+ lex ();
+ return rust_slice_type ("&str", get_type ("u8"), get_type ("usize"));
+ }
+
bool is_slice = current_token == '[';
if (is_slice)
lex ();