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 @@ -515,6 +515,30 @@ impl CodeGenerator for Type {
515
515
inner_item. to_rust_ty ( ctx)
516
516
} ;
517
517
518
+ {
519
+ // FIXME(emilio): This is a workaround to avoid generating
520
+ // incorrect type aliases because of types that we haven't
521
+ // been able to resolve (because, eg, they depend on a
522
+ // template parameter).
523
+ //
524
+ // It's kind of a shame not generating them even when they
525
+ // could be referenced, but we already do the same for items
526
+ // with invalid template parameters, and at least this way
527
+ // they can be replaced, instead of generating plain invalid
528
+ // code.
529
+ let inner_canon_type =
530
+ inner_item. expect_type ( ) . canonical_type ( ctx) ;
531
+ if inner_canon_type. is_named ( ) &&
532
+ inner_canon_type. name ( ) . map_or ( false , |name| {
533
+ name. contains ( "decltype " ) ||
534
+ name. contains ( "decltype(" )
535
+ } ) {
536
+ warn ! ( "Item contained `decltype`d type, skipping: \
537
+ {:?}, {:?}", item, inner_item) ;
538
+ return ;
539
+ }
540
+ }
541
+
518
542
let rust_name = ctx. rust_ident ( & name) ;
519
543
let mut typedef = aster:: AstBuilder :: new ( ) . item ( ) . pub_ ( ) ;
520
544
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