Hey everybody! I have a small playground sample that causes a stack overflow. Does anybody know why or how to avoid it? This feels likea bug.
use std::sync::Arc;
#[derive(serde::Deserialize)]
#[serde(from = "String")]
pub struct FontFamily(Arc<str>);
impl From<String> for FontFamily {
fn from(s: String) -> Self {
s.into()
}
}
#[derive(serde::Deserialize)]
struct Data {
family: FontFamily
}
fn main() {
let test: Data = serde_json::from_str(r#"{
"family": "testing"
}"#).unwrap();
}
Errors:
Compiling playground v0.0.1 (/playground)
warning: unused variable: `test`
--> src/main.rs:19:9
|
19 | let test: Data = serde_json::from_str(r#"{
| ^^^^ help: if this is intentional, prefix it with an underscore: `_test`
|
= note: `#[warn(unused_variables)]` on by default
warning: field is never read: `family`
--> src/main.rs:15:5
|
15 | family: FontFamily
| ^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `playground` (bin "playground") generated 2 warnings
Finished dev [unoptimized + debuginfo] target(s) in 1.33s
Running `target/debug/playground`
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
timeout: the monitored command dumped core
/playground/tools/entrypoint.sh: line 11: 8 Aborted timeout --signal=KILL ${timeout} "$@"