}
break;
+ case TYPE_CODE_PTR:
+ {
+ if (TYPE_NAME (type) != nullptr)
+ fputs_filtered (TYPE_NAME (type), stream);
+ else
+ {
+ /* We currently can't distinguish between pointers and
+ references. */
+ fputs_filtered ("*mut ", stream);
+ type_print (TYPE_TARGET_TYPE (type), "", stream, 0);
+ }
+ }
+ break;
+
default:
c_printer:
c_print_type (type, varstring, stream, show, level, flags);
gdb_test "print \[mut 23usize; 4\]" " = \\\[23, 23, 23, 23\\\]"
# Test lexer corner cases.
-gdb_test "print 0x0 as *const ()" " = \\\(\\\(\\\) \\*\\\) 0x0"
-gdb_test "print 0x0 as fn(i64) -> ()" " = \\\(\\\(\\\) \\\(\\*\\\)\\\(i64\\\)\\\) 0x0"
+gdb_test "print 0x0 as *mut ()" " = \\\(\\*mut \\\(\\\)\\\) 0x0"
+gdb_test "print 0x0 as fn(i64) -> ()" " = \\\(\\*mut fn \\\(i64\\\) -> \\\(\\\)\\\) 0x0"
gdb_test "print r#" "syntax error in expression, near `#'\\."
gdb_test "printf \"%d %d\\n\", 23+1, 23-1" "24 22"
gdb_test "print *(&c as &i32)" " = 0"
gdb_test "print *(&c as *const i32)" " = 0"
gdb_test "print *(&c as *mut i32)" " = 0"
+gdb_test "ptype &c as *mut i32" "\\*mut i32"
gdb_test "print/c f\[0\]" " = 104 'h'"
gdb_test "print fslice" " = \"bob\""
gdb_test "print &f\[3..\]" " = \"bob\""
-gdb_test "print g" " = \\(u8 \\(\\*\\)\\\[6\\\]\\) $hex b\"hi bob\""
-gdb_test "ptype g" " = u8 \\(\\*\\)\\\[6\\\]"
+gdb_test "print g" " = \\(\\*mut \\\[u8; 6\\\]\\) $hex b\"hi bob\""
+gdb_test "ptype g" " = \\*mut \\\[u8; 6\\\]"
gdb_test "print v" " = simple::Something::Three"
gdb_test_sequence "ptype v" "" {
gdb_test_sequence "ptype slice" "" {
" = struct &\\\[i32\\\] \\{"
- " data_ptr: i32 \\*,"
+ " data_ptr: \\*mut i32,"
" length: usize,"
"\\}"
}
gdb_test_sequence "ptype &slice\[..\]" "" {
" = struct &\\\[i32\\\] \\{"
- " data_ptr: i32 \\*,"
+ " data_ptr: \\*mut i32,"
" length: usize,"
"\\}"
}
gdb_test_sequence "ptype &b\[..\]" "" {
" = struct &\\\[\\*gdb\\*\\\] \\{"
- " data_ptr: i32 \\*,"
+ " data_ptr: \\*mut i32,"
" length: usize,"
"\\}"
}
gdb_test "print (*parametrized.next.val)" \
" = simple::ParametrizedStruct<i32> {next: simple::ParametrizedEnum<\[a-z:\]*Box<simple::ParametrizedStruct<i32>>>::Empty, value: 1}"
gdb_test "print parametrized.next.val" \
- " = \\(simple::ParametrizedStruct<i32> \\*\\) $hex"
+ " = \\(\\*mut simple::ParametrizedStruct<i32>\\) $hex"
gdb_test "print parametrized" \
" = simple::ParametrizedStruct<i32> \\{next: simple::ParametrizedEnum<\[a-z:\]*Box<simple::ParametrizedStruct<i32>>>::Val\\{val: $hex\\}, value: 0\\}"