-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
error: internal compiler error: adt::represent_type called on non-ADT type: &std ::io::IoError #20046
Comments
Interesting. The ICE occurs only when both of the lines exist. If we comment out either line, it compiles well. |
looks like this still happens on a recent nightly (jan 1, 2015): rust version:
reduced repro code:
still yields:
dunno how martine arrived at this pattern match, but for me it was a case of being in transition from alex crichton's approach to handling EOF to steve fackler's, as proposed on |
This doesn't compile and the proposed pattern match is much deeper now due to changes to |
Updated testcase; still crashes on nightly. #[derive(PartialEq)]
enum IoErrorKind { BrokenPipe, XXX }
struct IoError {
pub kind: IoErrorKind,
pub detail: Option<String>
}
fn main() {
let e: Result<u8, _> = Err(IoError{ kind: IoErrorKind::XXX, detail: None });
match e {
Ok(_) => true,
Err(ref e) if e.kind == IoErrorKind::BrokenPipe => return,
Err(IoError { kind: IoErrorKind::BrokenPipe, ..}) => return,
Err(err) => panic!(err)
};
} |
The old code was not well structured, difficult to understand, and buggy. The new implementation is completely naive, so there may be a slight runtime performance loss. That said, adding optimizations on top of a clear and correct implementation seems easier than trying to fix the old mess. Fixes issue rust-lang#19064. Fixes issue rust-lang#26989. Fixes issue rust-lang#26251. Fixes issue rust-lang#18060. Fixes issue rust-lang#24875. Fixes issue rust-lang#23311. Fixes issue rust-lang#20046.
… type: &std ::io::IoError Reference rust-lang/rust#20046
Slightly more reduced: // FAILS
enum X {
Y(())
}
fn main() {
let x = &X::Y(());
match x {
&X::Y(ref _x) if true => {},
&X::Y(()) => {},
}
} Notably, the // FAILS
enum X {
Y(())
}
fn main() {
let x = X::Y(());
match (true, &x) {
(true, &X::Y(ref _x)) => {},
(_, &X::Y(())) => {},
}
} vs. swapping which arm has the guard: // ok
enum X {
Y(())
}
fn main() {
let x = X::Y(());
match &x {
&X::Y(()) if true => {},
&X::Y(ref _x) => {},
}
} And the order matters, e.g.: // FAILS
enum X {
Y(())
}
fn main() {
let x = X::Y(());
match &x {
&X::Y(ref _x) if true => {},
&X::Y(()) if true => {},
_ => {}
}
} // ok
enum X {
Y(())
}
fn main() {
let x = X::Y(());
match &x {
&X::Y(()) if true => {},
&X::Y(ref _x) if true => {},
_ => {}
}
} I.e. a workaround (if it is semantically correct for the program) is to move the |
I’m getting a similar error on servo/rust-layers#218 / servo/rust-layers@39a38c5
Interestingly, it happens with the current Nightly: rustc 1.6.0-nightly (52d95e6 2015-11-30) but not with the version used in Servo: rustc 1.6.0-nightly (d5fde83 2015-11-12) |
sounds like a different bug. Could you please report it separately? |
I was told this one is likely fixed by #30116. Indeed, removing |
I’ve hit this with something like following:
which resulted in
|
@eefriendman's test case #20046 (comment) now compiles as of
as does @huonw's #20046 (comment) As such, I'm going to give this one a close. Let me know if this can still be reproduced! |
Reduced code, with the line causing the ICE marked in a comment:
The text was updated successfully, but these errors were encountered: