Newbie question about possible wrong compiler errors

I've just started learning Rust, reading the Rust book, and playing around with the examples. I've run into what looks like a very minor bug in the compiler. A single error triggers some extra error messages which I think are incorrect.
Compare this, which compiles fine:

with this, where I've just uncommented the last 2 lines:

and it gives error messages for lines 18 and 21, which were fine before (as well as a correct error message about line 26).

  1. Is this actually a bug? I'm not sure, since I've just started learning Rust, and haven't actually read the chapter about traits yet (just read the docs and tried to rely on my intuition from other languages I know).
  2. If it is a bug, is this even worth opening an issue about?

The root of the problem is that your function is defined as having both arguments the same type T:

fn make_rec<T>(h_ : T, w_ : T)

but you're calling it with two different types - u8 and i8:

Rectangle::make_rec(1 as u8, 2 as i8);

so there's no way to satisfy T == u8 == i8, and this makes the compiler unable to figure out the types for the function.

That's OK, that error is fine.
The problem is, why is the wrong version of the code also giving three spurious error messages?

Handling of integers of unknown type (called {integer} in the error message) is special, and these errors are probably unintentional.

My guess is that the type error makes the compiler abort type inference early, before figuring out actual types for the integer constants.

BTW, 1 as f64 can be written shorter as 1f64 or 1.

I see. So I think this bug report is worth opening, possibly with a minimized example.

Here's a minimal example

fn main() {
	let a: u8 = 2 as i8;
	let b = 5 as f64;

and there's already a recent issue about this

Thank you all for you help!
I was going to write a minimal example but nemo157 beat me to it :slight_smile: and also found the existing issue.