Nest the impl Trait existential item inside the return type

This commit is contained in:
Oliver Schneider 2018-10-02 10:54:34 +02:00
parent f55129d003
commit 2a1ea44bdc
10 changed files with 143 additions and 172 deletions

View file

@ -0,0 +1,19 @@
// compile-pass
#![deny(warnings)]
#[deprecated]
trait Deprecated {}
#[deprecated]
struct DeprecatedTy;
#[allow(deprecated)]
impl Deprecated for DeprecatedTy {}
#[allow(deprecated)]
fn foo() -> impl Deprecated { DeprecatedTy }
fn main() {
foo();
}

View file

@ -35,8 +35,6 @@ type A = <m::Alias as m::Trait>::X; //~ ERROR type `m::Priv` is private
trait Tr2<T> {}
impl<T> Tr2<T> for u8 {}
fn g() -> impl Tr2<m::Alias> { 0 } //~ ERROR type `m::Priv` is private
//~^ ERROR type `m::Priv` is private
fn g_ext() -> impl Tr2<ext::Alias> { 0 } //~ ERROR type `ext::Priv` is private
//~^ ERROR type `ext::Priv` is private
fn main() {}

View file

@ -46,23 +46,11 @@ error: type `m::Priv` is private
LL | fn g() -> impl Tr2<m::Alias> { 0 } //~ ERROR type `m::Priv` is private
| ^^^^^^^^^^^^^^^^^^
error: type `m::Priv` is private
--> $DIR/private-type-in-interface.rs:37:16
|
LL | fn g() -> impl Tr2<m::Alias> { 0 } //~ ERROR type `m::Priv` is private
| ^^^^^^^^^^^^^
error: type `ext::Priv` is private
--> $DIR/private-type-in-interface.rs:39:15
--> $DIR/private-type-in-interface.rs:38:15
|
LL | fn g_ext() -> impl Tr2<ext::Alias> { 0 } //~ ERROR type `ext::Priv` is private
| ^^^^^^^^^^^^^^^^^^^^
error: type `ext::Priv` is private
--> $DIR/private-type-in-interface.rs:39:20
|
LL | fn g_ext() -> impl Tr2<ext::Alias> { 0 } //~ ERROR type `ext::Priv` is private
| ^^^^^^^^^^^^^^^
error: aborting due to 11 previous errors
error: aborting due to 9 previous errors