Skip to content

Commit bdc4bd1

Browse files
committed
E073[6-8] include failing code examples.
1 parent 8992c30 commit bdc4bd1

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

src/librustc/error_codes.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,16 @@ rejected in your own crates.
20782078
E0736: r##"
20792079
#[track_caller] and #[naked] cannot be applied to the same function.
20802080
2081+
Erroneous code example:
2082+
2083+
```compile_fail,E0736
2084+
#![feature(track_caller)]
2085+
2086+
#[naked]
2087+
#[track_caller]
2088+
fn foo() {}
2089+
```
2090+
20812091
This is primarily due to ABI incompatibilities between the two attributes.
20822092
See [RFC 2091] for details on this and other limitations.
20832093

src/librustc_typeck/error_codes.rs

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4909,15 +4909,44 @@ and the pin is required to keep it in the same place in memory.
49094909
"##,
49104910

49114911
E0737: r##"
4912-
#[track_caller] requires functions to have the "Rust" ABI for passing caller
4913-
location. See [RFC 2091] for details on this and other restrictions.
4912+
#[track_caller] requires functions to have the "Rust" ABI for implicitly
4913+
receiving caller location. See [RFC 2091] for details on this and other
4914+
restrictions.
4915+
4916+
Erroneous code example:
4917+
4918+
```compile_fail,E0737
4919+
#![feature(track_caller)]
4920+
4921+
#[track_caller]
4922+
extern "C" fn foo() {}
4923+
```
49144924
49154925
[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
49164926
"##,
49174927

49184928
E0738: r##"
4919-
#[track_caller] cannot be applied to trait methods. See [RFC 2091]
4920-
for details on this and other restrictions.
4929+
#[track_caller] cannot be applied to trait methods.
4930+
4931+
This is due to limitations in the compiler which are likely to be temporary.
4932+
See [RFC 2091] for details on this and other restrictions.
4933+
4934+
Erroneous code example:
4935+
4936+
```compile_fail,E0738
4937+
#![feature(track_caller)]
4938+
4939+
trait Foo {
4940+
fn bar(&self);
4941+
}
4942+
4943+
struct Bar;
4944+
4945+
impl Foo for Bar {
4946+
#[track_caller]
4947+
fn bar(&self) {}
4948+
}
4949+
```
49214950
49224951
[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
49234952
"##,

0 commit comments

Comments
 (0)