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 #[rustc_safe_intrinsic]
11 fn size_of<T>(); // error: intrinsic has wrong type
16 fn main() -> i32 { 0 }
17 // error: main function expects type: `fn() {main}`: expected (), found i32
24 // error: mismatched types in range: expected u8, found i8
34 fn x(self: Rc<Foo>) {}
35 // error: mismatched self type: expected `Foo`: expected struct
36 // `Foo`, found struct `alloc::rc::Rc`
40 For the first code example, please check the function definition. Example:
43 #![feature(intrinsics)]
45 extern "rust-intrinsic" {
46 #[rustc_safe_intrinsic]
47 fn size_of<T>() -> usize; // ok!
51 The second case example is a bit particular: the main function must always
58 They never take parameters and never return types.
60 For the third example, when you match, all patterns must have the same type
61 as the type you're matching on. Example:
67 0u8..=3u8 => (), // ok!
72 And finally, for the last example, only `Box<Self>`, `&Self`, `Self`,
73 or `&mut Self` work as explicit self parameters. Example:
79 fn x(self: Box<Foo>) {} // ok!