about summary refs log tree commit diff
path: root/src/librustrt
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-09-19 12:30:07 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-09-22 20:05:45 -0700
commite9ad12c0cae5c43ada6641c7dc840a0fbe5010a2 (patch)
tree21b3e62d447bda4ccda606894edb66ca965bccee /src/librustrt
parent43fd619819b334b8548dca98797bd4c8078636cb (diff)
downloadrust-e9ad12c0cae5c43ada6641c7dc840a0fbe5010a2.tar.gz
rust-e9ad12c0cae5c43ada6641c7dc840a0fbe5010a2.zip
librustc: Forbid private types in public APIs.
This breaks code like:

    struct Foo {
        ...
    }

    pub fn make_foo() -> Foo {
        ...
    }

Change this code to:

    pub struct Foo {    // note `pub`
        ...
    }

    pub fn make_foo() -> Foo {
        ...
    }

The `visible_private_types` lint has been removed, since it is now an
error to attempt to expose a private type in a public API. In its place
a `#[feature(visible_private_types)]` gate has been added.

Closes #16463.

RFC #48.

[breaking-change]
Diffstat (limited to 'src/librustrt')
-rw-r--r--src/librustrt/local.rs1
-rw-r--r--src/librustrt/local_ptr.rs1
-rw-r--r--src/librustrt/unwind.rs12
3 files changed, 4 insertions, 10 deletions
diff --git a/src/librustrt/local.rs b/src/librustrt/local.rs
index e2a5eef0d99..8531f569a6b 100644
--- a/src/librustrt/local.rs
+++ b/src/librustrt/local.rs
@@ -26,7 +26,6 @@ pub trait Local<Borrowed> {
     unsafe fn try_unsafe_borrow() -> Option<*mut Self>;
 }
 
-#[allow(visible_private_types)]
 impl Local<local_ptr::Borrowed<Task>> for Task {
     #[inline]
     fn put(value: Box<Task>) { unsafe { local_ptr::put(value) } }
diff --git a/src/librustrt/local_ptr.rs b/src/librustrt/local_ptr.rs
index 92a67da20b6..912e4ef4d40 100644
--- a/src/librustrt/local_ptr.rs
+++ b/src/librustrt/local_ptr.rs
@@ -374,7 +374,6 @@ pub mod native {
 
     #[inline]
     #[cfg(not(test))]
-    #[allow(visible_private_types)]
     pub fn maybe_tls_key() -> Option<tls::Key> {
         unsafe {
             // NB: This is a little racy because, while the key is
diff --git a/src/librustrt/unwind.rs b/src/librustrt/unwind.rs
index fbbc1a08fd9..acef05e0867 100644
--- a/src/librustrt/unwind.rs
+++ b/src/librustrt/unwind.rs
@@ -237,7 +237,6 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class {
 
 #[cfg(not(target_arch = "arm"), not(windows, target_arch = "x86_64"), not(test))]
 #[doc(hidden)]
-#[allow(visible_private_types)]
 pub mod eabi {
     use libunwind as uw;
     use libc::c_int;
@@ -291,7 +290,6 @@ pub mod eabi {
 
 #[cfg(target_os = "ios", target_arch = "arm", not(test))]
 #[doc(hidden)]
-#[allow(visible_private_types)]
 pub mod eabi {
     use libunwind as uw;
     use libc::c_int;
@@ -347,7 +345,6 @@ pub mod eabi {
 // but otherwise works the same.
 #[cfg(target_arch = "arm", not(target_os = "ios"), not(test))]
 #[doc(hidden)]
-#[allow(visible_private_types)]
 pub mod eabi {
     use libunwind as uw;
     use libc::c_int;
@@ -397,21 +394,20 @@ pub mod eabi {
 
 #[cfg(windows, target_arch = "x86_64", not(test))]
 #[doc(hidden)]
-#[allow(visible_private_types)]
 #[allow(non_camel_case_types, non_snake_case)]
 pub mod eabi {
     use libunwind as uw;
     use libc::{c_void, c_int};
 
     #[repr(C)]
-    struct EXCEPTION_RECORD;
+    pub struct EXCEPTION_RECORD;
     #[repr(C)]
-    struct CONTEXT;
+    pub struct CONTEXT;
     #[repr(C)]
-    struct DISPATCHER_CONTEXT;
+    pub struct DISPATCHER_CONTEXT;
 
     #[repr(C)]
-    enum EXCEPTION_DISPOSITION {
+    pub enum EXCEPTION_DISPOSITION {
         ExceptionContinueExecution,
         ExceptionContinueSearch,
         ExceptionNestedException,