I actually started writing a post saying this, but I think this error is somewhat artificial.
Notably, this works on stable:
let x: Vec<u32> = {
let mut x = Default::default();
if false {
x
} else {
x.push(0);
x
}
};
dbg!(x);
Which says to me that the inherent method restriction might just be an implementation artifact, not something foundational, and thus that a rewrite of inference might start to enable it.
After all, making the code less specific makes it compile:
let x: Vec<u32> = {
let mut x = Default::default();
Extend::extend(&mut x, [0]);
x
};
dbg!(x);
So that also makes it seem non-obvious that inherent methods need to block type inference that way.