Skip to content

Commit 6469506

Browse files
committed
Add suport for extern types.
See rust-lang/rust#44295
1 parent 6e41100 commit 6469506

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/items.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2793,6 +2793,10 @@ impl Rewrite for ast::ForeignItem {
27932793
format!("{}{}{};", prefix, sep, ty_str)
27942794
})
27952795
}
2796+
ast::ForeignItemKind::Ty => {
2797+
let vis = format_visibility(&self.vis);
2798+
Some(format!("{}type {};", vis, self.ident))
2799+
}
27962800
});
27972801

27982802
let missing_span = if self.attrs.is_empty() {

tests/source/extern.rs

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ extern {
2525
fn DMR_GetDevice(pHDev: *mut HDEV, searchMode: DeviceSearchMode, pSearchString: *const c_char, devNr: c_uint, wildcard: c_char) -> TDMR_ERROR;
2626

2727
fn quux() -> (); // Post comment
28+
29+
pub type
30+
Foo;
31+
32+
type Bar;
2833
}
2934

3035
extern "Rust" { static ext: u32;

tests/target/extern.rs

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ extern "C" {
3434
) -> TDMR_ERROR;
3535

3636
fn quux() -> (); // Post comment
37+
38+
pub type Foo;
39+
40+
type Bar;
3741
}
3842

3943
extern "Rust" {

0 commit comments

Comments
 (0)