-
Notifications
You must be signed in to change notification settings - Fork 707
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #1114 - emilio:template-params-ref, r=pepyakin
ir: References have no implicit template parameters. Fixes #1113.
- Loading branch information
Showing
3 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
tests/expectations/tests/issue-1113-template-references.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; | ||
}; |