diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index be6e4ae5498..73c966a3320 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -345,8 +345,14 @@ get_identifier_node (const std::string &str) tree wchar_type () { - tree wchar = make_unsigned_type (32); - TYPE_STRING_FLAG (wchar) = 1; + static tree wchar; + + if (wchar == NULL_TREE) + { + wchar = make_unsigned_type (32); + TYPE_STRING_FLAG (wchar) = 1; + } + return wchar; }