You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had some code, but needed to do some debugging so I added my debugging to the top of the function and then did a return. Something like this:
fn funcname() -> Option<u8> {
// lots of debug logging
...
return None;
// lots of code
...
// last line in function
return None;
}
Which caused the following error:
thread 'main' panicked at sway-core/src/control_flow_analysis/analyze_return_paths.rs:99:13:
assertion failed: neighbors.len() <= 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I couldn't understand why my debugging was throwing that error and eventually I looked down and saw that last return and then commented it out. Presto it worked. I think assertion failed: neighbors.len() <= 1 may be doing some incorrect optimisation, because if you hide the first return in a branch, then it compiles without an error
Steps
Create the same code as above and try to compile.
Possible Solution(s)
No response
Notes
No response
Installed components
> fuelup checklatest - Up to datefuelup - Up to date
The text was updated successfully, but these errors were encountered:
alfiedotwtf
added
bug
Something isn't working
triage
This issue was opened with a template and needs to be triaged by code owners.
labels
Dec 30, 2024
Related Component
compiler
Problem
I had some code, but needed to do some debugging so I added my debugging to the top of the function and then did a return. Something like this:
Which caused the following error:
I couldn't understand why my debugging was throwing that error and eventually I looked down and saw that last return and then commented it out. Presto it worked. I think
assertion failed: neighbors.len() <= 1
may be doing some incorrect optimisation, because if you hide the first return in a branch, then it compiles without an errorSteps
Create the same code as above and try to compile.
Possible Solution(s)
No response
Notes
No response
Installed components
The text was updated successfully, but these errors were encountered: