about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTom Jakubowski <tom@crystae.net>2015-02-06 02:43:45 -0800
committerTom Jakubowski <tom@crystae.net>2015-02-06 03:22:34 -0800
commite43c478035d82556168432d9be1027eca75af495 (patch)
treec86572f3d297af78c6208d041a223304547549af
parentdf1cfde253eb770dd7b3333cfc1dce7f59faac63 (diff)
downloadrust-e43c478035d82556168432d9be1027eca75af495.tar.gz
rust-e43c478035d82556168432d9be1027eca75af495.zip
Encode foreign function argument names
Fix #21917
-rw-r--r--src/librustc/metadata/encoder.rs3
-rw-r--r--src/test/run-make/rustdoc-ffi/Makefile8
-rw-r--r--src/test/run-make/rustdoc-ffi/lib.rs16
-rw-r--r--src/test/run-make/rustdoc-ffi/user.rs16
4 files changed, 42 insertions, 1 deletions
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 5fb047ea93b..de633effc07 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1466,7 +1466,7 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
     encode_def_id(rbml_w, local_def(nitem.id));
     encode_visibility(rbml_w, nitem.vis);
     match nitem.node {
-      ast::ForeignItemFn(..) => {
+      ast::ForeignItemFn(ref fndecl, _) => {
         encode_family(rbml_w, FN_FAMILY);
         encode_bounds_and_type(rbml_w, ecx,
                                &lookup_item_type(ecx.tcx,local_def(nitem.id)));
@@ -1478,6 +1478,7 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
         let stab = stability::lookup(ecx.tcx, ast_util::local_def(nitem.id));
         encode_stability(rbml_w, stab);
         encode_symbol(ecx, rbml_w, nitem.id);
+        encode_method_argument_names(rbml_w, &*fndecl);
       }
       ast::ForeignItemStatic(_, mutbl) => {
         if mutbl {
diff --git a/src/test/run-make/rustdoc-ffi/Makefile b/src/test/run-make/rustdoc-ffi/Makefile
new file mode 100644
index 00000000000..c312efe12f5
--- /dev/null
+++ b/src/test/run-make/rustdoc-ffi/Makefile
@@ -0,0 +1,8 @@
+-include ../tools.mk
+
+all: lib.rs
+	$(HOST_RPATH_ENV) $(RUSTC) lib.rs
+	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs
+	$(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc user.rs
+	$(HTMLDOCCK) $(TMPDIR)/doc lib.rs
+	$(HTMLDOCCK) $(TMPDIR)/doc user.rs
diff --git a/src/test/run-make/rustdoc-ffi/lib.rs b/src/test/run-make/rustdoc-ffi/lib.rs
new file mode 100644
index 00000000000..e06dbe76dbb
--- /dev/null
+++ b/src/test/run-make/rustdoc-ffi/lib.rs
@@ -0,0 +1,16 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type="lib"]
+
+extern "C" {
+    // @has lib/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)'
+    pub fn foreigner(cold_as_ice: u32);
+}
diff --git a/src/test/run-make/rustdoc-ffi/user.rs b/src/test/run-make/rustdoc-ffi/user.rs
new file mode 100644
index 00000000000..09d7a7c536c
--- /dev/null
+++ b/src/test/run-make/rustdoc-ffi/user.rs
@@ -0,0 +1,16 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type="lib"]
+
+extern crate lib;
+
+// @has user/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)'
+pub use lib::foreigner;