[build]
# Use safer optimization flags to avoid Rust compiler SIGSEGV
# The default Debian build flags are too aggressive and cause crashes

[target.'cfg(all())']
# Override aggressive optimization flags that cause SIGSEGV
rustflags = [
    "-C", "opt-level=2",           # Use safer optimization level (was 3)
    "-C", "codegen-units=16",      # Use multiple codegen units (was 1)
    # Remove linker-plugin-lto which causes SIGSEGV with regex-automata
    "-C", "lto=false",             # Disable LTO to avoid crashes
]

[profile.release]
# Use safer release profile settings
opt-level = 2                      # Safer optimization level
codegen-units = 16                 # Multiple codegen units for stability
lto = false                        # Disable LTO to avoid crashes
panic = "abort"                    # Abort on panic for release builds
strip = true                       # Strip debug symbols
debug = false                      # No debug info in release builds

[profile.dev]
# Development profile settings
opt-level = 0                      # No optimization for faster compilation
debug = true                       # Include debug info
codegen-units = 16                 # Multiple codegen units
lto = false                        # Disable LTO

# Environment-specific overrides
[env]
# Set environment variables for safer builds
RUSTFLAGS = "--cfg debug_assertions"
CARGO_INCREMENTAL = "1"
