Skip to content

FP expected [&(dyn Foo + 'static); 2], found [&i32; 2] #22983

Description

@matthiaskrgr
trait Foo {}
impl Foo for isize {}
fn foo(_: [&dyn Foo; 2]) {}

fn main() {
    let r = &1;
    let _: [&dyn Foo; 2] = [r; 2];
    foo([&1; 2]);
}

rustc compiles this but rust-analyzer diagnostics . says

at crate ra, file /tmp/ra/src/main.rs: Error RustcHardError("E0308") from LineCol { line: 7, col: 8 } to LineCol { line: 7, col: 15 }: expected [&(dyn Foo + 'static); 2], found [&i32; 2]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions