mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Make decl_runtime_apis! fail on methods with default implementation (#7371)
* Make `decl_runtime_apis!` fail on methods with default implementation Runtime api functions are not allowed to have default implementations. This fixes this by throwing an error when we detect such a function. * Update primitives/api/proc-macro/src/decl_runtime_apis.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Update primitives/api/test/tests/ui/no_default_implementation.stderr Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This commit is contained in:
@@ -912,6 +912,13 @@ impl CheckTraitDecl {
|
||||
.entry(method.sig.ident.clone())
|
||||
.or_default()
|
||||
.push(changed_in);
|
||||
|
||||
if method.default.is_some() {
|
||||
self.errors.push(Error::new(
|
||||
method.default.span(),
|
||||
"A runtime API function cannot have a default implementation!",
|
||||
));
|
||||
}
|
||||
});
|
||||
|
||||
method_to_signature_changed.into_iter().for_each(|(f, changed)| {
|
||||
|
||||
Reference in New Issue
Block a user