mutably borrowed Type Alias incorrectly marked as immutable
this is a weird one. When asserting the type of the length of an array with as usize a bug occurs where passing a variable that is &mut Alias into a function that take &Alias marks that variable as immutable.
This does not happen when the type alias is changed to type ArrayAlias = [u16; 8];
type ArrayAlias = [u16; 8 as usize];
fn main() {}
fn produce_error(array: &mut ArrayAlias) {
mark_register_immutable(array);
array[0] = 5; // cannot mutate immutable variable `array`
}
fn mark_register_immutable(_: &ArrayAlias){
}
We don't correctly lower the array size with that expr, that might be the cause. However we shouldn't do borrow checking when there are error types, so this is weird.
@shyguy1412 which version of the rust analyzer are you using?
I updated both my stable toolchain as well as my unstable toolchain and i do not get this error message.
Editor: vnim rust-analyzer versions i tried are stable: ed61e7d7e 2025-11-07 nightly: 1d60f9e 2025-12-01
I'm using the vscode extension at version 0.3.2711