decl_runtime_apis! - check that a method without changed_in exists (#5635)

* `decl_runtime_apis!` - check that a method without `changed_in` exists

This adds another check to the macro that ensures that not only methods
with `changed_in` exists, but there are also the default methods exist.

* Update primitives/api/proc-macro/src/decl_runtime_apis.rs

Co-Authored-By: Nikolay Volf <nikvolf@gmail.com>

* Fix test

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
Bastian Köcher
2020-04-15 00:02:14 +02:00
committed by GitHub
parent 51f9bb3c0e
commit b267b1728f
4 changed files with 76 additions and 2 deletions
+3 -1
View File
@@ -113,7 +113,9 @@ use std::{panic::UnwindSafe, cell::RefCell};
/// change is highlighted with the `#[changed_in(2)]` attribute above a method. A method that is
/// tagged with this attribute is callable by the name `METHOD_before_version_VERSION`. This
/// method will only support calling into wasm, trying to call into native will fail (change the
/// spec version!). Such a method also does not need to be implemented in the runtime.
/// spec version!). Such a method also does not need to be implemented in the runtime. It is
/// required that there exist the "default" of the method without the `#[changed_in(_)]` attribute,
/// this method will be used to call the current default implementation.
///
/// ```rust
/// sp_api::decl_runtime_apis! {