You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pretty sure there is something wrong with my code, but Rust doesn't give any meaningful error message, just fails and requests to report this here.
Code + Error message:
$ cat rust_bug.rs
struct Parser<'self, A> (&'self fn(&str) -> Option<(A, uint)>);
fn char<'self>(c: u8) -> Parser<'self, u8> {
Parser(|string|
if string[0] == c {
Some((c, 1))
} else {
None
})
}
fn main() {
}
$ rust run rust_bug.rs
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1 to get further details and report the results to github.com/mozilla/rust/issues
$ RUST_LOG=rustc=1 rust run rust_bug.rs
task <unnamed> failed at 'assertion failed: rp.is_none()', /Users/utkarsh/dev/git/rust/src/librustc/middle/typeck/collect.rs:1108
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1 to get further details and report the results to github.com/mozilla/rust/issues
task <unnamed> failed at 'explicit failure', /Users/utkarsh/dev/git/rust/src/librustc/rustc.rs:376
I'm using the HEAD of master branch as of this moment: 89d0400.
The text was updated successfully, but these errors were encountered:
Hi! Thanks for the bug report, but I think this is a dup of #8741 (and #7989, and a few others). It's very confusing at the moment, but the lifetime called 'self should essentially only be used when the compiler says you can't use anything else, the "correct" thing to use is:
fnchar<'a>(c:u8) -> Parser<'a,u8>{
...}
However, the above still won't work (although it will give a proper error message rather than an ICE), since &fn's with captures cannot be returned. Parser<A>(~fn(&str) -> Option<(A, uint)>) or @fn probably work better.
Pretty sure there is something wrong with my code, but Rust doesn't give any meaningful error message, just fails and requests to report this here.
Code + Error message:
I'm using the HEAD of master branch as of this moment: 89d0400.
The text was updated successfully, but these errors were encountered: