File tree 4 files changed +52
-5
lines changed
4 files changed +52
-5
lines changed Original file line number Diff line number Diff line change @@ -201,14 +201,14 @@ impl Cursor {
201
201
}
202
202
203
203
/// Is the referent a template specialization?
204
- pub fn is_template ( & self ) -> bool {
204
+ pub fn is_template_specialization ( & self ) -> bool {
205
205
self . specialized ( ) . is_some ( )
206
206
}
207
207
208
208
/// Is the referent a fully specialized template specialization without any
209
209
/// remaining free template arguments?
210
210
pub fn is_fully_specialized_template ( & self ) -> bool {
211
- self . is_template ( ) && self . num_template_args ( ) . unwrap_or ( 0 ) > 0
211
+ self . is_template_specialization ( ) && self . num_template_args ( ) . unwrap_or ( 0 ) > 0
212
212
}
213
213
214
214
/// Is the referent a template specialization that still has remaining free
@@ -217,9 +217,17 @@ impl Cursor {
217
217
if self . is_toplevel ( ) {
218
218
return false ;
219
219
}
220
+
220
221
let parent = self . semantic_parent ( ) ;
221
- ( parent. is_template ( ) && !parent. is_fully_specialized_template ( ) ) ||
222
- parent. is_in_non_fully_specialized_template ( )
222
+ if parent. is_fully_specialized_template ( ) {
223
+ return false ;
224
+ }
225
+
226
+ if !parent. is_template_like ( ) {
227
+ return parent. is_in_non_fully_specialized_template ( ) ;
228
+ }
229
+
230
+ return true ;
223
231
}
224
232
225
233
/// Is this cursor pointing a valid referent?
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ fn get_abi(cc: CXCallingConv) -> abi::Abi {
93
93
pub fn cursor_mangling ( cursor : & clang:: Cursor ) -> Option < String > {
94
94
// We early return here because libclang may crash in some case
95
95
// if we pass in a variable inside a partial specialized template.
96
- // See servo/rust-bindgen#67.
96
+ // See servo/rust-bindgen#67, and servo/rust-bindgen#462 .
97
97
if cursor. is_in_non_fully_specialized_template ( ) {
98
98
return None ;
99
99
}
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 Test < Args > {
10
+ pub _address : u8 ,
11
+ pub _phantom_0 : :: std:: marker:: PhantomData < Args > ,
12
+ }
13
+ #[ repr( C ) ]
14
+ #[ derive( Debug , Copy , Clone ) ]
15
+ pub struct Outer < T > {
16
+ pub _address : u8 ,
17
+ pub _phantom_0 : :: std:: marker:: PhantomData < T > ,
18
+ }
19
+ #[ repr( C ) ]
20
+ #[ derive( Debug , Copy , Clone ) ]
21
+ pub struct Outer_Inner < T > {
22
+ pub _address : u8 ,
23
+ pub _phantom_0 : :: std:: marker:: PhantomData < T > ,
24
+ }
Original file line number Diff line number Diff line change
1
+ // bindgen-flags: -- -std=c++11
2
+
3
+ // This test ensure we protect ourselves from an LLVM crash.
4
+
5
+ template <class ... Args>
6
+ struct Test {
7
+ static constexpr bool x[] = {Args::x...};
8
+ };
9
+
10
+ template <typename ... T>
11
+ struct Outer {
12
+ struct Inner {
13
+ static constexpr int value[] = { T::value... };
14
+ };
15
+ };
You can’t perform that action at this time.
0 commit comments