Do not substitute type aliases during error reporting

Type aliases are still substituted when determining impl publicity
This commit is contained in:
Vadim Petrochenkov 2015-12-18 20:57:36 +03:00
parent cda7244a2a
commit 785cbe0200
4 changed files with 13 additions and 6 deletions

View file

@ -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<PrivAlias> {} // OK
// This should be OK, if type aliases are substituted
pub trait Tr2: PrivUseAliasTr<PrivAlias> {} //~ 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 = Priv> = T;
type Result<T> = ::std::result::Result<T, Priv>;
pub fn f1(arg: PrivAliasGeneric<u8>) {} // OK, not an error
}
#[rustc_error]

View file

@ -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: <Priv as PrivTr>::AssocAlias) {} //~ ERROR private type in public interface
@ -141,6 +143,8 @@ mod aliases_params {
type PrivAliasGeneric<T = Priv> = T;
type Result<T> = ::std::result::Result<T, Priv>;
// This should be OK, if type aliases are substituted
pub fn f1(arg: PrivAliasGeneric<u8>) {} //~ ERROR private type in public interface
pub fn f2(arg: PrivAliasGeneric) {} //~ ERROR private type in public interface
pub fn f3(arg: Result<u8>) {} //~ ERROR private type in public interface
}