Skip to content

Internal compiler error on invalid field name in struct literal #3990

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

Closed
ben0x539 opened this issue Nov 16, 2012 · 3 comments
Closed

Internal compiler error on invalid field name in struct literal #3990

ben0x539 opened this issue Nov 16, 2012 · 3 comments
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@ben0x539
Copy link
Contributor

This prints an ICE in addition to the expected diagnostic:

struct S {
    x: int
}

fn main() {
    S { y: 1 };
}

error: internal compiler error: no type for node 8: expr 1 (id=8) in fcx 7f8a6449c480

I half-remember hearing that this is already known a while ago, but I couldn't find an issue for it and it's still happening. Sorry if this is redundant.

@ghost ghost assigned catamorphism Nov 24, 2012
@ben0x539
Copy link
Contributor Author

Can't reproduce this anymore.

@pnkfelix pnkfelix reopened this Mar 25, 2013
@pnkfelix
Copy link
Member

I was actually just able to reproduce this on commit c202430.

% rustc /tmp/foo.rs 
/tmp/foo.rs:3:16: 3:20 error: structure has no field named `y`
/tmp/foo.rs:3 fn main() { S { y: 1 }; }
                              ^~~~
/tmp/foo.rs:3:12: 3:13 error: missing field: `x`
/tmp/foo.rs:3 fn main() { S { y: 1 }; }
                          ^
error: internal compiler error: no type for node 8: expr 1 (id=8) in fcx 7fc245a679a0

Its a bit strange, since we are already issuing errors for the problems. But an ICE is an ICE.

(Also, this need not be addressed for the 0.6 timeframe.)

@metajack
Copy link
Contributor

The ICE seems to have been fixed. This is the only error now as of commit 7012c42:

/tmp/something.rs:6:8: 6:12 error: structure has no field named `y`
/tmp/something.rs:6     S { y: 1 };
                            ^~~~
error: aborting due to previous error

RalfJung added a commit to RalfJung/rust that referenced this issue Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants