mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-02-02 15:28:40 +08:00
Update codes
This commit is contained in:
parent
f031cd5948
commit
4edc5b8de3
@ -16,9 +16,30 @@ error[E0308]: mismatched types
|
|||||||
= note: expected reference `&String`
|
= note: expected reference `&String`
|
||||||
found reference `&{integer}`
|
found reference `&{integer}`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error[E0283]: type annotations needed for `{integer}`
|
||||||
|
--> src/main.rs:8:44
|
||||||
|
|
|
||||||
|
8 | let secret_number = rand::thread_rng().gen_range(1..101);
|
||||||
|
| ------------- ^^^^^^^^^ cannot infer type for type `{integer}`
|
||||||
|
| |
|
||||||
|
| consider giving `secret_number` a type
|
||||||
|
|
|
||||||
|
= note: multiple `impl`s satisfying `{integer}: SampleUniform` found in the `rand` crate:
|
||||||
|
- impl SampleUniform for i128;
|
||||||
|
- impl SampleUniform for i16;
|
||||||
|
- impl SampleUniform for i32;
|
||||||
|
- impl SampleUniform for i64;
|
||||||
|
and 8 more
|
||||||
|
note: required by a bound in `gen_range`
|
||||||
|
--> /Users/carolnichols/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.3/src/rng.rs:129:12
|
||||||
|
|
|
||||||
|
129 | T: SampleUniform,
|
||||||
|
| ^^^^^^^^^^^^^ required by this bound in `gen_range`
|
||||||
|
help: consider specifying the type arguments in the function call
|
||||||
|
|
|
||||||
|
8 | let secret_number = rand::thread_rng().gen_range::<T, R>(1..101);
|
||||||
|
| ++++++++
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0308`.
|
Some errors have detailed explanations: E0283, E0308.
|
||||||
error: could not compile `guessing_game`
|
For more information about an error, try `rustc --explain E0283`.
|
||||||
|
error: could not compile `guessing_game` due to 2 previous errors
|
||||||
To learn more, run the command again with --verbose.
|
|
||||||
|
@ -9,6 +9,5 @@ warning: unused `Result` that must be used
|
|||||||
= note: `#[warn(unused_must_use)]` on by default
|
= note: `#[warn(unused_must_use)]` on by default
|
||||||
= note: this `Result` may be an `Err` variant, which should be handled
|
= note: this `Result` may be an `Err` variant, which should be handled
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: `guessing_game` (bin "guessing_game") generated 1 warning
|
||||||
|
|
||||||
Finished dev [unoptimized + debuginfo] target(s) in 0.59s
|
Finished dev [unoptimized + debuginfo] target(s) in 0.59s
|
||||||
|
Loading…
Reference in New Issue
Block a user