From b501c711a71767c056b472922bd9745199d27832 Mon Sep 17 00:00:00 2001 From: Virgil Date: Tue, 27 Aug 2024 15:53:55 +0300 Subject: [PATCH] Explain implicit casts for literals --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index a672291..15c1d7a 100644 --- a/README.md +++ b/README.md @@ -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 ------------------------------------