From 785cbe02008985f98fee2a013f2d308207ca596f Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Fri, 18 Dec 2015 20:57:36 +0300 Subject: Do not substitute type aliases during error reporting Type aliases are still substituted when determining impl publicity --- src/test/compile-fail/private-in-public-warn.rs | 7 ++----- src/test/compile-fail/private-in-public.rs | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/test') diff --git a/src/test/compile-fail/private-in-public-warn.rs b/src/test/compile-fail/private-in-public-warn.rs index 8128fde4de5..2d1de3ca282 100644 --- a/src/test/compile-fail/private-in-public-warn.rs +++ b/src/test/compile-fail/private-in-public-warn.rs @@ -175,10 +175,10 @@ mod aliases_pub { impl PrivTr for Priv {} pub fn f1(arg: PrivUseAlias) {} // OK - pub fn f2(arg: PrivAlias) {} // OK pub trait Tr1: PrivUseAliasTr {} // OK - pub trait Tr2: PrivUseAliasTr {} // OK + // This should be OK, if type aliases are substituted + pub trait Tr2: PrivUseAliasTr {} //~ WARN private type in public interface impl PrivAlias { pub fn f(arg: Priv) {} //~ WARN private type in public interface @@ -211,7 +211,6 @@ mod aliases_priv { use self::Priv1 as PrivUseAlias; use self::PrivTr1 as PrivUseAliasTr; type PrivAlias = Priv2; - //~^ WARN private type in public interface trait PrivTr { type AssocAlias = Priv3; } @@ -246,8 +245,6 @@ mod aliases_params { struct Priv; type PrivAliasGeneric = T; type Result = ::std::result::Result; - - pub fn f1(arg: PrivAliasGeneric) {} // OK, not an error } #[rustc_error] diff --git a/src/test/compile-fail/private-in-public.rs b/src/test/compile-fail/private-in-public.rs index 7d4dcfd3145..be22a2ef6a7 100644 --- a/src/test/compile-fail/private-in-public.rs +++ b/src/test/compile-fail/private-in-public.rs @@ -105,6 +105,8 @@ mod aliases_pub { } impl PrivTr for Priv {} + // This should be OK, if type aliases are substituted + pub fn f2(arg: PrivAlias) {} //~ ERROR private type in public interface // This should be OK, but associated type aliases are not substituted yet pub fn f3(arg: ::AssocAlias) {} //~ ERROR private type in public interface @@ -141,6 +143,8 @@ mod aliases_params { type PrivAliasGeneric = T; type Result = ::std::result::Result; + // This should be OK, if type aliases are substituted + pub fn f1(arg: PrivAliasGeneric) {} //~ ERROR private type in public interface pub fn f2(arg: PrivAliasGeneric) {} //~ ERROR private type in public interface pub fn f3(arg: Result) {} //~ ERROR private type in public interface } -- cgit 1.4.1-3-g733a5