Error codes

E0105: shape used where a type is expected, or a type where a shape is expected

In a terminal: auk explain E0105 prints this page.

On this page

A shape (like Show or Ord) is a type only in a function signature, where it means "some type that fits". Elsewhere a value of any fitting type is written any Show. Conversely, a bound or any needs a shape, not a concrete type.

Wrong#

auk
fn main() {
  let v: Show = 1
  print(v.show())
}

Fixed#

auk
fn main() {
  let v: any Show = 1
  print(v.show())
}

Common causes#

  • Using a shape as a variable or field type: write any Show.
  • A struct type used as a generic bound: fn f<T: Point>(...).

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page