Skip to content

Commit bb351c7

Browse files
committed
Fix crash when extern function item has no return type
Return types are optional in rust and extern fn items can be a ZST for the result. Addresses #421 Fixes #595
1 parent a4e3ffd commit bb351c7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gcc/rust/ast/rust-ast-full-test.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -3595,7 +3595,8 @@ ExternalFunctionItem::as_string () const
35953595
}
35963596

35973597
// add type on new line
3598-
str += "\n (return) Type: " + return_type->as_string ();
3598+
str += "\n (return) Type: "
3599+
+ (has_return_type () ? return_type->as_string () : "()");
35993600

36003601
// where clause
36013602
str += "\n Where clause: ";

0 commit comments

Comments
 (0)