@@ -406,15 +406,58 @@ function `main()`. If there are multiple such functions, please rename one.
406406"## ,
407407
408408E0137 : r##"
409+ More than one function was declared with the `#[main]` attribute.
410+
411+ Erroneous code example:
412+
413+ ```compile_fail
414+ #![feature(main)]
415+
416+ #[main]
417+ fn foo() {}
418+
419+ #[main]
420+ fn f() {} // error: multiple functions with a #[main] attribute
421+ ```
422+
409423This error indicates that the compiler found multiple functions with the
410424`#[main]` attribute. This is an error because there must be a unique entry
411- point into a Rust program.
425+ point into a Rust program. Example:
426+
427+ ```
428+ #![feature(main)]
429+
430+ #[main]
431+ fn f() {} // ok!
432+ ```
412433"## ,
413434
414435E0138 : r##"
436+ More than one function was declared with the `#[start]` attribute.
437+
438+ Erroneous code example:
439+
440+ ```compile_fail
441+ #![feature(start)]
442+
443+ #[start]
444+ fn foo(argc: isize, argv: *const *const u8) -> isize {}
445+
446+ #[start]
447+ fn f(argc: isize, argv: *const *const u8) -> isize {}
448+ // error: multiple 'start' functions
449+ ```
450+
415451This error indicates that the compiler found multiple functions with the
416452`#[start]` attribute. This is an error because there must be a unique entry
417- point into a Rust program.
453+ point into a Rust program. Example:
454+
455+ ```
456+ #![feature(start)]
457+
458+ #[start]
459+ fn foo(argc: isize, argv: *const *const u8) -> isize { 0 } // ok!
460+ ```
418461"## ,
419462
420463// FIXME link this to the relevant turpl chapters for instilling fear of the
@@ -495,6 +538,17 @@ call to `mem::forget(v)` in case you want to avoid destructors being called.
495538"## ,
496539
497540E0152 : r##"
541+ A lang item was redefined.
542+
543+ Erroneous code example:
544+
545+ ```compile_fail
546+ #![feature(lang_items)]
547+
548+ #[lang = "panic_fmt"]
549+ struct Foo; // error: duplicate lang item found: `panic_fmt`
550+ ```
551+
498552Lang items are already implemented in the standard library. Unless you are
499553writing a free-standing application (e.g. a kernel), you do not need to provide
500554them yourself.
0 commit comments