Skip to content

Add more detailed description to the panic message #14

Description

@semisemisea

After spending a month building my compiler, i've now finished the major part of this project(Chapter 1-8), with only some 'little' optimization work to do...

But I also noticed that most of the method, though describe the panic message in a very straightforward way, did not show enough information to quickly locate the source of bugs.

Examples:
1.thread 'main' (28378370) panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/koopa-0.0.9/src/ir/builder.rs:309:9:
argument type mismatch <----- I think at least we can the expected type and current type.

2.thread 'main' (28364503) panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/koopa-0.0.9/src/ir/builder.rs:209:14:
src must be a pointer of array. <----- I think we can show what type is src or what type src points to

I know this is the place where debuggers plays well, we can toggle some breakpoint and swimming in stack to find problem, but some informative warning message do not hurt.
So I am wondering would this project introduce some error handling library like anyhow or thiserror in the future?

Koopa IR and this whole course are very helpful and meaningful to me. I am willing to contribute at this part(Error reporting) in my spare time.

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