r/rustjerk • segfault • 16d ago

why wont my program compile

Post image
359 Upvotes

33 comments sorted by

98

u/TheGhostPelican 16d ago

Missing semi line 1

31

u/Memerenok segfault 16d ago

ah fuck

2

u/RCoder01 15d ago

Just use f64::to_degrees and f64::to_radians

1

u/Memerenok segfault 15d ago

that's the boring way

actually I'm not sure that my formulas are correct

2

u/DangyDanger 15d 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.

1

u/Memerenok segfault 15d ago

it's all rust's fault

44

u/birdbrainswagtrain 16d ago • Bravo Regret Heartwarming
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 16d ago

don't cry

24

u/ALFminecraft 16d ago

not enough piss

1

u/23Link89 14d ago

too much piss

16

u/LeSaR_ 16d ago

cannot multiply {integer} by f64

14

u/nakurtag 16d ago

Is squirting necessary to compile?

8

u/verypoliticalusernam 16d 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.

8

u/drcforbin 16d ago

You have to punch the card

4

u/Daemontatox 16d ago

The compiler didn't feel enough of ypur pain just yet

4

u/armslice 9d ago

You should try to follow the DRY principle.

3

u/J8w34qgo3 16d ago

fn keyword and function calls are capitalized.

3

u/YakubReddit 16d ago

It's leaking

3

u/nevergoodenough54 15d ago

Rewrite it in machine code

3

u/jimmiebfulton 15d ago

I worked at a place where some guy would lay out on the floor and draw out designs and programs on paper. I never saw that translate to actual code, and we eventually let him go.

1

u/AnrianDayin 14d ago

I learned how to program in a high school health class by passing notes back and forth between me and a friend that knew how to code

3

u/Azra__1 15d ago

Missing semicolon on line 1 and useless return statement on line 3 and 7

2

u/SomeRandoLameo 16d ago

Wrong ide, paper is not compatible with rust

1

u/liquidivy 15d ago

Anything not set in metal cannot be trusted.

2

u/eliteenjoyer6900 16d ago

you have to swallow it next silly 🙄

2

u/Maqi-X 16d ago

println!(deg_to_rad(...)) Is invalid you need to use println!("{}", deg_to_rad(...));

2

u/scadoshi 16d ago

Have you tried crumpling it up and throwing it into the trash?

2

u/Memw1 15d ago • Mindblown

Why is there spain in the screen?

2

u/These-Touch-4044 15d ago

even if you didnt write it on paper, it would still not compile, dummy

2

u/jimmiebfulton 15d ago

it was garbage collected

2

u/ItsTheJStaff 15d ago

Your code leaks

1

u/StrawberryBrestMilk 1h ago

Wet paper doesnt compile silly

3

u/ChirpyNomad 16d ago

Needs to be wetter