-
Notifications
You must be signed in to change notification settings - Fork 28
Trait bounds for generic compact types #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
31c7e1c
I don't even
dvdplm cc38dfe
Merge branch 'master' into dp-horrible-hackfix-dont-look-its-real-bad
dvdplm c2d565a
WIP
dvdplm c9acd50
WIP
dvdplm f9e9c74
Cleanup
dvdplm 2906f2e
Add trybuild files
dvdplm fcf59dd
Use fold
dvdplm 8354922
Tweak docs and cleanup
dvdplm 42d3fe0
Merge branch 'master' into dp-type-params-in-compact-fields
dvdplm fa0c5ac
Remove hashbrown dependency and make the derive crate std
dvdplm 1f10aa3
Merge branch 'master' into dp-type-params-in-compact-fields
dvdplm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,22 @@ | ||
| use scale_info::TypeInfo; | ||
| use scale::Encode; | ||
|
|
||
| #[derive(TypeInfo)] | ||
| struct Color<Hue>{hue: Hue} | ||
| #[derive(TypeInfo)] | ||
| struct Texture<Bump, Hump>{bump: Bump, hump: Hump} | ||
|
|
||
| #[allow(unused)] | ||
| #[derive(Encode, TypeInfo)] | ||
| struct Apple<T, U> { | ||
| #[codec(compact)] | ||
| one: Color<U>, // <– works with a "naked" generic, `U`, but not like this | ||
| two: Texture<T, U>, | ||
| } | ||
|
|
||
| fn assert_type_info<T: TypeInfo + 'static>() {} | ||
|
|
||
| fn main() { | ||
| // When this test fails it could mean that https://github.com/rust-lang/rust/issues/81785 is fixed | ||
| assert_type_info::<Apple<u8, u16>>(); | ||
| } |
This file contains hidden or 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,6 @@ | ||
| error[E0275]: overflow evaluating the requirement `_parity_scale_codec::Compact<_>: Decode` | ||
| | | ||
| = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`$CRATE`) | ||
| = note: required because of the requirements on the impl of `Decode` for `_parity_scale_codec::Compact<_>` | ||
| = note: 126 redundant requirements hidden | ||
| = note: required because of the requirements on the impl of `Decode` for `_parity_scale_codec::Compact<_>` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.