Skip to content

Incorrect: mismatched-arg-count with RTIC #6684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
VersBinarii opened this issue Nov 30, 2020 · 4 comments
Closed

Incorrect: mismatched-arg-count with RTIC #6684

VersBinarii opened this issue Nov 30, 2020 · 4 comments
Labels
A-diagnostics diagnostics / error reporting A-ty type system / type inference / traits / method resolution

Comments

@VersBinarii
Copy link

The following example causes rust-analyzer to incorrectly report [rust-analyzer mismatched-arg-count] [E] Expected 1 argument, found 0 with those 2 lines:

let _flash = dp.FLASH.constrain();
let _rcc = dp.RCC.constrain();

when using latest cortex-m-rtic = "0.6.0-alpha.0" release.
However when providing a dummy argument into constrain() rust analyzer then correctly says that the function in fact takes no arguments.

#![no_std]
#![no_main]

use panic_halt as _;
use stm32f1xx_hal::stm32;

#[rtic::app(device = crate::stm32, peripherals = true)]
mod app {
    use panic_halt as _;
    use stm32f1xx_hal::prelude::*;

    #[resources]
    struct Resources {}

    #[init]
    fn init(cx: init::Context) -> init::LateResources {
        let dp = cx.device;

        let _flash = dp.FLASH.constrain();
        let _rcc = dp.RCC.constrain();

        init::LateResources {}
    }

    #[idle]
    fn idle(_cx: idle::Context) -> ! {
        loop {}
    }
}

@bjorn3
Copy link
Member

bjorn3 commented Dec 1, 2020

Attribute proc macros are not yet supported.

@flodiebold
Copy link
Member

As bjorn3 wrote, we don't run attribute macros yet, so cx and dp are probably of unknown type. We should keep track of the type errors in this situation and avoid issuing follow-up diagnostics.

@flodiebold flodiebold added A-diagnostics diagnostics / error reporting A-ty type system / type inference / traits / method resolution labels Dec 15, 2020
@VersBinarii
Copy link
Author

Thanks, i understood the issue. I'm happy to close this issue unless you wish to use this for keeping the track of it.

@lnicola
Copy link
Member

lnicola commented Dec 20, 2020

Proc macro attributes are tracked in #6029, please watch that and re-test when it's implemented. Closing to keep things tidy.

@lnicola lnicola closed this as completed Dec 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting A-ty type system / type inference / traits / method resolution
Projects
None yet
Development

No branches or pull requests

4 participants