From 0620f4ba48237c6ba960e01a16dbeb0cc877b9dc Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Tue, 5 Sep 2017 02:22:17 +0100 Subject: [PATCH] Add suport for extern types. See https://github.com/rust-lang/rust/pull/44295 --- src/items.rs | 4 ++++ tests/source/extern.rs | 5 +++++ tests/target/extern.rs | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/src/items.rs b/src/items.rs index d5369e33ef8..6c8b6e06284 100644 --- a/src/items.rs +++ b/src/items.rs @@ -2780,6 +2780,10 @@ impl Rewrite for ast::ForeignItem { format!("{}{}{};", prefix, sep, ty_str) }) } + ast::ForeignItemKind::Ty => { + let vis = format_visibility(&self.vis); + Some(format!("{}type {};", vis, self.ident)) + } }); let missing_span = if self.attrs.is_empty() { diff --git a/tests/source/extern.rs b/tests/source/extern.rs index 5546b217226..bc82bcd61db 100644 --- a/tests/source/extern.rs +++ b/tests/source/extern.rs @@ -25,6 +25,11 @@ extern { fn DMR_GetDevice(pHDev: *mut HDEV, searchMode: DeviceSearchMode, pSearchString: *const c_char, devNr: c_uint, wildcard: c_char) -> TDMR_ERROR; fn quux() -> (); // Post comment + + pub type + Foo; + + type Bar; } extern "Rust" { static ext: u32; diff --git a/tests/target/extern.rs b/tests/target/extern.rs index c0601a4d0e1..1d49b76dc42 100644 --- a/tests/target/extern.rs +++ b/tests/target/extern.rs @@ -34,6 +34,10 @@ extern "C" { ) -> TDMR_ERROR; fn quux() -> (); // Post comment + + pub type Foo; + + type Bar; } extern "Rust" {