graydon/rust — Issue #1383: Type unification error messages excessively mystifying
Author: jwise
Created: 2011-12-25 08:59:25+00:00
State: open

Rust is rapidly gaining a very expressive type and kind system for pointers, but the errors seem to be decreasingly clear; for instance, I came across the following errors today when updating some code:

```
./fftw.rs:52:8: 52:25 error: mismatched types: expected *mX5 but found *R[r=MFi=MF] (vectors differ in mutability)
./fftw.rs:52 mem as *complex64,
^~~~~~~~~~~~~~~~~
./fftw.rs:71:45: 71:75 error: mismatched types: expected *R[r=MFi=MF] but found *mR[r=MFi=MF] (vectors differ in mutability)
./fftw.rs:71 let p = fftw_native::fftw_plan_dft_1d(n, unsafe { std::c_vec::ptr(in) }, unsafe { std::c_vec::ptr(out) }, sign, flags);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

These errors have the apparent clarity of, well, mud. Or SML/NJ errors. Not sure which is worse.

We should consider enhancing the error prettyprinter before these errors get too badly out of hand.