rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Uninferred box pattern when deconstructing `&Box<_>`

Open iDawer opened this issue 3 years ago • 0 comments

rust-analyzer version: 0.4.1142-standalone (c2eebd7a5 2022-07-26)

#[test]
fn box_pat() {
    check_types(
        r#"
pub struct Global;
#[lang = "owned_box"]
pub struct Box<T, A = Global>(T);

fn test(b: Box<u8>) {
    let box x = &b;
    //      ^ &u8
}"#,
    );
}
test tests::patterns::box_pat ... thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `"{unknown}"`,
 right: `"&u8"`', crates/hir-ty/src/tests.rs:156:17

It passes with #10999, though that PR is closed.

iDawer avatar Jul 27 '22 14:07 iDawer