Skip to content
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

"Expected [type error]" when matching against a typo'd vector #5100

Closed
huonw opened this issue Feb 24, 2013 · 4 comments
Closed

"Expected [type error]" when matching against a typo'd vector #5100

huonw opened this issue Feb 24, 2013 · 4 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Milestone

Comments

@huonw
Copy link
Member

huonw commented Feb 24, 2013

Given tuple-type-error.rs:

fn main() {
    let v = [(1, 2)   // missing comma!
             (3, 4),
             (5, 6)];

    for v.each |&(x,y)| {}
}

rustc spits out

tuple-type-error.rs:2:13: 3:20 error: expected function or foreign function but found `(<VI0>,<VI1>)`
tuple-type-error.rs:2     let v = [(1, 2)   // missing comma!
tuple-type-error.rs:3              (3, 4),
tuple-type-error.rs:6:17: 6:22 error: mismatched types: expected `[type error]`, found tuple
tuple-type-error.rs:6     for v.each |&(x,y)| {}
                                       ^~~~~

I'm not sure if this is a bug or what, but expecting a type error seems peculiar (also, the error message for (a, b) (c, d) without a comma in a vector could be more explanatory, given it is almost certainly a typo).

@ghost ghost assigned catamorphism Feb 28, 2013
@catamorphism
Copy link
Contributor

This should be fixed by a branch I'm working on, so I'll make sure it is. Seeing [type error] in an error message means you're seeing a derived error (an error resulting from assigning a bogus type to something else so we can go on typechecking after seeing an error), and if that ever happens, it's a bug.

@catamorphism
Copy link
Contributor

See #5658

@catamorphism
Copy link
Contributor

Fixed, pending pull request #6103

bors added a commit that referenced this issue May 1, 2013
r? @nikomatsakis typeck::check::_match wasn't suppressing derived errors properly.
Fixed it. (This will fix #5100)
@catamorphism
Copy link
Contributor

Fixed in 7a85767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

2 participants