I've read that Rust has very good type inference using Hindley-Milner. Rust also has mutable variables and AFAIK there must be some constraints when a HM algorithm works with mutability because it could over-generalize. The following code:

```
let mut a;
a = 3;
a = 2.5;

```

Does not compile, because at the second row integer was inferred and a floating point value cannot be assigned to an integer variable. So I'm guessing that for simple variables, as soon as a non-generic type is inferred, the variable becomes a mono-type and cannot be generalized anymore.

But what about a template, like Vec? For example this code:

```
let mut v;
v = Vec::new();
v.push(3);
v.push(2.3);

```

This fails again, but for the last line again. That means that the second row inferred the type partially (Vec) and the third one inferred the container type.

What's the rule? Is there something like value-restriction that I don't know about? Or am I over-complicating things and Rust has much tighter rules (like no generalization at all)?