about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorAdam Perry <adam.n.perry@gmail.com>2020-02-17 15:36:36 -0800
committerAdam Perry <lol@anp.lol>2020-03-22 17:21:18 -0700
commit97da6dae41dc7fe5597c2cd858b1ac86548cec16 (patch)
tree25417acf07350289a3f603b5cac4d8a8a77a99cb /src/librustc_error_codes/error_codes
parentd1e81ef234ff5c2e0e3a69cb4e8e5f5b0fe1fd83 (diff)
downloadrust-97da6dae41dc7fe5597c2cd858b1ac86548cec16.tar.gz
rust-97da6dae41dc7fe5597c2cd858b1ac86548cec16.zip
Allow #[track_caller] in traits.
The codegen implementation already works for this, so we're:

* propagating track_caller attr from trait def to impl
* relaxing errors
* adding tests

Approved in a recent lang team meeting:
https://github.com/rust-lang/lang-team/blob/master/minutes/2020-01-09.md
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0738.md45
1 files changed, 4 insertions, 41 deletions
diff --git a/src/librustc_error_codes/error_codes/E0738.md b/src/librustc_error_codes/error_codes/E0738.md
index 4c9588ef7b6..8f31b701e49 100644
--- a/src/librustc_error_codes/error_codes/E0738.md
+++ b/src/librustc_error_codes/error_codes/E0738.md
@@ -1,48 +1,11 @@
-`#[track_caller]` cannot be used in traits yet. This is due to limitations in
-the compiler which are likely to be temporary. See [RFC 2091] for details on
-this and other restrictions.
+`#[track_caller]` cannot be used to annotate foreign functions.
 
-Erroneous example with a trait method implementation:
+Erroneous example:
 
 ```compile_fail,E0738
 #![feature(track_caller)]
-
-trait Foo {
-    fn bar(&self);
-}
-
-impl Foo for u64 {
-    #[track_caller]
-    fn bar(&self) {}
-}
-```
-
-Erroneous example with a blanket trait method implementation:
-
-```compile_fail,E0738
-#![feature(track_caller)]
-
-trait Foo {
+extern "Rust" {
     #[track_caller]
-    fn bar(&self) {}
-    fn baz(&self);
+    fn bar();
 }
 ```
-
-Erroneous example with a trait method declaration:
-
-```compile_fail,E0738
-#![feature(track_caller)]
-
-trait Foo {
-    fn bar(&self) {}
-
-    #[track_caller]
-    fn baz(&self);
-}
-```
-
-Note that while the compiler may be able to support the attribute in traits in
-the future, [RFC 2091] prohibits their implementation without a follow-up RFC.
-
-[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md