@@ -466,66 +466,6 @@ fn main() {
466466```
467467"## ,
468468
469- // This shouldn't really ever trigger since the repeated value error comes first
470- E0136 : r##"
471- A binary can only have one entry point, and by default that entry point is the
472- function `main()`. If there are multiple such functions, please rename one.
473- "## ,
474-
475- E0137 : r##"
476- More than one function was declared with the `#[main]` attribute.
477-
478- Erroneous code example:
479-
480- ```compile_fail,E0137
481- #![feature(main)]
482-
483- #[main]
484- fn foo() {}
485-
486- #[main]
487- fn f() {} // error: multiple functions with a `#[main]` attribute
488- ```
489-
490- This error indicates that the compiler found multiple functions with the
491- `#[main]` attribute. This is an error because there must be a unique entry
492- point into a Rust program. Example:
493-
494- ```
495- #![feature(main)]
496-
497- #[main]
498- fn f() {} // ok!
499- ```
500- "## ,
501-
502- E0138 : r##"
503- More than one function was declared with the `#[start]` attribute.
504-
505- Erroneous code example:
506-
507- ```compile_fail,E0138
508- #![feature(start)]
509-
510- #[start]
511- fn foo(argc: isize, argv: *const *const u8) -> isize {}
512-
513- #[start]
514- fn f(argc: isize, argv: *const *const u8) -> isize {}
515- // error: multiple 'start' functions
516- ```
517-
518- This error indicates that the compiler found multiple functions with the
519- `#[start]` attribute. This is an error because there must be a unique entry
520- point into a Rust program. Example:
521-
522- ```
523- #![feature(start)]
524-
525- #[start]
526- fn foo(argc: isize, argv: *const *const u8) -> isize { 0 } // ok!
527- ```
528- "## ,
529469
530470E0139 : r##"
531471#### Note: this error code is no longer emitted by the compiler.
@@ -1626,33 +1566,6 @@ It is not possible to use stability attributes outside of the standard library.
16261566Also, for now, it is not possible to write deprecation messages either.
16271567"## ,
16281568
1629- E0512 : r##"
1630- Transmute with two differently sized types was attempted. Erroneous code
1631- example:
1632-
1633- ```compile_fail,E0512
1634- fn takes_u8(_: u8) {}
1635-
1636- fn main() {
1637- unsafe { takes_u8(::std::mem::transmute(0u16)); }
1638- // error: cannot transmute between types of different sizes,
1639- // or dependently-sized types
1640- }
1641- ```
1642-
1643- Please use types with same size or use the expected type directly. Example:
1644-
1645- ```
1646- fn takes_u8(_: u8) {}
1647-
1648- fn main() {
1649- unsafe { takes_u8(::std::mem::transmute(0i8)); } // ok!
1650- // or:
1651- unsafe { takes_u8(0u8); } // ok!
1652- }
1653- ```
1654- "## ,
1655-
16561569E0517 : r##"
16571570This error indicates that a `#[repr(..)]` attribute was placed on an
16581571unsupported item.
@@ -1847,84 +1760,6 @@ See [RFC 1522] for more details.
18471760[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md
18481761"## ,
18491762
1850- E0591 : r##"
1851- Per [RFC 401][rfc401], if you have a function declaration `foo`:
1852-
1853- ```
1854- // For the purposes of this explanation, all of these
1855- // different kinds of `fn` declarations are equivalent:
1856- struct S;
1857- fn foo(x: S) { /* ... */ }
1858- # #[cfg(for_demonstration_only)]
1859- extern "C" { fn foo(x: S); }
1860- # #[cfg(for_demonstration_only)]
1861- impl S { fn foo(self) { /* ... */ } }
1862- ```
1863-
1864- the type of `foo` is **not** `fn(S)`, as one might expect.
1865- Rather, it is a unique, zero-sized marker type written here as `typeof(foo)`.
1866- However, `typeof(foo)` can be _coerced_ to a function pointer `fn(S)`,
1867- so you rarely notice this:
1868-
1869- ```
1870- # struct S;
1871- # fn foo(_: S) {}
1872- let x: fn(S) = foo; // OK, coerces
1873- ```
1874-
1875- The reason that this matter is that the type `fn(S)` is not specific to
1876- any particular function: it's a function _pointer_. So calling `x()` results
1877- in a virtual call, whereas `foo()` is statically dispatched, because the type
1878- of `foo` tells us precisely what function is being called.
1879-
1880- As noted above, coercions mean that most code doesn't have to be
1881- concerned with this distinction. However, you can tell the difference
1882- when using **transmute** to convert a fn item into a fn pointer.
1883-
1884- This is sometimes done as part of an FFI:
1885-
1886- ```compile_fail,E0591
1887- extern "C" fn foo(userdata: Box<i32>) {
1888- /* ... */
1889- }
1890-
1891- # fn callback(_: extern "C" fn(*mut i32)) {}
1892- # use std::mem::transmute;
1893- # unsafe {
1894- let f: extern "C" fn(*mut i32) = transmute(foo);
1895- callback(f);
1896- # }
1897- ```
1898-
1899- Here, transmute is being used to convert the types of the fn arguments.
1900- This pattern is incorrect because, because the type of `foo` is a function
1901- **item** (`typeof(foo)`), which is zero-sized, and the target type (`fn()`)
1902- is a function pointer, which is not zero-sized.
1903- This pattern should be rewritten. There are a few possible ways to do this:
1904-
1905- - change the original fn declaration to match the expected signature,
1906- and do the cast in the fn body (the preferred option)
1907- - cast the fn item fo a fn pointer before calling transmute, as shown here:
1908-
1909- ```
1910- # extern "C" fn foo(_: Box<i32>) {}
1911- # use std::mem::transmute;
1912- # unsafe {
1913- let f: extern "C" fn(*mut i32) = transmute(foo as extern "C" fn(_));
1914- let f: extern "C" fn(*mut i32) = transmute(foo as usize); // works too
1915- # }
1916- ```
1917-
1918- The same applies to transmutes to `*mut fn()`, which were observed in practice.
1919- Note though that use of this type is generally incorrect.
1920- The intention is typically to describe a function pointer, but just `fn()`
1921- alone suffices for that. `*mut fn()` is a pointer to a fn pointer.
1922- (Since these values are typically just passed to C code, however, this rarely
1923- makes a difference in practice.)
1924-
1925- [rfc401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md
1926- "## ,
1927-
19281763E0593 : r##"
19291764You tried to supply an `Fn`-based type with an incorrect number of arguments
19301765than what was expected.
@@ -1941,21 +1776,6 @@ fn main() {
19411776```
19421777"## ,
19431778
1944- E0601 : r##"
1945- No `main` function was found in a binary crate. To fix this error, add a
1946- `main` function. For example:
1947-
1948- ```
1949- fn main() {
1950- // Your program will start here.
1951- println!("Hello world!");
1952- }
1953- ```
1954-
1955- If you don't know the basics of Rust, you can go look to the Rust Book to get
1956- started: https://doc.rust-lang.org/book/
1957- "## ,
1958-
19591779E0602 : r##"
19601780An unknown lint was used on the command line.
19611781
0 commit comments