Skip to content

Type unification error messages excessively mystifying #1383

Closed
@jwise

Description

@jwise

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions