Fix module path of Vec in generated Rust code

This commit is contained in:
David Tolnay 2020-04-25 14:10:29 -07:00
parent 99c93d864c
commit 51cc8ee061
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -35,9 +35,12 @@ impl ToTokens for Var {
impl ToTokens for Ty1 {
fn to_tokens(&self, tokens: &mut TokenStream) {
if let "UniquePtr" | "RustVec" | "CxxVector" = self.name.to_string().as_str() {
let span = self.name.span();
let span = self.name.span();
let name = self.name.to_string();
if let "UniquePtr" | "CxxVector" = name.as_str() {
tokens.extend(quote_spanned!(span=> ::cxx::));
} else if name == "Vec" {
tokens.extend(quote_spanned!(span=> ::std::vec::));
}
self.name.to_tokens(tokens);
self.langle.to_tokens(tokens);