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#
fn main() {
let v: Show = 1
print(v.show())
}Fixed#
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>(...).