]> git.lizzy.rs Git - rust.git/commitdiff
Add suport for extern types.
authorPaul Lietar <paul@lietar.net>
Tue, 5 Sep 2017 01:22:17 +0000 (02:22 +0100)
committerNick Cameron <ncameron@mozilla.com>
Sun, 29 Oct 2017 19:46:11 +0000 (08:46 +1300)
See https://github.com/rust-lang/rust/pull/44295

src/items.rs
tests/source/extern.rs
tests/target/extern.rs

index 25ed376f2772b0f673e24e6965d26a2c0119572a..82056c59dac536494cce27b8a1b1a0aa5a6ec3d8 100644 (file)
@@ -2740,8 +2740,10 @@ fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
                     format!("{}{}{};", prefix, sep, ty_str)
                 })
             }
-            // FIXME(#2097) support extern types.
-            ast::ForeignItemKind::Ty => unimplemented!(),
+            ast::ForeignItemKind::Ty => {
+                let vis = format_visibility(&self.vis);
+                Some(format!("{}type {};", vis, self.ident))
+            }
         }?;
 
         let missing_span = if self.attrs.is_empty() {
index 5546b2172266777eab4d8945c806d4e072d55512..bc82bcd61db36293bc41b698bf6252e3d269f375 100644 (file)
         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;
index c0601a4d0e1c3e01a862f2f5e1a8f39e1f3420a3..1d49b76dc426fcb58cedacfc2630a55099dc714c 100644 (file)
@@ -34,6 +34,10 @@ fn DMR_GetDevice(
     ) -> TDMR_ERROR;
 
     fn quux() -> (); // Post comment
+
+    pub type Foo;
+
+    type Bar;
 }
 
 extern "Rust" {