Skip to content
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

Add skip_type_params attribute #96

Merged
merged 51 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
39ee6b4
Add new top-level attribute `scale_info(bounds(T: SomeTrait + OtherTr…
dvdplm May 1, 2021
b0eda68
Fmt
ascjones May 4, 2021
bd6dd5d
cleanup
dvdplm May 6, 2021
171cd4c
Merge branch 'dp-custom-bound' of github.com:paritytech/scale-info in…
dvdplm May 6, 2021
030d407
Merge branch 'master' into dp-custom-bound
ascjones May 27, 2021
b937c9a
Skip type params prototype
ascjones May 28, 2021
725ceca
Merge branch 'master' into aj-skip-type-params
ascjones Jun 7, 2021
56edb9c
Fmt
ascjones Jun 7, 2021
f503781
Clippy
ascjones Jun 7, 2021
1743b48
Satisfy clippy
ascjones Jun 7, 2021
bf9cf6d
Fix skip type params
ascjones Jun 7, 2021
2d4f1e8
Fix UI test
ascjones Jun 7, 2021
9c4f6d6
Add some more tests
ascjones Jun 11, 2021
100dfcf
Add failing test for type params with default values
ascjones Jun 11, 2021
c92041b
Fix for type params with defaults, compare on ident
ascjones Jun 11, 2021
a23cd47
Merge branch 'master' into aj-skip-type-params
ascjones Jun 14, 2021
3678114
Merge branch 'master' into aj-skip-type-params
ascjones Jun 14, 2021
4cdf0c5
WIP use bounds attribute for skipping type params
ascjones Jun 14, 2021
99cb9d3
Add required 'static bounds to all type params
ascjones Jun 15, 2021
c39167d
Fmt
ascjones Jun 15, 2021
835efe3
Satisfy clippy
ascjones Jun 15, 2021
75d25ad
Add UI test for skipping bounds
ascjones Jun 15, 2021
3012932
WIP docs
ascjones Jun 15, 2021
20ff837
Revert "Use bounds attribute for skipping type params"
ascjones Jun 15, 2021
7cdd440
WIP dual attribute parsing
ascjones Jun 15, 2021
6d97c49
Use new attribute parsing
ascjones Jun 16, 2021
7cab3e3
Fix up attribute parsing
ascjones Jun 16, 2021
1f84f41
Fmt
ascjones Jun 16, 2021
0716333
Reorder impls
ascjones Jun 16, 2021
a2d239b
Refactor attribute handling
ascjones Jun 16, 2021
ecf21f3
Fmt
ascjones Jun 16, 2021
f876d22
Add docs to attributes
ascjones Jun 16, 2021
b58904f
Add `'static` bounds for all type params, add some ui tests
ascjones Jun 16, 2021
9f64f74
Merge remote-tracking branch 'origin/master' into aj-skip-type-params
ascjones Jun 16, 2021
d61f75d
Check for duplicate attributes
ascjones Jun 16, 2021
a1741d2
Add helpful error message for type params in not in cuatom bounds and…
ascjones Jun 16, 2021
2da8e3f
Improve error message where a type param is missing from the bounds, …
ascjones Jun 16, 2021
2dc9484
Fix test and fmt
ascjones Jun 16, 2021
39e40b1
Refactor and validate missing skip type params
ascjones Jun 17, 2021
44c2af2
Update validation UI test
ascjones Jun 17, 2021
91799c7
Error message formatting
ascjones Jun 17, 2021
e4d570d
Merge remote-tracking branch 'origin/master' into aj-skip-type-params
ascjones Jun 22, 2021
271c2b5
Fix compilation after merge
ascjones Jun 22, 2021
a7e1e6b
Merge remote-tracking branch 'origin/master' into aj-skip-type-params
ascjones Jun 23, 2021
411e50c
Add TypeParameter struct and optional type
ascjones Jun 24, 2021
c5f2bd1
Add ui test for skipping type params
ascjones Jun 25, 2021
d453e69
Add example to named_type_params macro
ascjones Jun 25, 2021
b228318
Type hint for named_type_params with MetaForm
ascjones Jun 25, 2021
f060e59
Add bounds attribute docs
ascjones Jun 25, 2021
7bfa773
Add some docs attribute usage
ascjones Jun 25, 2021
eb41e0b
Fmt
ascjones Jun 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update validation UI test
  • Loading branch information
ascjones committed Jun 17, 2021
commit 44c2af2b216ede68fb1663ce209388e3732e8696
6 changes: 3 additions & 3 deletions derive/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ impl Attributes {
.unwrap_or(false);
if !type_param_skipped {
let msg = format!(
"Type parameter requires a `TypeInfo` bound, so either: \
add it to `#[scale_info(bounds({}: TypeInfo))]`, \
or skip it with `#[scale_info(skip_type_params({}))]`",
"Type parameter requires a `TypeInfo` bound, so either: \n \
- add it to `#[scale_info(bounds({}: TypeInfo))]` \n \
- skip it with `#[scale_info(skip_type_params({}))]`",
type_param.ident, type_param.ident
);
return Err(syn::Error::new(type_param.span(), msg))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
error: Type parameter requires a `TypeInfo` bound, so either: add it to `#[scale_info(bounds(T: TypeInfo))]`, or skip it with `#[scale_info(skip_type_params(T))]`
error: Type parameter requires a `TypeInfo` bound, so either:
- add it to `#[scale_info(bounds(T: TypeInfo))]`
- skip it with `#[scale_info(skip_type_params(T))]`
--> $DIR/fail_custom_bounds_missing_skip_type_params.rs:6:10
|
6 | struct A<T> {
Expand Down