File tree 3 files changed +43
-0
lines changed
3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -516,6 +516,30 @@ impl CodeGenerator for Type {
516
516
inner_item. to_rust_ty ( ctx)
517
517
} ;
518
518
519
+ {
520
+ // FIXME(emilio): This is a workaround to avoid generating
521
+ // incorrect type aliases because of types that we haven't
522
+ // been able to resolve (because, eg, they depend on a
523
+ // template parameter).
524
+ //
525
+ // It's kind of a shame not generating them even when they
526
+ // could be referenced, but we already do the same for items
527
+ // with invalid template parameters, and at least this way
528
+ // they can be replaced, instead of generating plain invalid
529
+ // code.
530
+ let inner_canon_type =
531
+ inner_item. expect_type ( ) . canonical_type ( ctx) ;
532
+ if inner_canon_type. is_named ( ) &&
533
+ inner_canon_type. name ( ) . map_or ( false , |name| {
534
+ name. contains ( "decltype " ) ||
535
+ name. contains ( "decltype(" )
536
+ } ) {
537
+ warn ! ( "Item contained `decltype`d type, skipping: \
538
+ {:?}, {:?}", item, inner_item) ;
539
+ return ;
540
+ }
541
+ }
542
+
519
543
let rust_name = ctx. rust_ident ( & name) ;
520
544
let mut typedef = aster:: AstBuilder :: new ( ) . item ( ) . pub_ ( ) ;
521
545
Original file line number Diff line number Diff line change
1
+ /* automatically generated by rust-bindgen */
2
+
3
+
4
+ #![ allow( non_snake_case) ]
5
+
6
+
7
+ #[ repr( C ) ]
8
+ #[ derive( Debug , Copy , Clone ) ]
9
+ pub struct std_allocator_traits < _Alloc > {
10
+ pub _address : u8 ,
11
+ pub _phantom_0 : :: std:: marker:: PhantomData < _Alloc > ,
12
+ }
Original file line number Diff line number Diff line change
1
+ // bindgen-flags: -- -std=c++11
2
+
3
+ namespace std {
4
+ template <typename _Alloc> struct allocator_traits {
5
+ typedef decltype ( _S_size_type_helper ( ( _Alloc * ) 0 ) ) __size_type;
6
+ };
7
+ }
You can’t perform that action at this time.
0 commit comments