Skip to content

Commit

Permalink
Explain implicit casts for literals
Browse files Browse the repository at this point in the history
  • Loading branch information
virgil-serbanuta committed Aug 27, 2024
1 parent 9a93bc2 commit b501c71
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,19 @@ We will ignore: use declaratios, some attributes and macros.
We will not handle: extern crates, functions, type aliases,
enumerations, unions, static items, external blocks.

Int literals and casts
----------------------

Int literal [type determination](https://doc.rust-lang.org/stable/reference/expressions/literal-expr.html#integer-literal-expressions)

We will not implement explicit casts. However, int literals with a default type
are special in that they have some implicit casts determined by the context.

To implement that, we will follow the algorithm in the link above, converting
everything to `u128`, then we will do a conversion on the spot if something
else is required. This should mostly work, since we are relying on the Rust
compiler to check that int types are properly used.

Other things not discussed elsewhere
------------------------------------

Expand Down

0 comments on commit b501c71

Please sign in to comment.