Skip to content

Instantly share code, notes, and snippets.

@eevee
Created March 14, 2017 03:12
Show Gist options
  • Select an option

  • Save eevee/f184be39325f800f4ba6ee04d319b563 to your computer and use it in GitHub Desktop.

Select an option

Save eevee/f184be39325f800f4ba6ee04d319b563 to your computer and use it in GitHub Desktop.
weird-ass rust problem
enum IResult<I, O, E = u32> {
Done(I, O),
Error(E),
}
fn foo(input: &[u8]) {
if let IResult::Done(i, o) = IResult::Done(input, input) {}
}
$ rustc --crate-type lib lib-minimal.rs -Ltarget/debug/deps
error[E0282]: unable to infer enough type information about `E`
--> lib-minimal.rs:7:34
|
7 | if let IResult::Done(i, o) = IResult::Done(input, input) {}
| ^^^^^^^^^^^^^ cannot infer type for `E`
|
= note: type annotations or generic parameter binding required
error: aborting due to previous error
$ rustc --version
rustc 1.15.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment