Skip to content

Type mismatch with dyn Trait #14005

@allan2

Description

@allan2

rust-analyzer version: 0.3.1369-standalone
rustc version: tried both 1.66.0-nightly and 1.64.0 stable

lib.rs

pub fn type_mismatch_ex() {
    let mut params = Vec::<&(dyn Sync)>::with_capacity(2);
    let nums = vec![1, 2];
    for n in &nums {
        params.push(n);
    }
}

screenshot

I got this error in rust-analyzer but the code compiles.

Maybe related to PR #13112?

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