Skip to content

Commit 532465b

Browse files
committed
E073[6-8] include failing code examples.
1 parent db7af2b commit 532465b

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
@@ -2237,6 +2237,16 @@ rejected in your own crates.
22372237
E0736: r##"
22382238
#[track_caller] and #[naked] cannot be applied to the same function.
22392239
2240+
Erroneous code example:
2241+
2242+
```compile_fail,E0736
2243+
#![feature(track_caller)]
2244+
2245+
#[naked]
2246+
#[track_caller]
2247+
fn foo() {}
2248+
```
2249+
22402250
This is primarily due to ABI incompatibilities between the two attributes.
22412251
See [RFC 2091] for details on this and other limitations.
22422252

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)