thunk errors point at the signature, not at the callee

Author: zygoloidCreated May 13, 2026Updated Sep 17, 2026
Labelsinactive

Example:

interface I {
  fn F(n: i32);
}

impl () as I {
  fn F(n: i16) {}
}

produces

<source>:2:8: error: cannot implicitly convert expression of type `i32` to `i16`
  fn F(n: i32);
       ^~~~~~
<source>:2:8: note: type `i32` does not implement interface `Core.ImplicitAs(i16)`
  fn F(n: i32);
       ^~~~~~
<source>:6:8: note: initializing function parameter
  fn F(n: i16) {}
       ^~~~~~
<source>:2:3: note: while building thunk to match the signature of this function
  fn F(n: i32);
  ^~~~~~~~~~~~~

Note that the primary error points to the declaration in the interface. It would be more helpful if the primary location of the error message pointed at the callee of the thunk.

Source: carbon-language/carbon-lang