Skip to content

Commit 360d723

Browse files
Improve E0138 error explanation
1 parent a1e240c commit 360d723

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/librustc/diagnostics.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,32 @@ fn f() {} // ok!
419419
"##,
420420

421421
E0138: r##"
422+
More than one function was declared with the `#[start]` attribute.
423+
424+
Erroneous code example:
425+
426+
```compile_fail
427+
#![feature(start)]
428+
429+
#[start]
430+
fn foo(argc: isize, argv: *const *const u8) -> isize {}
431+
432+
#[start]
433+
fn f(argc: isize, argv: *const *const u8) -> isize {}
434+
// error: multiple 'start' functions
435+
```
436+
422437
This error indicates that the compiler found multiple functions with the
423438
`#[start]` attribute. This is an error because there must be a unique entry
424-
point into a Rust program.
439+
point into a Rust program. Example:
440+
441+
442+
```
443+
#![feature(start)]
444+
445+
#[start]
446+
fn foo(argc: isize, argv: *const *const u8) -> isize {} // ok!
447+
```
425448
"##,
426449

427450
// FIXME link this to the relevant turpl chapters for instilling fear of the

0 commit comments

Comments
 (0)