Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Panickers: PROVE or REMOVE #1026

@gavofyork

Description

@gavofyork

.expect and assert! should all have strings of the form:

"<truth> ( [, <truth>] ... ) ( [; so <derivation>] ... ); qed"

e.g.

fn foo(x: Option<int>) -> int {
    let mut b = false;
    if x.is_some() {
        b = bar();
    }

    if b {
        return x.expect("`b` initially `false`; `b` changed only inside block guarded by `x.is_some()`; `b` is `true`; so `x` must be `Some`; qed") - 1;
    }

    0
}

Any other panickers (e.g. subscripting) must have an additional assert! prepended so they fail with an error message as early as possible.

  • blockchain module
  • trie module
  • other modules

Metadata

Metadata

Assignees

Labels

F6-refactor 📚Code needs refactoring.M4-core ⛓Core client code / Rust.P2-asap 🌊No need to stop dead in your tracks, however issue should be addressed as soon as possible.Q9-epic 🌪Can only be fixed by John Skeet.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions