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

.max recognized as Ord.max instead of Iterator.max #11048

Closed
Crazytieguy opened this issue Dec 18, 2021 · 5 comments
Closed

.max recognized as Ord.max instead of Iterator.max #11048

Crazytieguy opened this issue Dec 18, 2021 · 5 comments
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug

Comments

@Crazytieguy
Copy link

rust-analyzer version: db2a708 2021-12-13 stable

rustc version: rustc 1.59.0-nightly (efec54529 2021-12-04)

code: https://github.com/Crazytieguy/advent-2021/blob/e3b5f3335acb6ea73e03cf397b22e59cdd7af356/src/bin/day18/main.rs#L131

This code compiles and runs fine, but rust-analyzer is giving a wrong error for line 131:
expected 1 argument, found 0

I'm calling max on an iterator but it thinks I'm calling max on Ord.

@flodiebold flodiebold added A-ty type system / type inference / traits / method resolution C-bug Category: bug labels Dec 18, 2021
@neurosie
Copy link

I've got a minimal example for this:

fn main() {
    Vec::<Vec<Vec<u32>>>::new()
        .iter()
        .flat_map(|el| el.iter().map(|el2| el2.len()))
        .max();
}

Compiles on 1.57.0, but rust-analyzer brings up the docs for Ord::max and shows an error: "expected 1 argument, found 0 rust-analyzer(mismatched-arg-count)".

rust-analyzer version: db2a708 2021-12-13 stable
rustc version: 1.57.0 (f1edd0429 2021-11-29)

@jhgg
Copy link
Contributor

jhgg commented Dec 20, 2021

dupe of #10673

@lnicola lnicola closed this as completed Dec 20, 2021
@Crazytieguy
Copy link
Author

@jhgg that one is also closed... I see there's #10677, are you sure it's the same problem?

@jhgg
Copy link
Contributor

jhgg commented Dec 21, 2021

Yes and it was just closed 11 hours ago :)

@lnicola
Copy link
Member

lnicola commented Dec 21, 2021

@Crazytieguy your code works now:

image

#10677 is still an issue, unfortunately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

5 participants