Skip to content

Getting "error: mismatched types: expected std::result::Result<(BUG[0u],uint),~str>..." #10031

Closed
@utkarshkukreti

Description

@utkarshkukreti

I'm getting the following error when trying to compile a library I wrote - https://github.com/utkarshkukreti/parley.rs

➜ r1 git:(master) make
test/parser_test.rs:5:41: 16:3 error: mismatched types: expected `std::result::Result<(BUG[0u],uint),~str>` but found `std::result::Result<(~str,<VI2>),~str>` (expected type parameter but found ~str)
test/parser_test.rs:5 let zero: Parser<~str> = do Parser |s| {
test/parser_test.rs:6 match s.len() {
test/parser_test.rs:7 0 => Err(~"Expected `0` but found EOF"),
test/parser_test.rs:8 _ => {
test/parser_test.rs:9 match s[0] as char {
test/parser_test.rs:10 '0' => Ok((~"Yes!", 1)),
...
test/parser_test.rs:5:27: 16:3 error: mismatched types: expected `parley::parser::Parser<~str>` but found `parley::parser::Parser<BUG[0u]>` (expected ~str but found type parameter)
test/parser_test.rs:5 let zero: Parser<~str> = do Parser |s| {
test/parser_test.rs:6 match s.len() {
test/parser_test.rs:7 0 => Err(~"Expected `0` but found EOF"),
test/parser_test.rs:8 _ => {
test/parser_test.rs:9 match s[0] as char {
test/parser_test.rs:10 '0' => Ok((~"Yes!", 1)),
...
error: aborting due to 2 previous errors
task '<unnamed>' failed at 'explicit failure', /Users/utkarsh/dev/git/rust/src/libsyntax/diagnostic.rs:98
task '<unnamed>' failed at 'explicit failure', /Users/utkarsh/dev/git/rust/src/librustc/rustc.rs:395
make: *** [test] Error 101

utkarshkukreti/parley.rs@9b8ac76 is the commit which caused this; just a re-arrangement of the code, making the core part of the library a crate.

I grepped the error message in the Rust's codebase, and found only one result - https://github.com/mozilla/rust/blob/8c97c5ebfd64de87b3868fc8dbfd79a74c4be3cb/src/librustc/util/ppaux.rs#L449 which says

                  // This should not happen...
                  format!("BUG[{:?}]", id)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions