rust-book-cn/listings/ch05-using-structs-to-structure-related-data/no-listing-02-reference-in-struct/output.txt

32 lines
776 B
Plaintext
Raw Normal View History

2021-05-09 14:49:31 +08:00
$ cargo run
Compiling structs v0.1.0 (file:///projects/structs)
error[E0106]: missing lifetime specifier
2022-01-30 14:09:43 +08:00
--> src/main.rs:3:15
2021-05-09 14:49:31 +08:00
|
2022-01-30 14:09:43 +08:00
3 | username: &str,
2021-05-09 14:49:31 +08:00
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
2022-01-30 14:09:43 +08:00
1 ~ struct User<'a> {
2 | active: bool,
3 ~ username: &'a str,
2021-05-09 14:49:31 +08:00
|
error[E0106]: missing lifetime specifier
2022-01-30 14:09:43 +08:00
--> src/main.rs:4:12
2021-05-09 14:49:31 +08:00
|
2022-01-30 14:09:43 +08:00
4 | email: &str,
2021-05-09 14:49:31 +08:00
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
2022-01-30 14:09:43 +08:00
1 ~ struct User<'a> {
2 | active: bool,
3 | username: &str,
4 ~ email: &'a str,
2021-05-09 14:49:31 +08:00
|
For more information about this error, try `rustc --explain E0106`.
2022-01-30 14:09:43 +08:00
error: could not compile `structs` due to 2 previous errors