consciousness/src/bin/consciousness.rs
Kent Overstreet 25e4775974 enable tls
2026-05-22 13:02:42 -04:00

26 lines
1 KiB
Rust

#![feature(panic_backtrace_config)]
#![warn(unreachable_pub)]
fn main() {
// Force the default panic hook to print a backtrace. stderr is
// already redirected to a daemon log; without this the hook obeys
// RUST_BACKTRACE (unset by default), so the log only shows the
// "note: run with `RUST_BACKTRACE=full`" tail and the actual
// frames are lost.
//
// SAFETY: called before any other thread is spawned, so no
// concurrent env reader can race.
if std::env::var_os("RUST_BACKTRACE").is_none() {
unsafe { std::env::set_var("RUST_BACKTRACE", "1"); }
}
std::panic::set_backtrace_style(std::panic::BacktraceStyle::Short);
// rustls 0.23 requires an explicit process-wide CryptoProvider
// when both `ring` and `aws-lc-rs` are in the dep graph (otherwise
// it panics on first ClientConfig::builder()). Pick `ring`.
rustls::crypto::ring::default_provider()
.install_default()
.expect("install rustls crypto provider");
consciousness::user::main()
}