Fix cycle dependency in sp-runtime-interface (#4353)

* Fix cycle dependency in `sp-runtime-interface`

* Fixes tests
This commit is contained in:
Bastian Köcher
2019-12-11 09:32:11 +01:00
committed by GitHub
parent 1ff41742bd
commit 6500b33df3
19 changed files with 218 additions and 224 deletions
@@ -0,0 +1,8 @@
use sp_runtime_interface::runtime_interface;
#[runtime_interface]
trait Test<T> {
fn test<R>() {}
}
fn main() {}
@@ -0,0 +1,11 @@
error: Generic parameters not supported.
--> $DIR/no_generic_parameters.rs:5:10
|
5 | fn test<R>() {}
| ^
error: Generic parameters not supported.
--> $DIR/no_generic_parameters.rs:4:12
|
4 | trait Test<T> {
| ^
@@ -0,0 +1,8 @@
use sp_runtime_interface::runtime_interface;
#[runtime_interface]
trait Test {
fn test();
}
fn main() {}
@@ -0,0 +1,5 @@
error: Methods need to have an implementation.
--> $DIR/no_method_implementation.rs:5:2
|
5 | fn test();
| ^^
@@ -0,0 +1,6 @@
use sp_runtime_interface::pass_by::PassByEnum;
#[derive(PassByEnum)]
struct Test;
fn main() {}
@@ -0,0 +1,5 @@
error: `PassByEnum` only supports enums as input type.
--> $DIR/pass_by_enum_with_struct.rs:3:10
|
3 | #[derive(PassByEnum)]
| ^^^^^^^^^^
@@ -0,0 +1,8 @@
use sp_runtime_interface::pass_by::PassByEnum;
#[derive(PassByEnum)]
enum Test {
Var0(u32),
}
fn main() {}
@@ -0,0 +1,5 @@
error: `PassByEnum` only supports unit variants.
--> $DIR/pass_by_enum_with_value_variant.rs:3:10
|
3 | #[derive(PassByEnum)]
| ^^^^^^^^^^
@@ -0,0 +1,9 @@
use sp_runtime_interface::pass_by::PassByInner;
#[derive(PassByInner)]
struct Test {
data: u32,
data2: u32,
}
fn main() {}
@@ -0,0 +1,5 @@
error: Only newtype/one field structs are supported by `PassByInner`!
--> $DIR/pass_by_inner_with_two_fields.rs:3:10
|
3 | #[derive(PassByInner)]
| ^^^^^^^^^^^
@@ -0,0 +1,8 @@
use sp_runtime_interface::runtime_interface;
#[runtime_interface]
trait Test {
fn test(self) {}
}
fn main() {}
@@ -0,0 +1,5 @@
error: Taking `Self` by value is not allowed.
--> $DIR/take_self_by_value.rs:5:10
|
5 | fn test(self) {}
| ^^^^