Add a cargo feature to `panic!` early on compile errors for easier `sway-core` debugging?
- Dominant language
- Rust
- Stars
- 61.4k
- Forks
- 5.4k
- Avg merge
- 3h 33m
- Merged PRs (30d)
- 4
Description
During compilation, `sway-core` will avoid returning early on most compilation errors in order to give as much feedback to the user as is possible. This is great for the user, but can make things a bit tricky when trying to determine the source of an unintentional compile error during `sway-core` dev.
One thing I found myself doing quite frequently while solving bugs in #1213 was printing the `checkee`'s `span` during `TypedAstNode::type_check` and then printing the error count at the end to work out exactly which node variant causes the error accumulation to begin.
I wonder if it might be useful to have some cargo feature, i.e. `panic-on-err` or something that we can use solely during debugging that causes the `CompileResult` err constructor to immediately `panic!` so that we can get a quick stack-trace directly to the site that raises the error? This might be a nice alternative to manually hunting down what `CompileError` was raised and where it was raised?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the CompileResult error constructor and the Cargo feature configuration in sway-core. Check how compilation errors are currently accumulated, then verify that enabling the debugging feature panics at the first error with a stack trace while the default behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100