Unverified Commit 6213b06b authored by Keith Yeung's avatar Keith Yeung Committed by GitHub
Browse files

Fix CI failures on master (#288)

* Update UI test error expectations

* Bump bitvec version to 0.22.3

* Run cargo update

* Fix compilation errors with bit_vec.rs

* Silence compilation warnings

* Update CHANGELOG.md

* Fix CHANGELOG.md

* Revert "Bump bitvec version to 0.22.3"

This reverts commit 0e3ea946.

* Revert "Fix compilation errors with bit_vec.rs"

This reverts commit 33a64124

.

* prevent false positive miri error

* Update CHANGELOG.md
Co-authored-by: thiolliere's avatarthiolliere <gui.thiolliere@gmail.com>
parent d889b625
Pipeline #156452 passed with stages
in 19 minutes and 37 seconds
......@@ -4,24 +4,13 @@ All notable changes to this crate are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this crate adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## [2.2.0-rc.3] - 2021-06-25
- Add support for custom where bounds `codec(mel_bound(T: MaxEncodedLen))` when deriving the traits. PR #279
## [2.2.0-rc.2] - 2021-06-24
- Updated syntax of `#[codec(crate = <path>)]` attribute macro: no longer expects the crate path to
be a string literal, but a path literal. This improves usability when used within other macros;
the external macro doesn't need to construct a string, but can simply do
`#[codec(crate = $crate::my_codec_reexport)]`.
## [2.2.0-rc.1] - 2021-06-22
## [2.2.0] - 2021-07-02
### Added
- Add support for custom where bounds `codec(mel_bound(T: MaxEncodedLen))` when deriving the traits. PR #279
- `MaxEncodedLen` trait for items that have a statically known maximum encoded size. ([#268](https://github.com/paritytech/parity-scale-codec/pull/268))
- `#[codec(crate = "<path>")]` top-level attribute to be used with the new `MaxEncodedLen`
- `#[codec(crate = <path>)]` top-level attribute to be used with the new `MaxEncodedLen`
trait, which allows to specify a different path to the crate that contains the `MaxEncodedLen` trait.
Useful when using generating a type through a macro and this type should implement `MaxEncodedLen` and the final crate doesn't have `parity-scale-codec` as dependency.
......
This diff is collapsed.
......@@ -19,11 +19,10 @@
use std::str::FromStr;
use proc_macro_crate::{crate_name, FoundCrate};
use proc_macro2::{Span, Ident, TokenStream};
use proc_macro2::TokenStream;
use quote::quote;
use syn::{
Attribute, Data, DeriveInput, Error, Field, Fields, FieldsNamed, FieldsUnnamed, Lit, Meta,
Attribute, Data, DeriveInput, Field, Fields, FieldsNamed, FieldsUnnamed, Lit, Meta,
MetaNameValue, NestedMeta, parse::Parse, Path, punctuated::Punctuated,
spanned::Spanned, token, Variant,
};
......@@ -122,7 +121,10 @@ pub fn has_dumb_trait_bound(attrs: &[Attribute]) -> bool {
}
/// Generate the crate access for the crate using 2018 syntax.
fn crate_access() -> syn::Result<Ident> {
#[cfg(feature = "max-encoded-len")]
fn crate_access() -> syn::Result<proc_macro2::Ident> {
use proc_macro_crate::{crate_name, FoundCrate};
use proc_macro2::{Span, Ident};
const DEF_CRATE: &str = "parity-scale-codec";
match crate_name(DEF_CRATE) {
Ok(FoundCrate::Itself) => {
......@@ -130,7 +132,7 @@ fn crate_access() -> syn::Result<Ident> {
Ok(syn::Ident::new(&name, Span::call_site()))
}
Ok(FoundCrate::Name(name)) => Ok(Ident::new(&name, Span::call_site())),
Err(e) => Err(Error::new(Span::call_site(), e)),
Err(e) => Err(syn::Error::new(Span::call_site(), e)),
}
}
......@@ -171,6 +173,7 @@ fn codec_crate_path_inner(attr: &Attribute) -> Option<Path> {
/// If not found, returns the default crate access pattern.
///
/// If multiple items match the pattern, all but the first are ignored.
#[cfg(feature = "max-encoded-len")]
pub fn codec_crate_path(attrs: &[Attribute]) -> syn::Result<Path> {
match attrs.iter().find_map(codec_crate_path_inner) {
Some(path) => Ok(path),
......@@ -224,6 +227,7 @@ pub fn custom_encode_trait_bound(attrs: &[Attribute]) -> Option<TraitBounds> {
/// Look for a `#[codec(mel_bound(T: MaxEncodedLen))]` in the given attributes.
///
/// If found, it should be used as the trait bounds when deriving the `MaxEncodedLen` trait.
#[cfg(feature = "max-encoded-len")]
pub fn custom_mel_trait_bound(attrs: &[Attribute]) -> Option<TraitBounds> {
find_meta_item(attrs.iter(), |meta: CustomTraitBound<mel_bound>| {
Some(meta.bounds)
......
......@@ -196,7 +196,7 @@ mod tests {
#[test]
fn bitvec_u64() {
for v in &test_data!(u64) {
let encoded = dbg!(v.encode());
let encoded = v.encode();
assert_eq!(*v, BitVec::<Msb0, u64>::decode(&mut &encoded[..]).unwrap());
}
}
......
......@@ -16,4 +16,4 @@ error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied
| ------ required by this bound in `MaxEncodedLen`
|
= note: required because of the requirements on the impl of `Encode` for `Example`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the derive macro `MaxEncodedLen` (in Nightly builds, run with -Z macro-backtrace for more info)
......@@ -16,4 +16,4 @@ error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied
| ------ required by this bound in `MaxEncodedLen`
|
= note: required because of the requirements on the impl of `Encode` for `Example`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the derive macro `MaxEncodedLen` (in Nightly builds, run with -Z macro-backtrace for more info)
......@@ -16,4 +16,4 @@ error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied
| ------ required by this bound in `MaxEncodedLen`
|
= note: required because of the requirements on the impl of `Encode` for `Example`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the derive macro `MaxEncodedLen` (in Nightly builds, run with -Z macro-backtrace for more info)
......@@ -10,4 +10,4 @@ error[E0277]: the trait bound `NotEncode: WrapperTypeEncode` is not satisfied
| ------ required by this bound in `MaxEncodedLen`
|
= note: required because of the requirements on the impl of `Encode` for `NotEncode`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the derive macro `MaxEncodedLen` (in Nightly builds, run with -Z macro-backtrace for more info)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment