Unhelpful error message for specialization-related type projection failures.

0c32ace
Opened by robert at 2024-04-19 14:19:50

Playground: http://is.gd/QMg2a8

  1. Maybe related to this comment: https://github.com/rust-lang/rust/blob/ffca6c3e/src/librustc/traits/project.rs#L71 and #32205?

    edit: definitely related to the comment: http://is.gd/Qjh6tB

    robert at 2016-05-07 15:51:48

  2. seems that this is by design? if so, there should be an error indicative of it.

    robert at 2016-05-07 16:12:44

  3. Current output:

    error[E0271]: type mismatch resolving `<(i32, f32) as Sameness>::Same == False`
      --> src/main.rs:49:5
       |
    40 | fn not_same<A, B>() where (A, B): NotSame {}
       |                                   ------- required by this bound in `not_same`
    ...
    49 |     not_same::<i32, f32>();
       |     ^^^^^^^^^^^^^^^^^^^^ expected associated type, found struct `False`
       |
       = note: expected associated type `<(i32, f32) as Sameness>::Same`
                           found struct `False`
       = help: consider constraining the associated type `<(i32, f32) as Sameness>::Same` to `False` or calling a method that returns `<(i32, f32) as Sameness>::Same`
       = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
       = note: required because of the requirements on the impl of `NotSame` for `(i32, f32)`
    

    Esteban Kuber at 2020-06-11 22:56:36