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 · 5 comments
Open

cant recognize tonic generated code #18748

pdeva opened this issue Dec 23, 2024 · 5 comments
Assignees
Labels
A-vfs Broken Window Bugs / technical debt to be addressed immediately 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
@zheilbron
Copy link

zheilbron commented Dec 27, 2024

Possible duplicate of #12088, although that was filed years ago.
I've recently started experiencing the issue exactly as described above, whereas a few weeks ago it was working without issue.

@Veykril
Copy link
Member

Veykril commented Dec 29, 2024

Hmm, the only recent PR touching relevant parts is #18668 but I don't see that doing anything that would cause this

@Macdu
Copy link

Macdu commented Jan 3, 2025

I am also experiencing the same issue (using slint, but it's the same error, failing to include an existing file).
I don't have this issue with version 0.3.2212, it started appearing with release v0.3.2220.
Also this issue appears for me when working with a workspace. Even on the latest rust-analyzer version, I have no problem when the root directory is a simple binary crate.

@Veykril Veykril added Broken Window Bugs / technical debt to be addressed immediately A-vfs labels Jan 4, 2025
@Veykril
Copy link
Member

Veykril commented Jan 5, 2025

I'll have a look at this the coming week (I presume I broke this, but I do not see the correlation wrt to the releases mentioned which confuses me).

@Veykril Veykril self-assigned this Jan 5, 2025
@pdeva
Copy link
Author

pdeva commented Jan 5, 2025

it seems there are some platform specific issues at play here too. The same code with the same rust analyzer version works fine in linux, but has this above issue on macOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vfs Broken Window Bugs / technical debt to be addressed immediately C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

4 participants