<p dir="auto">The places I'd expect to get warnings are indicated by the comments in this example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fn main() {
    let a: u8 = 1000;
    let b = 1000u8;
    let c = 1000 as u8; // NO WARNING !!!

    let one: u8 = 1;
    let d = (one * 1000) as u32;
    let e = (one *   -1) as u32; // NO WARNING !!!
    let f = (one * -255) as u32; // NO WARNING !!!
    let g = (one * -256) as u32;

    println!(&quot;{}, {}, {}, {}, {}, {}, {}&quot;, a, b, c, d, e, f, g);
}"><pre class="notranslate"><code class="notranslate">fn main() {
    let a: u8 = 1000;
    let b = 1000u8;
    let c = 1000 as u8; // NO WARNING !!!

    let one: u8 = 1;
    let d = (one * 1000) as u32;
    let e = (one *   -1) as u32; // NO WARNING !!!
    let f = (one * -255) as u32; // NO WARNING !!!
    let g = (one * -256) as u32;

    println!("{}, {}, {}, {}, {}, {}, {}", a, b, c, d, e, f, g);
}
</code></pre></div>
<p dir="auto">Here's the compiler output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="warning: literal out of range for its type, #[warn(type_overflow)] on by default
let a: u8 = 1000;
            ^~~~
warning: literal out of range for its type, #[warn(type_overflow)] on by default
let b = 1000u8;
        ^~~~~~
warning: literal out of range for its type, #[warn(type_overflow)] on by default
let d = (one * 1000) as u32;
               ^~~~
warning: literal out of range for its type, #[warn(type_overflow)] on by default
let g = (one * -256) as u32;
                ^~~"><pre class="notranslate"><code class="notranslate">warning: literal out of range for its type, #[warn(type_overflow)] on by default
let a: u8 = 1000;
            ^~~~
warning: literal out of range for its type, #[warn(type_overflow)] on by default
let b = 1000u8;
        ^~~~~~
warning: literal out of range for its type, #[warn(type_overflow)] on by default
let d = (one * 1000) as u32;
               ^~~~
warning: literal out of range for its type, #[warn(type_overflow)] on by default
let g = (one * -256) as u32;
                ^~~
</code></pre></div>
<p dir="auto">And here's the program output:<br>
<code class="notranslate">232, 232, 232, 232, 255, 1, 0</code></p>
<p dir="auto">The compiler should show a warning message when is used a negative number into a like-uint type</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let n: u8 = -1;
println!(&quot;{}&quot;, n); // =&gt; 255"><pre class="notranslate"><span class="pl-k">let</span> n<span class="pl-kos">:</span> <span class="pl-smi">u8</span> = -<span class="pl-c1">1</span><span class="pl-kos">;</span>
<span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{}"</span>, n<span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// =&gt; 255</span></pre></div>