@@ -406,15 +406,58 @@ function `main()`. If there are multiple such functions, please rename one.
406
406
"## ,
407
407
408
408
E0137 : 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
+
409
423
This error indicates that the compiler found multiple functions with the
410
424
`#[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
+ ```
412
433
"## ,
413
434
414
435
E0138 : 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
+
415
451
This error indicates that the compiler found multiple functions with the
416
452
`#[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
+ ```
418
461
"## ,
419
462
420
463
// 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.
495
538
"## ,
496
539
497
540
E0152 : 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
+
498
552
Lang items are already implemented in the standard library. Unless you are
499
553
writing a free-standing application (e.g. a kernel), you do not need to provide
500
554
them yourself.
0 commit comments