Some panics cause RStudio to crash
As stated in the title, some panics cause RStudio to crash.
I have had a hard time creating a minimal example, as the following code does NOT cause RStudio to crash.
These are placed in the `lib.rs` of a new R `rextendr` project.
```rust
/// Just panic
/// @export
#[extendr]
fn just_panic() {
panic!("at the disco");
}
/// Create a panic due to index out of bounds
/// @export
#[extendr]
fn index_out_of_bounds() {
let vec = vec![10, 20, 30, 40, 50];
let _value = vec[7]; // This will panic with index out of bounds
println!("This line should never be reached!");
}
```
Similar code with panics in spawned threads (either using `std::thread` or `rayon` parallell iterators) does not crash.
What _does_ cause our RStudio to crash are panics in third-party crates, where the panic occurs because of an out-of-bounds error in a parallell iterator, hence the example above.
@CGMossa was able to reproduce, and could probably supply a better example.
0 条评论