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
@@ -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);