rust-lang / rust-lang/rust-by-example

5.1 results of the Casting chapter are not correct

Open
#1,646 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Handlebars
Stars
8.1k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

https://github.com/rust-lang/rust-by-example/blob/687a1c32ef783f3ab2cbf1d0e7c707c53283f2c6/src/types/cast.md?plain=1#L83-L84

cargo version

cargo 1.65.0 (4bc8f24d3 2022-10-20)

on mac m1

-100.0 as u8 is 0

on linux x86_64

-100.0 as u8 is 156

Execution on my mac mini m1 machine prints 0 instead of 156, but my execution on the linux x86_64 machine does return 156.
What caused the different execution results?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/types/cast.md at lines 83–84 and run the example using Cargo 1.65 on macOS M1 and Linux x86_64. Compare the platform-specific output for -100.0 as u8 and determine whether the example or its explanation needs correction so the documented result matches supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.