Open
Description
Code
macro_rules! delegate {
($method:ident) => {
<Self>::$method(8)
}
}
struct Bar;
impl Bar {
fn foo(a: u8, b: u8) {
}
fn bar() {
delegate!(foo);
}
}
Current output
error[E0061]: this function takes 2 arguments but 1 argument was supplied
--> src/main.rs:3:9
|
3 | <Self>::$method(8)
| ^^^^^^^^^^^^^^^--- argument #2 of type `u8` is missing
...
14 | delegate!(foo);
| -------------- in this macro invocation
|
note: associated function defined here
--> src/main.rs:10:8
|
10 | fn foo(a: u8, b: u8) {
| ^^^ -----
= note: this error originates in the macro `delegate` (in Nightly builds, run with -Z macro-backtrace for more info)
help: provide the argument
|
3 - <Self>::$method(8)
3 + <Self>::<Self>::$method(8, /* u8 */)
|
Desired output
Should not add the extra ::<Self>
in the suggestion.
Rationale and extra context
<Self>::<Self>
is not valid Rust :)
Other cases
Rust Version
1.88.0-nightly (2025-04-29 74509131e85a97353c67)