Following the tutorial and got error after the "parsing digits" section #44
-
I'm new to Rust and and I'm following the tutorial. After the "parsing digits" section, I have the following files.
test.foo
main.rs
Cargo.toml
When I run it, I got the following error:
I can't figure out where is the problem. Could anyone give me some help? Thanks. Btw, I'm using Rust 1.57 on Windows.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi! This isn't your fault, I think the problem is that you're relying on the latest stable version of the crate while the tutorial is written against the In the case of this error, you can use However, it might be easier to have your project depend on the
|
Beta Was this translation helpful? Give feedback.
Hi!
This isn't your fault, I think the problem is that you're relying on the latest stable version of the crate while the tutorial is written against the
master
branch. Themaster
branch has some new features that aren't in the latest stable version.In the case of this error, you can use
src.as_str()
to borrow theString
as a&str
.However, it might be easier to have your project depend on the
master
branch for now, because there are some later parts of the tutorial that you'll run into similar issues with if you're only using the latest stable version. You can do that with the following in yourCargo.toml
: