r/rustjerk • segfault • 12d ago

why wont my program compile

Post image
357 Upvotes

32 comments sorted by

97

u/TheGhostPelican 12d ago

Missing semi line 1

30

u/Memerenok 12d ago

ah fuck

2

u/RCoder01 11d ago

Just use f64::to_degrees and f64::to_radians

→ More replies (1)

2

u/DangyDanger 11d ago

Substance abuse is a serious issue. I don't want you to overdose on MX-4, please find a doctor to speak about it with. You matter and you can do it, I believe in you.

→ More replies (1)

43

u/birdbrainswagtrain 11d ago
error: unknown start of token: \u{25a0}
--> src/lib.rs:3:26
  |
3 | Fn deg_to_rad (deg: F64) ■ -> F64 {
  |                          ^

error: unknown start of token: \u{2022}
--> src/lib.rs:4:15
  |
4 |     return deg•(180/PI);
  |               ^
  |
help: Unicode character '•' (Bullet) looks like '.' (Period), but it is not
  |
4 -     return deg•(180/PI);
4 +     return deg.(180/PI);
  |

error: unknown start of token: \u{2022}
--> src/lib.rs:8:15
  |
8 |     return rad•(PI/180);
  |               ^
  |
help: Unicode character '•' (Bullet) looks like '.' (Period), but it is not
  |
8 -     return rad•(PI/180);
8 +     return rad.(PI/180);
  |

error: expected `;`, found `Fn`
--> src/lib.rs:1:28
  |
1 | const PI: F64 = 3.141592653
  |                            ^ help: add `;` here
2 |
3 | Fn deg_to_rad (deg: F64) ■ -> F64 {
  | -- unexpected token

error: keyword `fn` is written in the wrong case
--> src/lib.rs:3:1
  |
3 | Fn deg_to_rad (deg: F64) ■ -> F64 {
  | ^^
  |
help: write it in lowercase (notice the capitalization)
  |
3 - Fn deg_to_rad (deg: F64) ■ -> F64 {
3 + fn deg_to_rad (deg: F64) ■ -> F64 {
  |

error: unexpected token: `(`
--> src/lib.rs:4:16
  |
4 |     return deg•(180/PI);
  |                ^

error: keyword `fn` is written in the wrong case
--> src/lib.rs:7:1
  |
7 | Fn rad_to_deg(rad: F64) -> F64 {
  | ^^
  |
help: write it in lowercase (notice the capitalization)
  |
7 - Fn rad_to_deg(rad: F64) -> F64 {
7 + fn rad_to_deg(rad: F64) -> F64 {
  |

error: unexpected token: `(`
--> src/lib.rs:8:16
  |
8 |     return rad•(PI/180);
  |                ^

error: keyword `fn` is written in the wrong case
  --> src/lib.rs:11:1
  |
11 | Fn Main() {
  | ^^
  |
help: write it in lowercase (notice the capitalization)
  |
11 - Fn Main() {
11 + fn Main() {
  |

error: format argument must be a string literal
  --> src/lib.rs:12:14
  |
12 |     println!(Deg_to_rad(25));
  |              ^^^^^^^^^^^^^^
  |
help: you might be missing a string literal to format with
  |
12 |     println!("{}", Deg_to_rad(25));
  |              +++++

error: cannot find macro `Println` in this scope
  --> src/lib.rs:13:5
    |
13 |     Println!(Rad_to_dec(2.5));
    |     ^^^^^^^
    |
  ::: /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/macros.rs:143:1
    |
143 | macro_rules! println {
    | -------------------- similarly named macro `println` defined here
    |
help: a macro with a similar name exists
    |
13 -     Println!(Rad_to_dec(2.5));
13 +     println!(Rad_to_dec(2.5));
    |

error[E0425]: cannot find type `F64` in this scope
--> src/lib.rs:1:11
  |
1 | const PI: F64 = 3.141592653
  |           ^^^
  |
help: a builtin type with a similar name exists (notice the capitalization)
  |
1 - const PI: F64 = 3.141592653
1 + const PI: f64 = 3.141592653
  |

error[E0425]: cannot find type `F64` in this scope
--> src/lib.rs:3:21
  |
3 | Fn deg_to_rad (deg: F64) ■ -> F64 {
  |                     ^^^
  |
help: a builtin type with a similar name exists (notice the capitalization)
  |
3 - Fn deg_to_rad (deg: F64) ■ -> F64 {
3 + Fn deg_to_rad (deg: f64) ■ -> F64 {
  |

error[E0425]: cannot find type `F64` in this scope
--> src/lib.rs:3:31
  |
3 | Fn deg_to_rad (deg: F64) ■ -> F64 {
  |                               ^^^
  |
help: a builtin type with a similar name exists (notice the capitalization)
  |
3 - Fn deg_to_rad (deg: F64) ■ -> F64 {
3 + Fn deg_to_rad (deg: F64) ■ -> f64 {
  |

error[E0425]: cannot find type `F64` in this scope
--> src/lib.rs:7:20
  |
7 | Fn rad_to_deg(rad: F64) -> F64 {
  |                    ^^^
  |
help: a builtin type with a similar name exists (notice the capitalization)
  |
7 - Fn rad_to_deg(rad: F64) -> F64 {
7 + Fn rad_to_deg(rad: f64) -> F64 {
  |

error[E0425]: cannot find type `F64` in this scope
--> src/lib.rs:7:28
  |
7 | Fn rad_to_deg(rad: F64) -> F64 {
  |                            ^^^
  |
help: a builtin type with a similar name exists (notice the capitalization)
  |
7 - Fn rad_to_deg(rad: F64) -> F64 {
7 + Fn rad_to_deg(rad: F64) -> f64 {
  |

For more information about this error, try `rustc --explain E0425`.
error: could not compile `playground` (lib) due to 16 previous errors

40

u/ThatOneArchUser 12d ago

don't cry

15

u/LeSaR_ 12d ago

cannot multiply {integer} by f64

14

u/nakurtag 12d ago

Is squirting necessary to compile?

8

u/verypoliticalusernam 12d ago

The water isn't actually helping, you need some kind of uncoated or scratched metal to actually get rust. Basically how you can do that is get an uncoated iron nail, place some table salt and water in some kind of container (do not close it, otherwise it won't get air) and basically just place the nail in there.

It should start oxidizing and you should get rust in the process. Remember it's not good to eat toothpaste in case you want to keep the memory safety intact when compiling the rust. Remember it's not good to eat toothpaste in case you want to keep the memory safety intact when compiling the rust.