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

Compilation will fail when the type error is automatically deduced #3891

Closed
Cupnfish opened this issue Apr 8, 2020 · 3 comments
Closed

Compilation will fail when the type error is automatically deduced #3891

Cupnfish opened this issue Apr 8, 2020 · 3 comments

Comments

@Cupnfish
Copy link

Cupnfish commented Apr 8, 2020

The example is when I use the gfx-hal library, I encountered the following situation:

    let (instance, surface, adapter) = {
        let instance = backend::Instance::create(APP_NAME, 1).expect("Backend not supported");
        let surface = unsafe {
            instance
                .create_surface(&window)
                .expect("Failed to create surface for window")
        };
        let adapter = instance.enumerate_adapters().remove(0);

        (instance, surface, adapter)
    };

The plugin deduces the type of surfae as (),And the subsequent calls about the surface all showed errors, even when I directly performed cargo build in the terminal, there was an error.

@lnicola
Copy link
Member

lnicola commented Apr 8, 2020

It's not exactly clear to me how a rust-analyzer type inference bug can cause cargo build to fail when run from a terminal. Can you prepare a repository showing the issue?

@Cupnfish
Copy link
Author

Cupnfish commented Apr 8, 2020

I describe it in more detail:
When I write this code on vscode,the first derivation goes like this:
let surface:() = unsafe { instance.create_surface(&window).expect("Failed to create surface for window") };
In the subsequent code, there are error prompts for surface calls,But it's not a big deal. It usually runs normally directly on the terminal useing -cargo run- .
But when I use -cargo run- directly this time, the errors I get are consistent with the errors I get from derivation.
It wasn't until I commented out the above code, and then uncommented again, so that the derivation type was deduced correctly after refreshing.

@flodiebold
Copy link
Member

If you actually write let surface: (), that will of course give type errors. I don't see how that's related to rust-analyzer, though.

lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Jan 7, 2025
Fix tokio test ICE

Fixes rust-lang#3858

It turned out that the issue mentioned [here](rust-lang/miri#3858 (comment)) is the exact cause of ICE.
So in this PR, I changed the type of ``EpollEventInterest::epfd`` from ``i32`` to ``WeakFileDescriptionRef``.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants