When i try to create an array of Primitive
enums, it seems to completely break my debugger. This is minimal reproducible example what i'm trying to debug:
use primitives::{sphere::Sphere, Primitive};
use types::vector::Vector;
pub mod primitives;
pub mod types;
pub mod raytracing;
pub mod window;
fn main() {
// let _s = Sphere{
// origin: Vector::x(20.0),
// radius: 5.0,
// absorption_color: (0, 0, 0),
// emitting_color: (0, 255, 0)
// };
let objs = [Primitive::Sphere(Sphere{
origin: Vector::x(20.0),
radius: 5.0,
absorbtion_color: (0, 0, 0),
emitting_color: (0, 255, 0)
})];
}
However, i can't see local variables, and the only thing what kinda works on the top panel (continue, step over, etc) is 'stop' button, but with delay and only if i press it a few times. A program by it's own seems to work normal and cargo check
, cargo clippy
don't show any warnings.
The most strange thing is when i uncomment unused Sphere
initialization (let _s = Sphere{... }
), it works fine.
I am new in Rust, but in any case i don't really understand how initialization of some object which i never use has any impact.
Here are the definitions of Primitive
and Sphere
:
#[derive(Clone, Copy)]
pub struct Sphere {
pub origin: Vector,
pub radius: f32,
pub absorption_color: (u8, u8, u8),
pub emitting_color: (u8, u8, u8)
}
pub enum Primitive {
Sphere(Sphere),
}
I'm using VSCodium 1.96.3, rustc 1.84.0, rust-analyzer and CodeLLDB extensions on Debian 6.12.6-1.