about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2020-04-09 05:29:45 +0200
committerGitHub <noreply@github.com>2020-04-09 05:29:45 +0200
commit4f00396f149713b920a74055419f5ab3a8d6a066 (patch)
tree62bd6d3e2cc2cd653b3a176d4f84a11d8cdd4a60 /src/librustc_error_codes/error_codes
parentecc4e2a647533ddabb7a1b69f6ab1385c3f4003c (diff)
parent45589b52fe215b7090bf88683927716c25197203 (diff)
Rollup merge of #70916 - Centril:track-caller-ffi, r=eddyb
Support `#[track_caller]` on functions in `extern "Rust" { ... }`

Fixes https://github.com/rust-lang/rust/issues/70830 which is the follow-up to @eddyb's suggestion in https://github.com/rust-lang/rust/pull/69251#discussion_r380791634 to allow `#[track_caller]` on `fn`s in FFI imports, that is, on functions in `extern "Rust" { ... }` blocks.

This requires that the other side, the FFI export, also have the `#[track_caller]` attribute. Otherwise, undefined behavior is triggered and the blame lies, as usual, with the `unsafe { ... }` block which called the FFI imported function.

After this PR, all forms of `fn` items with the right ABI (`"Rust"`) support `#[track_caller]`.

As a drive-by, the PR also hardens the check rejecting `#[naked] #[track_caller]` such that methods and other forms of `fn` items are also considered.

r? @eddyb
cc @rust-lang/lang
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0738.md11
1 files changed, 0 insertions, 11 deletions
diff --git a/src/librustc_error_codes/error_codes/E0738.md b/src/librustc_error_codes/error_codes/E0738.md
deleted file mode 100644
index 8f31b701e49..00000000000
--- a/src/librustc_error_codes/error_codes/E0738.md
+++ /dev/null
@@ -1,11 +0,0 @@
-`#[track_caller]` cannot be used to annotate foreign functions.
-
-Erroneous example:
-
-```compile_fail,E0738
-#![feature(track_caller)]
-extern "Rust" {
-    #[track_caller]
-    fn bar();
-}
-```