diff options
| author | Adam Perry <adam.n.perry@gmail.com> | 2019-10-04 14:19:05 -0700 |
|---|---|---|
| committer | Adam Perry <adam.n.perry@gmail.com> | 2019-10-07 08:05:33 -0700 |
| commit | bdc4bd142b3a452d5e7456cf30e9fc67106ec01b (patch) | |
| tree | d55a8058b68726bb230b3cfa7ec404238f2a4b7f | |
| parent | 8992c30db41ceda8eb07c36080f2f1926013c2ac (diff) | |
| download | rust-bdc4bd142b3a452d5e7456cf30e9fc67106ec01b.tar.gz rust-bdc4bd142b3a452d5e7456cf30e9fc67106ec01b.zip | |
E073[6-8] include failing code examples.
| -rw-r--r-- | src/librustc/error_codes.rs | 10 | ||||
| -rw-r--r-- | src/librustc_typeck/error_codes.rs | 37 |
2 files changed, 43 insertions, 4 deletions
diff --git a/src/librustc/error_codes.rs b/src/librustc/error_codes.rs index 8bc472aa028..e3ef58a0f81 100644 --- a/src/librustc/error_codes.rs +++ b/src/librustc/error_codes.rs @@ -2078,6 +2078,16 @@ rejected in your own crates. E0736: r##" #[track_caller] and #[naked] cannot be applied to the same function. +Erroneous code example: + +```compile_fail,E0736 +#![feature(track_caller)] + +#[naked] +#[track_caller] +fn foo() {} +``` + This is primarily due to ABI incompatibilities between the two attributes. See [RFC 2091] for details on this and other limitations. diff --git a/src/librustc_typeck/error_codes.rs b/src/librustc_typeck/error_codes.rs index be1e34661fd..1fb5b592616 100644 --- a/src/librustc_typeck/error_codes.rs +++ b/src/librustc_typeck/error_codes.rs @@ -4909,15 +4909,44 @@ and the pin is required to keep it in the same place in memory. "##, E0737: r##" -#[track_caller] requires functions to have the "Rust" ABI for passing caller -location. See [RFC 2091] for details on this and other restrictions. +#[track_caller] requires functions to have the "Rust" ABI for implicitly +receiving caller location. See [RFC 2091] for details on this and other +restrictions. + +Erroneous code example: + +```compile_fail,E0737 +#![feature(track_caller)] + +#[track_caller] +extern "C" fn foo() {} +``` [RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md "##, E0738: r##" -#[track_caller] cannot be applied to trait methods. See [RFC 2091] -for details on this and other restrictions. +#[track_caller] cannot be applied to trait methods. + +This is due to limitations in the compiler which are likely to be temporary. +See [RFC 2091] for details on this and other restrictions. + +Erroneous code example: + +```compile_fail,E0738 +#![feature(track_caller)] + +trait Foo { + fn bar(&self); +} + +struct Bar; + +impl Foo for Bar { + #[track_caller] + fn bar(&self) {} +} +``` [RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md "##, |
