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

internal compiler error: cannot get field types from the enum type Foo without a node ID #11577

Closed
pzol opened this issue Jan 15, 2014 · 0 comments · Fixed by #12639
Closed
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@pzol
Copy link
Contributor

pzol commented Jan 15, 2014

#[feature(struct_variant)];

enum Foo {
  Bar { num: int}
}

fn test_foo() {
  let bar = Bar { num: 1 };
  let Bar { num } = bar;
}

task 'rustc' failed at 'explicit failure', /Users/pzol/rust/rust/src/libsyntax/diagnostic.rs:75
task '

' failed at 'explicit failure', /Users/pzol/rust/rust/src/librustc/lib.rs:453

rustc -v
rustc 0.10-pre (29070c3 2014-01-14 23:01:51 -0800)
host: x86_64-apple-darwin

bors added a commit that referenced this issue Mar 1, 2014
We weren't passing the node id for the enum and hence it couldn't retrieve the field types for the struct variant we were trying to destructure.

Fixes #11577.
@luqmana luqmana closed this as completed in 715e618 Mar 1, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 2, 2023
new lint: `unnecessary_fallible_conversions`

Closes rust-lang#11577

A new lint that looks for calls such as `i64::try_from(1i32)` and suggests `i64::from(1i32)`. See lint description (and linked issue) for more details for why.

There's a tiny bit of overlap with the `useless_conversion` lint, in that the other one warns `T::try_from(T)` (i.e., fallibly converting to the same type), so this lint ignores cases like `i32::try_from(1i32)` to avoid emitting two warnings for the same expression.

Also, funnily enough, with this one exception, this lint would warn on exactly every case in the `useless_conversion_try` ui test that `useless_conversion` didn't cover (but never two warnings at the same time), which is neat. I did add an `#![allow]` though since we don't want interleaved warnings from multiple lints in the same uitest.

changelog: new lint: `unnecessary_fallible_conversions`
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.

1 participant