Skip to content

Commit ccc864e

Browse files
committed
Add suport for extern types.
See rust-lang/rust#44295
1 parent 3f3d925 commit ccc864e

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
@@ -2780,6 +2780,10 @@ impl Rewrite for ast::ForeignItem {
27802780
format!("{}{}{};", prefix, sep, ty_str)
27812781
})
27822782
}
2783+
ast::ForeignItemKind::Ty => {
2784+
let vis = format_visibility(&self.vis);
2785+
Some(format!("{}type {};", vis, self.ident))
2786+
}
27832787
});
27842788

27852789
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+
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+
type Foo;
39+
40+
type Bar;
3741
}
3842

3943
extern "Rust" {

0 commit comments

Comments
 (0)