Error during compiling alien cake: can't compare std::ops::Range<{float}>
with std::ops::Range<{float}>
#13371
Labels
std::ops::Range<{float}>
with std::ops::Range<{float}>
#13371
Bevy version
v0.13.2
[Optional] Relevant system information
Windows 10 Home 64-bit
What you did
I copied the code from the alien cake example to the main.rs file of my project and tried cargo run. First I was missing the rand module in the dependencies (which is not described in the example or manual btw), but then also these errors show up during compiling, instead of starting the game:
Compiling bevy v0.13.2
Compiling alien_cake v0.1.0 (C:\Users\Daniel\Documents\Visual Studio 2022\Projects\alien_cake)
error[E0277]: can't compare
std::ops::Range<{float}>
withstd::ops::Range<{float}>
--> src\main.rs:132:53
|
132 | let height = rand::thread_rng().gen_range(-0.1..0.1);
| ^^^^^^^^^ no implementation for
std::ops::Range<{float}> < std::ops::Range<{float}>
andstd::ops::Range<{float}> > std::ops::Range<{float}>
|
= help: the trait
PartialOrd
is not implemented forstd::ops::Range<{float}>
note: required by a bound in
gen_range
--> C:\Users\Daniel.cargo\registry\src\index.crates.io-6f17d22bba15001f\rand-0.4.6\src\lib.rs:524:21
|
524 | fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T where Self: Sized {
| ^^^^^^^^^^ required by this bound in
Rng::gen_range
error[E0277]: the trait bound
std::ops::Range<{float}>: SampleRange
is not satisfied--> src\main.rs:132:53
|
132 | let height = rand::thread_rng().gen_range(-0.1..0.1);
| ^^^^^^^^^ the trait
SampleRange
is not implemented forstd::ops::Range<{float}>
|
= help: the following other types implement trait
SampleRange
:isize
i8
i16
i32
i64
usize
u8
u16
and 4 others
note: required by a bound in
gen_range
--> C:\Users\Daniel.cargo\registry\src\index.crates.io-6f17d22bba15001f\rand-0.4.6\src\lib.rs:524:34
|
524 | fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T where Self: Sized {
| ^^^^^^^^^^^ required by this bound in
Rng::gen_range
error[E0061]: this method takes 2 arguments but 1 argument was supplied
--> src\main.rs:132:53
|
132 | let height = rand::thread_rng().gen_range(-0.1..0.1);
| ^^^^^^^^^----------- an argument of type
std::ops::Range<{float}>
is missing|
note: method defined here
--> C:\Users\Daniel.cargo\registry\src\index.crates.io-6f17d22bba15001f\rand-0.4.6\src\lib.rs:524:8
|
524 | fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T where Self: Sized {
| ^^^^^^^^^
help: provide the argument
|
132 | let height = rand::thread_rng().gen_range(-0.1..0.1, /* high */);
| ~~~~~~~~~~~~~~~~~~~~~~~
error[E0369]: cannot subtract
{float}
fromstd::ops::Range<{float}>
--> src\main.rs:134:73
|
134 | transform: Transform::from_xyz(i as f32, height - 0.2, j as f32),
| ------ ^ --- {float}
| |
| std::ops::Range<{float}>
error[E0308]: mismatched types
--> src\main.rs:138:28
|
138 | Cell { height }
| ^^^^^^ expected
f32
, foundRange<{float}>
|
= note: expected type
f32
found struct
std::ops::Range<{float}>
error[E0061]: this method takes 2 arguments but 1 argument was supplied
--> src\main.rs:326:43
|
326 | game.bonus.i = rand::thread_rng().gen_range(0..BOARD_SIZE_I);
| ^^^^^^^^^----------------- an argument of type
usize
is missing|
note: expected
usize
, foundRange<usize>
--> src\main.rs:326:53
|
326 | game.bonus.i = rand::thread_rng().gen_range(0..BOARD_SIZE_I);
| ^^^^^^^^^^^^^^^
= note: expected type
usize
found struct
std::ops::Range<usize>
help: the return type of this call is
std::ops::Range<usize>
due to the type of the argument passed--> src\main.rs:326:24
|
326 | game.bonus.i = rand::thread_rng().gen_range(0..BOARD_SIZE_I);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^
| |
| this argument influences the return type of
gen_range
note: method defined here
--> C:\Users\Daniel.cargo\registry\src\index.crates.io-6f17d22bba15001f\rand-0.4.6\src\lib.rs:524:8
|
524 | fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T where Self: Sized {
| ^^^^^^^^^
help: provide the argument
|
326 | game.bonus.i = rand::thread_rng().gen_range(/* usize /, / usize */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0061]: this method takes 2 arguments but 1 argument was supplied
--> src\main.rs:327:43
|
327 | game.bonus.j = rand::thread_rng().gen_range(0..BOARD_SIZE_J);
| ^^^^^^^^^----------------- an argument of type
usize
is missing|
note: expected
usize
, foundRange<usize>
--> src\main.rs:327:53
|
327 | game.bonus.j = rand::thread_rng().gen_range(0..BOARD_SIZE_J);
| ^^^^^^^^^^^^^^^
= note: expected type
usize
found struct
std::ops::Range<usize>
help: the return type of this call is
std::ops::Range<usize>
due to the type of the argument passed--> src\main.rs:327:24
|
327 | game.bonus.j = rand::thread_rng().gen_range(0..BOARD_SIZE_J);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^
| |
| this argument influences the return type of
gen_range
note: method defined here
--> C:\Users\Daniel.cargo\registry\src\index.crates.io-6f17d22bba15001f\rand-0.4.6\src\lib.rs:524:8
|
524 | fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T where Self: Sized {
| ^^^^^^^^^
help: provide the argument
|
327 | game.bonus.j = rand::thread_rng().gen_range(/* usize /, / usize */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
Some errors have detailed explanations: E0061, E0277, E0308, E0369.
For more information about an error, try
rustc --explain E0061
.error: could not compile
alien_cake
(bin "alien_cake") due to 7 previous errorsc:\Users\Daniel\Documents\Visual Studio 2022\Projects\alien_cake>cargo run
Compiling alien_cake v0.1.0 (C:\Users\Daniel\Documents\Visual Studio 2022\Projects\alien_cake)
error[E0277]: can't compare
std::ops::Range<{float}>
withstd::ops::Range<{float}>
--> src\main.rs:132:53
|
132 | let height = rand::thread_rng().gen_range(-0.1..0.1);
| ^^^^^^^^^ no implementation for
std::ops::Range<{float}> < std::ops::Range<{float}>
andstd::ops::Range<{float}> > std::ops::Range<{float}>
|
= help: the trait
PartialOrd
is not implemented forstd::ops::Range<{float}>
note: required by a bound in
gen_range
--> C:\Users\Daniel.cargo\registry\src\index.crates.io-6f17d22bba15001f\rand-0.4.6\src\lib.rs:524:21
|
524 | fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T where Self: Sized {
| ^^^^^^^^^^ required by this bound in
Rng::gen_range
error[E0277]: the trait bound
std::ops::Range<{float}>: SampleRange
is not satisfied--> src\main.rs:132:53
|
132 | let height = rand::thread_rng().gen_range(-0.1..0.1);
| ^^^^^^^^^ the trait
SampleRange
is not implemented forstd::ops::Range<{float}>
|
= help: the following other types implement trait
SampleRange
:isize
i8
i16
i32
i64
usize
u8
u16
and 4 others
note: required by a bound in
gen_range
--> C:\Users\Daniel.cargo\registry\src\index.crates.io-6f17d22bba15001f\rand-0.4.6\src\lib.rs:524:34
|
524 | fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T where Self: Sized {
| ^^^^^^^^^^^ required by this bound in
Rng::gen_range
error[E0061]: this method takes 2 arguments but 1 argument was supplied
--> src\main.rs:132:53
|
132 | let height = rand::thread_rng().gen_range(-0.1..0.1);
| ^^^^^^^^^----------- an argument of type
std::ops::Range<{float}>
is missing|
note: method defined here
--> C:\Users\Daniel.cargo\registry\src\index.crates.io-6f17d22bba15001f\rand-0.4.6\src\lib.rs:524:8
|
524 | fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T where Self: Sized {
| ^^^^^^^^^
help: provide the argument
|
132 | let height = rand::thread_rng().gen_range(-0.1..0.1, /* high */);
| ~~~~~~~~~~~~~~~~~~~~~~~
error[E0369]: cannot subtract
{float}
fromstd::ops::Range<{float}>
--> src\main.rs:134:73
|
134 | transform: Transform::from_xyz(i as f32, height - 0.2, j as f32),
| ------ ^ --- {float}
| |
| std::ops::Range<{float}>
error[E0308]: mismatched types
--> src\main.rs:138:28
|
138 | Cell { height }
| ^^^^^^ expected
f32
, foundRange<{float}>
|
= note: expected type
f32
found struct
std::ops::Range<{float}>
error[E0061]: this method takes 2 arguments but 1 argument was supplied
--> src\main.rs:326:43
|
326 | game.bonus.i = rand::thread_rng().gen_range(0..BOARD_SIZE_I);
| ^^^^^^^^^----------------- an argument of type
usize
is missing|
note: expected
usize
, foundRange<usize>
--> src\main.rs:326:53
|
326 | game.bonus.i = rand::thread_rng().gen_range(0..BOARD_SIZE_I);
| ^^^^^^^^^^^^^^^
= note: expected type
usize
found struct
std::ops::Range<usize>
help: the return type of this call is
std::ops::Range<usize>
due to the type of the argument passed--> src\main.rs:326:24
|
326 | game.bonus.i = rand::thread_rng().gen_range(0..BOARD_SIZE_I);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^
| |
| this argument influences the return type of
gen_range
note: method defined here
--> C:\Users\Daniel.cargo\registry\src\index.crates.io-6f17d22bba15001f\rand-0.4.6\src\lib.rs:524:8
|
524 | fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T where Self: Sized {
| ^^^^^^^^^
help: provide the argument
|
326 | game.bonus.i = rand::thread_rng().gen_range(/* usize /, / usize */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0061]: this method takes 2 arguments but 1 argument was supplied
--> src\main.rs:327:43
|
327 | game.bonus.j = rand::thread_rng().gen_range(0..BOARD_SIZE_J);
| ^^^^^^^^^----------------- an argument of type
usize
is missing|
note: expected
usize
, foundRange<usize>
--> src\main.rs:327:53
|
327 | game.bonus.j = rand::thread_rng().gen_range(0..BOARD_SIZE_J);
| ^^^^^^^^^^^^^^^
= note: expected type
usize
found struct
std::ops::Range<usize>
help: the return type of this call is
std::ops::Range<usize>
due to the type of the argument passed--> src\main.rs:327:24
|
327 | game.bonus.j = rand::thread_rng().gen_range(0..BOARD_SIZE_J);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^
| |
| this argument influences the return type of
gen_range
note: method defined here
--> C:\Users\Daniel.cargo\registry\src\index.crates.io-6f17d22bba15001f\rand-0.4.6\src\lib.rs:524:8
|
524 | fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T where Self: Sized {
| ^^^^^^^^^
help: provide the argument
|
327 | game.bonus.j = rand::thread_rng().gen_range(/* usize /, / usize */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
Some errors have detailed explanations: E0061, E0277, E0308, E0369.
For more information about an error, try
rustc --explain E0061
.error: could not compile
alien_cake
(bin "alien_cake") due to 7 previous errorsThe text was updated successfully, but these errors were encountered: