Skip to content

Commit 075ea13

Browse files
Rollup merge of #33912 - GuillaumeGomez:improve_E0132, r=steveklabnik
Improve E0132 error explanation r? @steveklabnik
2 parents 48245ae + a850d40 commit 075ea13

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/librustc_typeck/diagnostics.rs

+24-1
Original file line numberDiff line numberDiff line change
@@ -1864,12 +1864,35 @@ fn main<T>() { // error: main function is not allowed to have type parameters
18641864
"##,
18651865

18661866
E0132: r##"
1867+
A function with the `start` attribute was declared with type parameters.
1868+
1869+
Erroneous code example:
1870+
1871+
```compile_fail
1872+
#![feature(start)]
1873+
1874+
#[start]
1875+
fn f<T>() {}
1876+
```
1877+
18671878
It is not possible to declare type parameters on a function that has the `start`
1868-
attribute. Such a function must have the following type signature:
1879+
attribute. Such a function must have the following type signature (for more
1880+
information: http://doc.rust-lang.org/stable/book/no-stdlib.html):
18691881
18701882
```ignore
18711883
fn(isize, *const *const u8) -> isize;
18721884
```
1885+
1886+
Example:
1887+
1888+
```
1889+
#![feature(start)]
1890+
1891+
#[start]
1892+
fn my_start(argc: isize, argv: *const *const u8) -> isize {
1893+
0
1894+
}
1895+
```
18731896
"##,
18741897

18751898
E0163: r##"

0 commit comments

Comments
 (0)