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

ICE: resolve didn't write in variant #15896

Closed
pnkfelix opened this issue Jul 22, 2014 · 0 comments · Fixed by #15951
Closed

ICE: resolve didn't write in variant #15896

pnkfelix opened this issue Jul 22, 2014 · 0 comments · Fixed by #15951
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@pnkfelix
Copy link
Member

Here is a test case:

fn main() {
    enum R { REB(()) }
    struct Tau { t: uint }
    enum E { B(R, Tau) }

    let e = B(REB(()), Tau { t: 3 });
    let u = match e {
        B(Tau{t: x}, _) => x,
    };
    println!("u: {}", u);
}

It contains a programmer error: They swapped the order of arguments to the B variant constructor.

It seems like some component gets confused though, and we end up ICE'ing instead of providing a useful error message. (I'm guessing the fact that I am passing a struct into a pattern that is expecting some enum variant is part of the explanation here; perhaps it is being parsed expecting the pattern to be an instance of some (non-existent) struct-variant of the enum being matched?

Transcript:

% rustc --version
rustc 0.12.0-pre (5ddc7b4a252fbebee5f2ac87ed755139816d6823 2014-07-18 13:31:22 +0000)
% rustc /tmp/f.rs
/tmp/f.rs:8:11: 8:20 error: internal compiler error: resolve didn't write in variant
/tmp/f.rs:8         B(Tau{t: x}, _) => x,
                      ^~~~~~~~~
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /Users/fklock/Dev/Mozilla/rust.git/src/libsyntax/diagnostic.rs:115

% 
edwardw added a commit to edwardw/rust that referenced this issue Jul 24, 2014
Fix ICE when there's an incorrect enum variant constructor in match arm.

Closes rust-lang#15896.
@edwardw edwardw mentioned this issue Jul 24, 2014
bors added a commit that referenced this issue Jul 25, 2014
Fix ICE when there's an incorrect enum variant constructor in match arm.

Closes #15896.
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 11, 2023
Show placeholder while run command gets runnables from server

This PR fixes a UI annoyance in the VS Code extension when working in large codebases where rust-analyzer can take a few moments to interact with the server. Scenario:

1. Invoke "rust-analyzer: Run" from the command palette or hotkey
2. Quickly start typing to filter the list (or press Enter to accept the last runnable)

We often do this quickly from muscle memory without waiting to see the picker. The picker often takes several seconds to come up, causing us to type garbage into the currently open editor.

Fix:

Show a placeholder item before we call out to the server.

![image](https://github.com/rust-lang/rust-analyzer/assets/16928427/09de6a1c-6f3c-4d29-8031-ba4baeb43282)

Selecting this item does nothing so if the user accidentally hits Enter nothing happens.

The list is populated and the placeholder dismissed when the actual runnables are retrieved. From here the behavior is the same as before.

![image](https://github.com/rust-lang/rust-analyzer/assets/16928427/837c7dfc-c060-4d68-bbf6-df8aa3101b78)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants