Why can't you store a value and a reference to it in the same struct in Rust?
Hi everyone! I started learning Rust and encountered a problem that I haven't been able to solve for several days.\n\nI'm writing a parser for configuration files. I have a `Parser` struct that reads data from a string and provides an iterator over words. Here's simplified code:\n\n```rust\nstruct Parser {\n data: String,\n words: Vec<&str>, // references to data\n}\n\nimpl Parser {\n fn new(input: &str) -> Self {\n let data = input.to_string();\n let words: Vec<&str> = data.split_whitespace().collect();\n Parser { data, words } // error!\n }\n}\n```\n\nThe compiler gives an error: `cannot move out of 'data' because it is borrowed`. I understand that `words` contains references to `data`, but `data` and `words` are in the same struct! Shouldn't Rust understand that the