1 #### Note: this error code is no longer emitted by the compiler.
3 You used a function or type which doesn't fit the requirements for where it was
4 used. Erroneous code examples:
7 #![feature(intrinsics)]
9 extern "rust-intrinsic" {
10 fn size_of<T>(); // error: intrinsic has wrong type
15 fn main() -> i32 { 0 }
16 // error: main function expects type: `fn() {main}`: expected (), found i32
23 // error: mismatched types in range: expected u8, found i8
33 fn x(self: Rc<Foo>) {}
34 // error: mismatched self type: expected `Foo`: expected struct
35 // `Foo`, found struct `alloc::rc::Rc`
39 For the first code example, please check the function definition. Example:
42 #![feature(intrinsics)]
44 extern "rust-intrinsic" {
45 fn size_of<T>() -> usize; // ok!
49 The second case example is a bit particular: the main function must always
56 They never take parameters and never return types.
58 For the third example, when you match, all patterns must have the same type
59 as the type you're matching on. Example:
65 0u8..=3u8 => (), // ok!
70 And finally, for the last example, only `Box<Self>`, `&Self`, `Self`,
71 or `&mut Self` work as explicit self parameters. Example:
77 fn x(self: Box<Foo>) {} // ok!