about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2015-11-27 01:48:26 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2015-12-18 04:14:46 +0300
commitfcbd553f0fb12f226df9ba5648a319bc1e8a2af4 (patch)
tree80bf5b2d05b496d783a20ccb825f6fcab8875b96 /src/test
parenta745614f44d343cf40bd2a623d0b8d522547d570 (diff)
Substitute type aliases before checking for privacy
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/issue-28450-1.rs16
-rw-r--r--src/test/compile-fail/lint-visible-private-types-1.rs6
-rw-r--r--src/test/compile-fail/lint-visible-private-types.rs9
3 files changed, 15 insertions, 16 deletions
diff --git a/src/test/compile-fail/issue-28450-1.rs b/src/test/compile-fail/issue-28450-1.rs
deleted file mode 100644
index 7239e6ddc37..00000000000
--- a/src/test/compile-fail/issue-28450-1.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Checks for private types in public interfaces
-
-type Foo = u8;
-pub fn foo(f: Foo) {} //~ ERROR private type in public interface
-
-fn main() {}
diff --git a/src/test/compile-fail/lint-visible-private-types-1.rs b/src/test/compile-fail/lint-visible-private-types-1.rs
index 69c4eca1a0a..939f2400d1b 100644
--- a/src/test/compile-fail/lint-visible-private-types-1.rs
+++ b/src/test/compile-fail/lint-visible-private-types-1.rs
@@ -37,5 +37,11 @@ impl PubTrait for <Private<isize> as PrivTrait2>::Alias {
     type Output = Private<isize>; //~ WARN private type in public interface
 }
 
+type PrivAliasPubType = u8;
+pub fn f1(_: PrivAliasPubType) {} // Ok, not an error
+
+type PrivAliasGeneric<T = Private<isize>> = T;
+pub fn f2(_: PrivAliasGeneric<u8>) {} // Ok, not an error
+
 #[rustc_error]
 fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail/lint-visible-private-types.rs b/src/test/compile-fail/lint-visible-private-types.rs
index 1fd61605557..e9890dc32b7 100644
--- a/src/test/compile-fail/lint-visible-private-types.rs
+++ b/src/test/compile-fail/lint-visible-private-types.rs
@@ -121,3 +121,12 @@ impl<T: ParamTrait<Private<isize>>>  //~ ERROR private type in public interface
      ParamTrait<T> for Public<i8> {
     fn foo() -> T { panic!() }
 }
+
+type PrivAliasPrivType = Private<isize>;
+pub fn f1(_: PrivAliasPrivType) {} //~ ERROR private type in public interface
+
+type PrivAliasGeneric<T = Private<isize>> = T;
+pub fn f2(_: PrivAliasGeneric) {} //~ ERROR private type in public interface
+
+type Result<T> = std::result::Result<T, Private<isize>>;
+pub fn f3(_: Result<u8>) {} //~ ERROR private type in public interface