-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
44 additions
and
44 deletions.
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
// bindgen-flags: --with-derive-hash --whitelist-type 'Whitelisted.*' --blacklist-type Blacklisted --raw-line "#[repr(C)] #[derive(Debug, Hash, Copy, Clone)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> }" | ||
// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --whitelist-type 'Whitelisted.*' --blacklist-type Blacklisted --raw-line "#[repr(C)] #[derive(Debug, Hash, Copy, Clone, PartialEq, Eq)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> }" | ||
// | ||
template<class T> | ||
template <class T> | ||
struct Blacklisted { | ||
T t; | ||
T t; | ||
}; | ||
|
||
/// This would derive(Hash) if it didn't contain a blacklisted type, | ||
/// causing us to conservatively avoid deriving hash for it. | ||
/// This would derive(Hash, Eq, PartialEq) if it didn't contain a blacklisted type, | ||
/// causing us to conservatively avoid deriving hash/Eq/PartialEq for it. | ||
struct WhitelistedOne { | ||
Blacklisted<int> a; | ||
Blacklisted<int> a; | ||
}; | ||
|
||
/// This can't derive(Hash) even if it didn't contain a blacklisted type. | ||
/// This can't derive(Hash/Eq) even if it didn't contain a blacklisted type. | ||
struct WhitelistedTwo { | ||
Blacklisted<float> b; | ||
Blacklisted<float> b; | ||
}; |
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// bindgen-flags: --with-derive-hash | ||
// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq | ||
// | ||
/// A struct containing an array of floats that cannot derive hash. | ||
/// A struct containing an array of floats that cannot derive hash/eq but can derive partialeq. | ||
struct foo { | ||
float bar[3]; | ||
}; |
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
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
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
// bindgen-flags: --with-derive-hash | ||
// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq | ||
// | ||
/// Template definition that doesn't contain float can derive hash | ||
template<typename T> | ||
/// Template definition that doesn't contain float can derive hash/partialeq/eq | ||
template <typename T> | ||
struct foo { | ||
T data; | ||
}; | ||
|
||
/// Can derive hash when instantiated with int | ||
/// Can derive hash/partialeq/eq when instantiated with int | ||
struct IntStr { | ||
foo<int> a; | ||
}; | ||
|
||
/// Cannot derive hash when instantiated with float | ||
/// Cannot derive hash/eq when instantiated with float but can derive partialeq | ||
struct FloatStr { | ||
foo<float> a; | ||
}; |