diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-10-28 07:13:49 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-28 07:13:49 -0500 |
commit | c7f0fab3782217610f44ae2f32526ab8c330e8b2 (patch) | |
tree | 5d3f3f06bbf89ca88a1293648f109c0e009aa3ee | |
parent | da2785dc1ee8745cc9d15c7c42666e0beb7c1817 (diff) | |
parent | 0630f467760671cdfa73c4f12422275280448312 (diff) |
Auto merge of #1114 - emilio:template-params-ref, r=pepyakin
ir: References have no implicit template parameters.
Fixes #1113.
-rw-r--r-- | src/codegen/mod.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/issue-1113-template-references.rs | 38 | ||||
-rw-r--r-- | tests/headers/issue-1113-template-references.hpp | 16 |
3 files changed, 55 insertions, 1 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 6c1ed02f..53ed24ff 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -268,6 +268,7 @@ impl AppendImplicitTemplateParams for quote::Tokens { TypeKind::Void | TypeKind::NullPtr | TypeKind::Pointer(..) | + TypeKind::Reference(..) | TypeKind::Int(..) | TypeKind::Float(..) | TypeKind::Complex(..) | @@ -280,7 +281,6 @@ impl AppendImplicitTemplateParams for quote::Tokens { TypeKind::ObjCId | TypeKind::ObjCSel | TypeKind::TemplateInstantiation(..) => return, - _ => {}, } diff --git a/tests/expectations/tests/issue-1113-template-references.rs b/tests/expectations/tests/issue-1113-template-references.rs new file mode 100644 index 00000000..3430f27d --- /dev/null +++ b/tests/expectations/tests/issue-1113-template-references.rs @@ -0,0 +1,38 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct Entry<K, V> { + pub _base: K, + pub mData: V, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<K>>, + pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>, +} +impl<K, V> Default for Entry<K, V> { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct nsBaseHashtable { + pub _address: u8, +} +pub type nsBaseHashtable_EntryType<K, V> = Entry<K, V>; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsBaseHashtable_EntryPtr<K, V> { + pub mEntry: *mut nsBaseHashtable_EntryType<K, V>, + pub mExistingEntry: bool, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<K>>, + pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>, +} +impl<K, V> Default for nsBaseHashtable_EntryPtr<K, V> { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} diff --git a/tests/headers/issue-1113-template-references.hpp b/tests/headers/issue-1113-template-references.hpp new file mode 100644 index 00000000..46339c5d --- /dev/null +++ b/tests/headers/issue-1113-template-references.hpp @@ -0,0 +1,16 @@ +template<class K, class V> +class Entry : public K +{ + V mData; +}; + +template<typename K, typename V> +class nsBaseHashtable { + typedef Entry<K, V> EntryType; + + struct EntryPtr { + private: + EntryType& mEntry; + bool mExistingEntry; + }; +}; |