Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Negative coverage: borrow_check_expr / struct / premise if field_exprs.len() == provided_names.len()

Premise at line 599. Observed failure causes: if_false.

struct
LineCoverageSource
5881(let Struct { id: _, binder } = env.crates().struct_named(&adt_id)?)
589✗(if turbofish.parameters.len() == binder.len())
590✗(let StructBoundData { where_clauses, fields } = binder.instantiate_with(&turbofish.parameters)?)
593N/A(let expected_names: Set<FieldName> = for_all field in fields => field.name)
594N/A(let provided_names: Set<FieldName> = for_all field in field_exprs => field.name)
595✗(if expected_names == provided_names)
5991(if field_exprs.len() == provided_names.len())
602✗(for_all(i in 0..field_exprs.len()) with(state)
(field in fields)
(if field.name == field_exprs[i].name)
(borrow_check_expr_has_ty(env, assumptions, state, &field_exprs[i].value, &field.ty, places_live_on_exit) => state))
607✗(prove_where_clauses(env, assumptions, state, where_clauses) => state)
609N/A(let ty = RigidTy::new(adt_id, &turbofish.parameters))
──────── ("struct")
61119(borrow_check_expr(env, assumptions, state, Expr::Struct { adt_id, turbofish, field_exprs }, places_live_on_exit) => (ty, state))

1 test failed proving this premise:


Source location: tests/mir_typeck.rs:902 (all coverage from this test)

fn main() -> () {
    let s: S = S { x: 1_u32, x: 2_u32 };
}
Failed proof tree

How to read this page