Skip to content

Commit 0630f46

Browse files
committed
ir: References have no implicit template parameters.
Fixes rust-lang#1113.
1 parent a57d880 commit 0630f46

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

src/codegen/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ impl AppendImplicitTemplateParams for quote::Tokens {
268268
TypeKind::Void |
269269
TypeKind::NullPtr |
270270
TypeKind::Pointer(..) |
271+
TypeKind::Reference(..) |
271272
TypeKind::Int(..) |
272273
TypeKind::Float(..) |
273274
TypeKind::Complex(..) |
@@ -280,7 +281,6 @@ impl AppendImplicitTemplateParams for quote::Tokens {
280281
TypeKind::ObjCId |
281282
TypeKind::ObjCSel |
282283
TypeKind::TemplateInstantiation(..) => return,
283-
284284
_ => {},
285285
}
286286

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
5+
6+
7+
#[repr(C)]
8+
#[derive(Debug, Copy, Clone)]
9+
pub struct Entry<K, V> {
10+
pub _base: K,
11+
pub mData: V,
12+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<K>>,
13+
pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>,
14+
}
15+
impl<K, V> Default for Entry<K, V> {
16+
fn default() -> Self {
17+
unsafe { ::std::mem::zeroed() }
18+
}
19+
}
20+
#[repr(C)]
21+
#[derive(Debug, Default, Copy, Clone)]
22+
pub struct nsBaseHashtable {
23+
pub _address: u8,
24+
}
25+
pub type nsBaseHashtable_EntryType<K, V> = Entry<K, V>;
26+
#[repr(C)]
27+
#[derive(Debug, Copy, Clone)]
28+
pub struct nsBaseHashtable_EntryPtr<K, V> {
29+
pub mEntry: *mut nsBaseHashtable_EntryType<K, V>,
30+
pub mExistingEntry: bool,
31+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<K>>,
32+
pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>,
33+
}
34+
impl<K, V> Default for nsBaseHashtable_EntryPtr<K, V> {
35+
fn default() -> Self {
36+
unsafe { ::std::mem::zeroed() }
37+
}
38+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
template<class K, class V>
2+
class Entry : public K
3+
{
4+
V mData;
5+
};
6+
7+
template<typename K, typename V>
8+
class nsBaseHashtable {
9+
typedef Entry<K, V> EntryType;
10+
11+
struct EntryPtr {
12+
private:
13+
EntryType& mEntry;
14+
bool mExistingEntry;
15+
};
16+
};

0 commit comments

Comments
 (0)