@@ -6,7 +6,7 @@ use std::fmt;
66use std:: io:: Write ;
77
88use crate :: bindgen:: cdecl;
9- use crate :: bindgen:: config:: Config ;
9+ use crate :: bindgen:: config:: { Config , Language } ;
1010use crate :: bindgen:: declarationtyperesolver:: DeclarationTypeResolver ;
1111use crate :: bindgen:: dependencies:: Dependencies ;
1212use crate :: bindgen:: ir:: { Documentation , GenericParams , GenericPath , Path } ;
@@ -411,7 +411,7 @@ impl Type {
411411 }
412412 }
413413
414- fn simplified_type ( & self ) -> Option < Self > {
414+ fn simplified_type ( & self , config : & Config ) -> Option < Self > {
415415 let path = match * self {
416416 Type :: Path ( ref p) => p,
417417 _ => return None ,
@@ -422,7 +422,7 @@ impl Type {
422422 }
423423
424424 let mut generic = path. generics ( ) [ 0 ] . clone ( ) ;
425- generic. simplify_standard_types ( ) ;
425+ generic. simplify_standard_types ( config ) ;
426426
427427 match path. name ( ) {
428428 // FIXME(#223): This is not quite correct.
@@ -433,13 +433,14 @@ impl Type {
433433 is_nullable : false ,
434434 is_ref : false ,
435435 } ) ,
436- "Cell" | "ManuallyDrop" | "MaybeUninit" => Some ( generic) ,
436+ "Cell" => Some ( generic) ,
437+ "ManuallyDrop" | "MaybeUninit" if config. language == Language :: C => Some ( generic) ,
437438 _ => None ,
438439 }
439440 }
440441
441- pub fn simplify_standard_types ( & mut self ) {
442- if let Some ( ty) = self . simplified_type ( ) {
442+ pub fn simplify_standard_types ( & mut self , config : & Config ) {
443+ if let Some ( ty) = self . simplified_type ( config ) {
443444 * self = ty;
444445 }
445446 }
0 commit comments