Prepare for rust stable 1.60 (#11138)

* Prepare for rust stable 1.59

Besides preparing the UI tests this also adds a new script update-rust-stable.sh script for
simplifying the update of a rust stable version. This script will run all UI tests for the new
rust stable version and updating the expected output.

* Ensure we run the UI tests in CI

* use staging ci image

* More test updates

* Unignore test (#11097)

* empty commit for pipeline rerun

* empty commit for pipeline rerun

* Try to make clippy happy

* More clippy fixes

* FMT

* ci image production

Co-authored-by: alvicsam <alvicsam@gmail.com>
Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>
This commit is contained in:
Bastian Köcher
2022-04-11 11:21:54 +02:00
committed by GitHub
parent d20a10dee3
commit f517e57f67
36 changed files with 330 additions and 369 deletions
+2
View File
@@ -381,6 +381,8 @@ test-linux-stable: &test-linux
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
RUST_BACKTRACE: 1
WASM_BUILD_NO_COLOR: 1
# Ensure we run the UI tests.
RUN_UI_TESTS: 1
script:
# this job runs all tests in former runtime-benchmarks, frame-staking and wasmtime tests
- time cargo test --workspace --locked --release --verbose --features runtime-benchmarks --manifest-path ./bin/node/cli/Cargo.toml
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
#
# Script for updating the UI tests for a new rust stable version.
#
# It needs to be called like this:
#
# update-rust-stable.sh 1.61
#
# This will run all UI tests with the rust stable 1.61. The script
# requires that rustup is installed.
set -e
if [ "$#" -ne 1 ]; then
echo "Please specify the rust version to use. E.g. update-rust-stable.sh 1.61"
exit
fi
RUST_VERSION=$1
if ! command -v rustup &> /dev/null
then
echo "rustup needs to be installed"
exit
fi
rustup install $RUST_VERSION
rustup component add rust-src --toolchain $RUST_VERSION
# Ensure we run the ui tests
export RUN_UI_TESTS=1
# We don't need any wasm files for ui tests
export SKIP_WASM_BUILD=1
# Let trybuild overwrite the .stderr files
export TRYBUILD=overwrite
# Run all the relevant UI tests
#
# Any new UI tests in different crates need to be added here as well.
rustup run $RUST_VERSION cargo test -p sp-runtime-interface ui
rustup run $RUST_VERSION cargo test -p sp-api-test ui
rustup run $RUST_VERSION cargo test -p frame-election-provider-solution-type ui
rustup run $RUST_VERSION cargo test -p frame-support-test ui
@@ -126,7 +126,7 @@ fn create_account_extrinsics(
accounts
.iter()
.enumerate()
.map(|(i, a)| {
.flat_map(|(i, a)| {
vec![
// Reset the nonce by removing any funds
create_extrinsic(
@@ -162,7 +162,6 @@ fn create_account_extrinsics(
),
]
})
.flatten()
.map(OpaqueExtrinsic::from)
.collect()
}
@@ -174,7 +173,7 @@ fn create_benchmark_extrinsics(
) -> Vec<OpaqueExtrinsic> {
accounts
.iter()
.map(|account| {
.flat_map(|account| {
(0..extrinsics_per_account).map(move |nonce| {
create_extrinsic(
client,
@@ -187,7 +186,6 @@ fn create_benchmark_extrinsics(
)
})
})
.flatten()
.map(OpaqueExtrinsic::from)
.collect()
}
+1 -1
View File
@@ -572,7 +572,7 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkWorker<B, H> {
.collect();
let endpoint = if let Some(e) =
swarm.behaviour_mut().node(peer_id).map(|i| i.endpoint()).flatten()
swarm.behaviour_mut().node(peer_id).and_then(|i| i.endpoint())
{
e.clone().into()
} else {
+2 -2
View File
@@ -74,11 +74,11 @@ where
H: ExHashT,
{
fn set_authorized_peers(&self, peers: HashSet<PeerId>) {
self.set_authorized_peers(peers)
NetworkService::set_authorized_peers(self, peers)
}
fn set_authorized_only(&self, reserved_only: bool) {
self.set_authorized_only(reserved_only)
NetworkService::set_authorized_only(self, reserved_only)
}
}
@@ -91,28 +91,26 @@ where
B: backend::Backend<Block>,
{
let spec = CallExecutor::runtime_version(self, id)?;
let code = if let Some(d) = self
.wasm_override
.as_ref()
.as_ref()
.map(|o| o.get(&spec.spec_version, onchain_code.heap_pages, &spec.spec_name))
.flatten()
{
log::debug!(target: "wasm_overrides", "using WASM override for block {}", id);
d
} else if let Some(s) =
self.wasm_substitutes.get(spec.spec_version, onchain_code.heap_pages, id)
{
log::debug!(target: "wasm_substitutes", "Using WASM substitute for block {:?}", id);
s
} else {
log::debug!(
target: "wasm_overrides",
"No WASM override available for block {}, using onchain code",
id
);
onchain_code
};
let code =
if let Some(d) =
self.wasm_override.as_ref().as_ref().and_then(|o| {
o.get(&spec.spec_version, onchain_code.heap_pages, &spec.spec_name)
}) {
log::debug!(target: "wasm_overrides", "using WASM override for block {}", id);
d
} else if let Some(s) =
self.wasm_substitutes.get(spec.spec_version, onchain_code.heap_pages, id)
{
log::debug!(target: "wasm_substitutes", "Using WASM substitute for block {:?}", id);
s
} else {
log::debug!(
target: "wasm_overrides",
"No WASM override available for block {}, using onchain code",
id
);
onchain_code
};
Ok(code)
}
@@ -186,7 +186,7 @@ impl WasmOverride {
for entry in fs::read_dir(dir).map_err(handle_err)? {
let entry = entry.map_err(handle_err)?;
let path = entry.path();
match path.extension().map(|e| e.to_str()).flatten() {
match path.extension().and_then(|e| e.to_str()) {
Some("wasm") => {
let code = fs::read(&path).map_err(handle_err)?;
let code_hash = make_hash(&code);
+8
View File
@@ -111,6 +111,14 @@ Please label issues with the following labels:
Declaring formal releases remains the prerogative of the project maintainer(s).
== UI tests
UI tests are used for macros to ensure that the output of a macro doesn't change and is in the expected format. These UI tests are sensible to any changes
in the macro generated code or to switching the rust stable version. The tests are only run when the `RUN_UI_TESTS` environment variable is set. So, when
the CI is for example complaining about failing UI tests and it is expected that they fail these tests need to be executed locally. To simplify the updating
of the UI test ouput there is the `.maintain/update-rust-stable.sh` script. This can be run with `.maintain/update-rust-stable.sh CURRENT_STABLE_VERSION`
and then it will run all UI tests to update the expected output.
== Changes to this arrangement
This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change.
@@ -265,6 +265,11 @@ fn imports() -> Result<TokenStream2> {
mod tests {
#[test]
fn ui_fail() {
// Only run the ui tests when `RUN_UI_TESTS` is set.
if std::env::var("RUN_UI_TESTS").is_err() {
return
}
let cases = trybuild::TestCases::new();
cases.compile_fail("tests/ui/fail/*.rs");
}
@@ -21,6 +21,11 @@ use std::env;
#[cfg(not(feature = "disable-ui-tests"))]
#[test]
fn ui() {
// Only run the ui tests when `RUN_UI_TESTS` is set.
if env::var("RUN_UI_TESTS").is_err() {
return
}
// As trybuild is using `cargo check`, we don't need the real WASM binaries.
env::set_var("SKIP_WASM_BUILD", "1");
@@ -31,21 +31,16 @@ help: consider importing this struct
|
error[E0283]: type annotations needed
--> tests/construct_runtime_ui/no_std_genesis_config.rs:40:1
|
40 | / construct_runtime! {
41 | | pub enum Runtime where
42 | | Block = Block,
43 | | NodeBlock = Block,
... |
48 | | }
49 | | }
| |_^ cannot infer type
|
= note: cannot satisfy `_: std::default::Default`
note: required by `std::default::Default::default`
--> $RUST/core/src/default.rs
|
| fn default() -> Self;
| ^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
--> tests/construct_runtime_ui/no_std_genesis_config.rs:40:1
|
40 | / construct_runtime! {
41 | | pub enum Runtime where
42 | | Block = Block,
43 | | NodeBlock = Block,
... |
48 | | }
49 | | }
| |_^ cannot infer type
|
= note: cannot satisfy `_: std::default::Default`
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -34,21 +34,16 @@ help: consider importing this struct
|
error[E0283]: type annotations needed
--> tests/construct_runtime_ui/undefined_genesis_config_part.rs:49:1
|
49 | / construct_runtime! {
50 | | pub enum Runtime where
51 | | Block = Block,
52 | | NodeBlock = Block,
... |
57 | | }
58 | | }
| |_^ cannot infer type
|
= note: cannot satisfy `_: std::default::Default`
note: required by `std::default::Default::default`
--> $RUST/core/src/default.rs
|
| fn default() -> Self;
| ^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
--> tests/construct_runtime_ui/undefined_genesis_config_part.rs:49:1
|
49 | / construct_runtime! {
50 | | pub enum Runtime where
51 | | Block = Block,
52 | | NodeBlock = Block,
... |
57 | | }
58 | | }
| |_^ cannot infer type
|
= note: cannot satisfy `_: std::default::Default`
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -19,6 +19,11 @@
#[cfg(not(feature = "disable-ui-tests"))]
#[test]
fn decl_module_ui() {
// Only run the ui tests when `RUN_UI_TESTS` is set.
if std::env::var("RUN_UI_TESTS").is_err() {
return
}
// As trybuild is using `cargo check`, we don't need the real WASM binaries.
std::env::set_var("SKIP_WASM_BUILD", "1");
@@ -19,6 +19,11 @@
#[cfg(not(feature = "disable-ui-tests"))]
#[test]
fn decl_storage_ui() {
// Only run the ui tests when `RUN_UI_TESTS` is set.
if std::env::var("RUN_UI_TESTS").is_err() {
return
}
// As trybuild is using `cargo check`, we don't need the real WASM binaries.
std::env::set_var("SKIP_WASM_BUILD", "1");
@@ -19,6 +19,11 @@
#[cfg(not(feature = "disable-ui-tests"))]
#[test]
fn derive_no_bound_ui() {
// Only run the ui tests when `RUN_UI_TESTS` is set.
if std::env::var("RUN_UI_TESTS").is_err() {
return
}
// As trybuild is using `cargo check`, we don't need the real WASM binaries.
std::env::set_var("SKIP_WASM_BUILD", "1");
@@ -1,11 +1,5 @@
error[E0277]: the trait bound `<T as Config>::C: Clone` is not satisfied
--> tests/derive_no_bound_ui/clone.rs:7:2
|
7 | c: T::C,
| ^ the trait `Clone` is not implemented for `<T as Config>::C`
|
note: required by `clone`
--> $RUST/core/src/clone.rs
|
| fn clone(&self) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/derive_no_bound_ui/clone.rs:7:2
|
7 | c: T::C,
| ^ the trait `Clone` is not implemented for `<T as Config>::C`
@@ -1,11 +1,5 @@
error[E0277]: the trait bound `<T as Config>::C: std::default::Default` is not satisfied
--> $DIR/default.rs:7:2
|
7 | c: T::C,
| ^ the trait `std::default::Default` is not implemented for `<T as Config>::C`
|
note: required by `std::default::Default::default`
--> $DIR/default.rs:116:5
|
116 | fn default() -> Self;
| ^^^^^^^^^^^^^^^^^^^^^
--> tests/derive_no_bound_ui/default.rs:7:2
|
7 | c: T::C,
| ^ the trait `std::default::Default` is not implemented for `<T as Config>::C`
@@ -19,6 +19,11 @@
#[cfg(not(feature = "disable-ui-tests"))]
#[test]
fn pallet_ui() {
// Only run the ui tests when `RUN_UI_TESTS` is set.
if std::env::var("RUN_UI_TESTS").is_err() {
return
}
// As trybuild is using `cargo check`, we don't need the real WASM binaries.
std::env::set_var("SKIP_WASM_BUILD", "1");
@@ -9,16 +9,10 @@ error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
= note: required for the cast to the object type `dyn std::fmt::Debug`
error[E0277]: the trait bound `<T as pallet::Config>::Bar: Clone` is not satisfied
--> tests/pallet_ui/call_argument_invalid_bound.rs:20:36
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^^^ the trait `Clone` is not implemented for `<T as pallet::Config>::Bar`
|
note: required by `clone`
--> $RUST/core/src/clone.rs
|
| fn clone(&self) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/call_argument_invalid_bound.rs:20:36
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^^^ the trait `Clone` is not implemented for `<T as pallet::Config>::Bar`
error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Config>::Bar`
--> tests/pallet_ui/call_argument_invalid_bound.rs:20:36
@@ -9,16 +9,10 @@ error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
= note: required for the cast to the object type `dyn std::fmt::Debug`
error[E0277]: the trait bound `<T as pallet::Config>::Bar: Clone` is not satisfied
--> tests/pallet_ui/call_argument_invalid_bound_2.rs:20:36
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^^^ the trait `Clone` is not implemented for `<T as pallet::Config>::Bar`
|
note: required by `clone`
--> $RUST/core/src/clone.rs
|
| fn clone(&self) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/call_argument_invalid_bound_2.rs:20:36
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^^^ the trait `Clone` is not implemented for `<T as pallet::Config>::Bar`
error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Config>::Bar`
--> tests/pallet_ui/call_argument_invalid_bound_2.rs:20:36
@@ -32,38 +26,26 @@ help: consider further restricting this bound
| +++++++++++++++++++++
error[E0277]: the trait bound `<T as pallet::Config>::Bar: WrapperTypeEncode` is not satisfied
--> tests/pallet_ui/call_argument_invalid_bound_2.rs:1:1
|
1 | #[frame_support::pallet]
| ^-----------------------
| |
| _in this procedural macro expansion
| |
2 | | mod pallet {
3 | | use frame_support::pallet_prelude::{Hooks, DispatchResultWithPostInfo};
4 | | use frame_system::pallet_prelude::{BlockNumberFor, OriginFor};
... |
16 | |
17 | | #[pallet::call]
| |__________________^ the trait `WrapperTypeEncode` is not implemented for `<T as pallet::Config>::Bar`
|
= note: required because of the requirements on the impl of `Encode` for `<T as pallet::Config>::Bar`
note: required by a bound in `encode_to`
--> $CARGO/parity-scale-codec-3.0.0/src/codec.rs
|
| fn encode_to<T: Output + ?Sized>(&self, dest: &mut T) {
| ^^^^^^ required by this bound in `encode_to`
= note: this error originates in the derive macro `frame_support::codec::Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
--> tests/pallet_ui/call_argument_invalid_bound_2.rs:20:36
|
1 | / #[frame_support::pallet]
2 | | mod pallet {
3 | | use frame_support::pallet_prelude::{Hooks, DispatchResultWithPostInfo};
4 | | use frame_system::pallet_prelude::{BlockNumberFor, OriginFor};
... |
16 | |
17 | | #[pallet::call]
| |__________________- required by a bound introduced by this call
...
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^^^ the trait `WrapperTypeEncode` is not implemented for `<T as pallet::Config>::Bar`
|
= note: required because of the requirements on the impl of `Encode` for `<T as pallet::Config>::Bar`
error[E0277]: the trait bound `<T as pallet::Config>::Bar: WrapperTypeDecode` is not satisfied
--> tests/pallet_ui/call_argument_invalid_bound_2.rs:17:12
|
17 | #[pallet::call]
| ^^^^ the trait `WrapperTypeDecode` is not implemented for `<T as pallet::Config>::Bar`
|
= note: required because of the requirements on the impl of `Decode` for `<T as pallet::Config>::Bar`
note: required by a bound in `parity_scale_codec::Decode::decode`
--> $CARGO/parity-scale-codec-3.0.0/src/codec.rs
|
| fn decode<I: Input>(input: &mut I) -> Result<Self, Error>;
| ^^^^^ required by this bound in `parity_scale_codec::Decode::decode`
--> tests/pallet_ui/call_argument_invalid_bound_2.rs:17:12
|
17 | #[pallet::call]
| ^^^^ the trait `WrapperTypeDecode` is not implemented for `<T as pallet::Config>::Bar`
|
= note: required because of the requirements on the impl of `Decode` for `<T as pallet::Config>::Bar`
@@ -1,12 +1,7 @@
error[E0277]: the trait bound `MyError: PalletError` is not satisfied
--> tests/pallet_ui/error_does_not_derive_pallet_error.rs:1:1
|
1 | #[frame_support::pallet]
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PalletError` is not implemented for `MyError`
|
note: required by `MAX_ENCODED_SIZE`
--> $WORKSPACE/frame/support/src/traits/error.rs
|
| const MAX_ENCODED_SIZE: usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `frame_support::PalletError` (in Nightly builds, run with -Z macro-backtrace for more info)
--> tests/pallet_ui/error_does_not_derive_pallet_error.rs:1:1
|
1 | #[frame_support::pallet]
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PalletError` is not implemented for `MyError`
|
= note: this error originates in the derive macro `frame_support::PalletError` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,14 +1,8 @@
error[E0277]: the trait bound `<T as pallet::Config>::Bar: Clone` is not satisfied
--> tests/pallet_ui/event_field_not_member.rs:23:7
|
23 | B { b: T::Bar },
| ^ the trait `Clone` is not implemented for `<T as pallet::Config>::Bar`
|
note: required by `clone`
--> $RUST/core/src/clone.rs
|
| fn clone(&self) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/event_field_not_member.rs:23:7
|
23 | B { b: T::Bar },
| ^ the trait `Clone` is not implemented for `<T as pallet::Config>::Bar`
error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Config>::Bar`
--> tests/pallet_ui/event_field_not_member.rs:23:7
@@ -7,11 +7,6 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:10:12
@@ -22,11 +17,6 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:10:12
@@ -38,68 +28,43 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: TypeInfo` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `TypeInfo` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `StaticTypeInfo` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `TypeInfo` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `StaticTypeInfo` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Encode` for `Bar`
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Encode` for `Bar`
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -7,11 +7,6 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:10:12
@@ -22,11 +17,6 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:10:12
@@ -38,68 +28,43 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: TypeInfo` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `TypeInfo` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `StaticTypeInfo` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `TypeInfo` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `StaticTypeInfo` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Encode` for `Bar`
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Encode` for `Bar`
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -1,12 +1,7 @@
error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied
--> tests/pallet_ui/storage_info_unsatisfied.rs:9:12
|
9 | #[pallet::pallet]
| ^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `storage_info`
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
| fn storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> tests/pallet_ui/storage_info_unsatisfied.rs:9:12
|
9 | #[pallet::pallet]
| ^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -6,8 +6,3 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied
|
= note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `Key<frame_support::Twox64Concat, Bar>`
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo<T>, Key<frame_support::Twox64Concat, Bar>, u32>`
note: required by `storage_info`
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
| fn storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -20,6 +20,11 @@ use std::env;
#[rustversion::attr(not(stable), ignore)]
#[test]
fn ui() {
// Only run the ui tests when `RUN_UI_TESTS` is set.
if env::var("RUN_UI_TESTS").is_err() {
return
}
// As trybuild is using `cargo check`, we don't need the real WASM binaries.
env::set_var("SKIP_WASM_BUILD", "1");
@@ -1,6 +1,6 @@
error: There is no 'default' method with this name (without `changed_in` attribute).
The 'default' method is used to call into the latest implementation.
--> $DIR/changed_in_no_default_method.rs:15:6
The 'default' method is used to call into the latest implementation.
--> tests/ui/changed_in_no_default_method.rs:15:6
|
15 | fn test(data: u64);
| ^^^^
@@ -1,28 +1,23 @@
error[E0053]: method `test` has an incompatible type for trait
--> $DIR/impl_incorrect_method_signature.rs:19:17
--> tests/ui/impl_incorrect_method_signature.rs:19:17
|
13 | fn test(data: u64);
| --- type in trait
...
19 | fn test(data: String) {}
| ^^^^^^
| |
| expected `u64`, found struct `std::string::String`
| help: change the parameter type to match the trait: `u64`
|
note: type in trait
--> tests/ui/impl_incorrect_method_signature.rs:13:17
|
13 | fn test(data: u64);
| ^^^
= note: expected fn pointer `fn(u64)`
found fn pointer `fn(std::string::String)`
error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for trait
--> $DIR/impl_incorrect_method_signature.rs:17:1
--> tests/ui/impl_incorrect_method_signature.rs:17:1
|
11 | / sp_api::decl_runtime_apis! {
12 | | pub trait Api {
13 | | fn test(data: u64);
14 | | }
15 | | }
| |_- type in trait
16 |
17 | sp_api::impl_runtime_apis! {
| -^^^^^^^^^^^^^^^^^^^^^^^^^
| |
@@ -36,12 +31,21 @@ error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for tr
33 | | }
| |_- help: change the parameter type to match the trait: `std::option::Option<u64>`
|
note: type in trait
--> tests/ui/impl_incorrect_method_signature.rs:11:1
|
11 | / sp_api::decl_runtime_apis! {
12 | | pub trait Api {
13 | | fn test(data: u64);
14 | | }
15 | | }
| |_^
= note: expected fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &BlockId<__SR_API_BLOCK__>, ExecutionContext, std::option::Option<u64>, Vec<_>) -> Result<_, _>`
found fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &BlockId<__SR_API_BLOCK__>, ExecutionContext, std::option::Option<std::string::String>, Vec<_>) -> Result<_, _>`
= note: this error originates in the macro `sp_api::impl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/impl_incorrect_method_signature.rs:17:1
--> tests/ui/impl_incorrect_method_signature.rs:17:1
|
17 | / sp_api::impl_runtime_apis! {
18 | | impl self::Api<Block> for Runtime {
@@ -55,7 +59,7 @@ error[E0308]: mismatched types
= note: this error originates in the macro `sp_api::impl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/impl_incorrect_method_signature.rs:19:11
--> tests/ui/impl_incorrect_method_signature.rs:19:11
|
19 | fn test(data: String) {}
| ^^^^ expected `u64`, found struct `std::string::String`
@@ -1,26 +1,18 @@
error: Only `&self` is supported!
--> $DIR/mock_only_self_reference.rs:14:11
--> tests/ui/mock_only_self_reference.rs:14:11
|
14 | fn test(self, data: u64) {}
| ^^^^
error: Only `&self` is supported!
--> $DIR/mock_only_self_reference.rs:16:12
--> tests/ui/mock_only_self_reference.rs:16:12
|
16 | fn test2(&mut self, data: u64) {}
| ^
error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for trait
--> $DIR/mock_only_self_reference.rs:12:1
--> tests/ui/mock_only_self_reference.rs:12:1
|
3 | / sp_api::decl_runtime_apis! {
4 | | pub trait Api {
5 | | fn test(data: u64);
6 | | fn test2(data: u64);
7 | | }
8 | | }
| |_- type in trait
...
12 | sp_api::mock_impl_runtime_apis! {
| -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
@@ -34,21 +26,23 @@ error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for tr
18 | | }
| |_- help: change the parameter type to match the trait: `Option<u64>`
|
note: type in trait
--> tests/ui/mock_only_self_reference.rs:3:1
|
3 | / sp_api::decl_runtime_apis! {
4 | | pub trait Api {
5 | | fn test(data: u64);
6 | | fn test2(data: u64);
7 | | }
8 | | }
| |_^
= note: expected fn pointer `fn(&MockApi, &BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, Extrinsic>>, ExecutionContext, Option<u64>, Vec<_>) -> Result<_, _>`
found fn pointer `fn(&MockApi, &BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, Extrinsic>>, ExecutionContext, Option<()>, Vec<_>) -> Result<_, _>`
= note: this error originates in the macro `sp_api::mock_impl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0053]: method `Api_test2_runtime_api_impl` has an incompatible type for trait
--> $DIR/mock_only_self_reference.rs:12:1
--> tests/ui/mock_only_self_reference.rs:12:1
|
3 | / sp_api::decl_runtime_apis! {
4 | | pub trait Api {
5 | | fn test(data: u64);
6 | | fn test2(data: u64);
7 | | }
8 | | }
| |_- type in trait
...
12 | sp_api::mock_impl_runtime_apis! {
| -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
@@ -62,6 +56,16 @@ error[E0053]: method `Api_test2_runtime_api_impl` has an incompatible type for t
18 | | }
| |_- help: change the parameter type to match the trait: `Option<u64>`
|
note: type in trait
--> tests/ui/mock_only_self_reference.rs:3:1
|
3 | / sp_api::decl_runtime_apis! {
4 | | pub trait Api {
5 | | fn test(data: u64);
6 | | fn test2(data: u64);
7 | | }
8 | | }
| |_^
= note: expected fn pointer `fn(&MockApi, &BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, Extrinsic>>, ExecutionContext, Option<u64>, Vec<_>) -> Result<_, _>`
found fn pointer `fn(&MockApi, &BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, Extrinsic>>, ExecutionContext, Option<()>, Vec<_>) -> Result<_, _>`
= note: this error originates in the macro `sp_api::mock_impl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,28 +1,23 @@
error[E0053]: method `test` has an incompatible type for trait
--> $DIR/type_reference_in_impl_runtime_apis_call.rs:19:17
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:19:17
|
13 | fn test(data: u64);
| --- type in trait
...
19 | fn test(data: &u64) {
| ^^^^
| |
| expected `u64`, found `&u64`
| help: change the parameter type to match the trait: `u64`
|
note: type in trait
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:13:17
|
13 | fn test(data: u64);
| ^^^
= note: expected fn pointer `fn(u64)`
found fn pointer `fn(&u64)`
error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for trait
--> $DIR/type_reference_in_impl_runtime_apis_call.rs:17:1
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:17:1
|
11 | / sp_api::decl_runtime_apis! {
12 | | pub trait Api {
13 | | fn test(data: u64);
14 | | }
15 | | }
| |_- type in trait
16 |
17 | sp_api::impl_runtime_apis! {
| -^^^^^^^^^^^^^^^^^^^^^^^^^
| |
@@ -36,12 +31,21 @@ error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for tr
35 | | }
| |_- help: change the parameter type to match the trait: `std::option::Option<u64>`
|
note: type in trait
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:11:1
|
11 | / sp_api::decl_runtime_apis! {
12 | | pub trait Api {
13 | | fn test(data: u64);
14 | | }
15 | | }
| |_^
= note: expected fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &BlockId<__SR_API_BLOCK__>, ExecutionContext, std::option::Option<u64>, Vec<_>) -> Result<_, _>`
found fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &BlockId<__SR_API_BLOCK__>, ExecutionContext, std::option::Option<&u64>, Vec<_>) -> Result<_, _>`
= note: this error originates in the macro `sp_api::impl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/type_reference_in_impl_runtime_apis_call.rs:17:1
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:17:1
|
17 | / sp_api::impl_runtime_apis! {
18 | | impl self::Api<Block> for Runtime {
@@ -55,7 +59,7 @@ error[E0308]: mismatched types
= note: this error originates in the macro `sp_api::impl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/type_reference_in_impl_runtime_apis_call.rs:19:11
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:19:11
|
19 | fn test(data: &u64) {
| ^^^^^^^ expected `u64`, found `&u64`
@@ -20,6 +20,11 @@ use std::env;
#[rustversion::attr(not(stable), ignore)]
#[test]
fn ui() {
// Only run the ui tests when `RUN_UI_TESTS` is set.
if env::var("RUN_UI_TESTS").is_err() {
return
}
// As trybuild is using `cargo check`, we don't need the real WASM binaries.
env::set_var("SKIP_WASM_BUILD", "1");
@@ -59,7 +59,7 @@ where
) {
let (top, child) = changes.into_iter().partition::<Vec<_>, _>(|v| v.0.is_none());
let (root, transaction) = self.full_storage_root(
top.iter().map(|(_, v)| v).flatten().map(|(k, v)| (&k[..], v.as_deref())),
top.iter().flat_map(|(_, v)| v).map(|(k, v)| (&k[..], v.as_deref())),
child.iter().filter_map(|v| {
v.0.as_ref().map(|c| (c, v.1.iter().map(|(k, v)| (&k[..], v.as_deref()))))
}),
@@ -580,16 +580,15 @@ impl<'a, S: 'a + TrieBackendStorage<H>, H: Hasher> hash_db::HashDB<H, DBValue>
for Ephemeral<'a, S, H>
{
fn get(&self, key: &H::Out, prefix: Prefix) -> Option<DBValue> {
if let Some(val) = HashDB::get(self.overlay, key, prefix) {
Some(val)
} else {
match self.storage.get(&key, prefix) {
match HashDB::get(self.overlay, key, prefix) {
Some(val) => Some(val),
None => match self.storage.get(&key, prefix) {
Ok(x) => x,
Err(e) => {
warn!(target: "trie", "Failed to read from DB: {}", e);
None
},
}
},
}
}
+1 -2
View File
@@ -44,8 +44,7 @@ pub fn embed_runtime_version(
.apis
.iter()
.map(Encode::encode)
.map(|v| v.into_iter())
.flatten()
.flat_map(|v| v.into_iter())
.collect::<Vec<u8>>();
module.set_custom_section("runtime_apis", apis);
@@ -848,7 +848,7 @@ impl<B: BlockT + DeserializeOwned> Builder<B> {
info!(
target: LOG_TARGET,
"injecting a total of {} child keys",
child_kv.iter().map(|(_, kv)| kv).flatten().count()
child_kv.iter().flat_map(|(_, kv)| kv).count(),
);
for (info, key_values) in child_kv {