Skip to content

rust-analyzer confuses Option::take and Iterator::take when checking arguments #16516

Closed as not planned
@Wilfred

Description

@Wilfred

Given the code:

fn my_example(
    _x: impl IntoIterator<Item = impl AsRef<str>>,
    _y: impl IntoIterator<Item = impl AsRef<str>>,
) {
    let mut cmd = std::process::Command::new("foo");

    let mut child = cmd.spawn().unwrap();
    child.stdin.take();
}

fn main() {}

rust-analyzer complains about the .take() call, saying it needs an argument:

Screenshot 2024-02-08 at 16 16 02

However, this is incorrect. The program compiles fine, because it's actually calling Option::take which takes no arguments.

rust-analyzer version: rust-analyzer 1.75.0 (82e1608d 2023-12-21), but also reproduces on 2024-01-22.

rustc version: rustc 1.75.0 (82e1608df 2023-12-21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tytype system / type inference / traits / method resolutionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions