Skip to content
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

cant recognize tonic generated code #18748

Open
pdeva opened this issue Dec 23, 2024 · 0 comments
Open

cant recognize tonic generated code #18748

pdeva opened this issue Dec 23, 2024 · 0 comments
Labels
C-bug Category: bug

Comments

@pdeva
Copy link

pdeva commented Dec 23, 2024

Code compiles and runs fine. In fact in RustRover even the 'goto definition' works (though rustrover doesnt use RA for this).

But with rust-analyzer in vscode i instead see errors. As can be seen in the screenshot though, the file it wants to load does indeed exist and has valid rust code.

rust-analyzer version: 0.3.2228

rustc version: rustc 1.83.0 (90b35a623 2024-11-26)

editor or extension: VSCode

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): (eg. rust-analyzer)

code snippet to reproduce:

build.rs

use glob::glob;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut proto_files = Vec::new();
    for entry in glob("**/*.proto")? {
        proto_files.push(entry?.display().to_string());
    }
    let includes: [&str; 0] = [];
    tonic_build::configure()
        .compile_well_known_types(true)
        .compile_protos(proto_files.as_slice(), &includes)?;

    Ok(())
}

tonic_defs.rs

pub mod helloworld {
    pub mod svc {
        tonic::include_proto!("helloworld.svc");
    }
    pub mod lib {
        tonic::include_proto!("helloworld.lib");
    }
}

Image Image Image Image
@pdeva pdeva added the C-bug Category: bug label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

1 participant