From 0cbd06ae1c12368d5c73024caf1a47daf7ea87be Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sat, 3 Aug 2019 21:59:22 +0200 Subject: nested_impl_trait -> error --- ...57979-deeply-nested-impl-trait-in-assoc-proj.rs | 37 ++++--------------- ...9-deeply-nested-impl-trait-in-assoc-proj.stderr | 32 ++++------------- .../issues/issue-57979-impl-trait-in-path.rs | 35 +++--------------- .../issues/issue-57979-impl-trait-in-path.stderr | 30 +++------------- .../issue-57979-nested-impl-trait-in-assoc-proj.rs | 35 +++--------------- ...ue-57979-nested-impl-trait-in-assoc-proj.stderr | 42 +++++----------------- 6 files changed, 36 insertions(+), 175 deletions(-) (limited to 'src/test/ui/impl-trait') diff --git a/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs b/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs index 5eef6a39325..0daec3305c0 100644 --- a/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs +++ b/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs @@ -1,42 +1,17 @@ // rust-lang/rust#57979 : the initial support for `impl Trait` didn't // properly check syntax hidden behind an associated type projection, // but it did catch *some cases*. This is checking that we continue to -// properly emit errors for those, even with the new -// future-incompatibility warnings. +// properly emit errors for those. // // issue-57979-nested-impl-trait-in-assoc-proj.rs shows the main case // that we were previously failing to catch. struct Deeper(T); -mod allowed { - #![allow(nested_impl_trait)] - - pub trait Foo { } - pub trait Bar { } - pub trait Quux { type Assoc; } - pub fn demo(_: impl Quux>>) { } - //~^ ERROR nested `impl Trait` is not allowed -} - -mod warned { - #![warn(nested_impl_trait)] - - pub trait Foo { } - pub trait Bar { } - pub trait Quux { type Assoc; } - pub fn demo(_: impl Quux>>) { } - //~^ ERROR nested `impl Trait` is not allowed -} - -mod denied { - #![deny(nested_impl_trait)] - - pub trait Foo { } - pub trait Bar { } - pub trait Quux { type Assoc; } - pub fn demo(_: impl Quux>>) { } - //~^ ERROR nested `impl Trait` is not allowed -} +pub trait Foo { } +pub trait Bar { } +pub trait Quux { type Assoc; } +pub fn demo(_: impl Quux>>) { } +//~^ ERROR nested `impl Trait` is not allowed fn main() { } diff --git a/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr b/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr index 2b6f15e6d3e..6bebbc01f3d 100644 --- a/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr +++ b/src/test/ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr @@ -1,30 +1,12 @@ error[E0666]: nested `impl Trait` is not allowed - --> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:18:59 + --> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:14:48 | -LL | pub fn demo(_: impl Quux>>) { } - | ---------^^^^^^^^- - | | | - | | nested `impl Trait` here - | outer `impl Trait` +LL | pub fn demo(_: impl Quux>>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` -error[E0666]: nested `impl Trait` is not allowed - --> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:28:59 - | -LL | pub fn demo(_: impl Quux>>) { } - | ---------^^^^^^^^- - | | | - | | nested `impl Trait` here - | outer `impl Trait` - -error[E0666]: nested `impl Trait` is not allowed - --> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:38:59 - | -LL | pub fn demo(_: impl Quux>>) { } - | ---------^^^^^^^^- - | | | - | | nested `impl Trait` here - | outer `impl Trait` - -error: aborting due to 3 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0666`. diff --git a/src/test/ui/impl-trait/issues/issue-57979-impl-trait-in-path.rs b/src/test/ui/impl-trait/issues/issue-57979-impl-trait-in-path.rs index 84fcb5e2880..c5ecd1caae1 100644 --- a/src/test/ui/impl-trait/issues/issue-57979-impl-trait-in-path.rs +++ b/src/test/ui/impl-trait/issues/issue-57979-impl-trait-in-path.rs @@ -3,35 +3,10 @@ // Here we test behavior of occurrences of `impl Trait` within a path // component in that context. -mod allowed { - #![allow(nested_impl_trait)] - - pub trait Bar { } - pub trait Quux { type Assoc; } - pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } - impl Quux for () { type Assoc = u32; } -} - -mod warned { - #![warn(nested_impl_trait)] - - pub trait Bar { } - pub trait Quux { type Assoc; } - pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } - //~^ WARN `impl Trait` is not allowed in path parameters - //~| WARN will become a hard error in a future release! - impl Quux for () { type Assoc = u32; } -} - -mod denied { - #![deny(nested_impl_trait)] - - pub trait Bar { } - pub trait Quux { type Assoc; } - pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } - //~^ ERROR `impl Trait` is not allowed in path parameters - //~| WARN will become a hard error in a future release! - impl Quux for () { type Assoc = u32; } -} +pub trait Bar { } +pub trait Quux { type Assoc; } +pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } +//~^ ERROR `impl Trait` is not allowed in path parameters +impl Quux for () { type Assoc = u32; } fn main() { } diff --git a/src/test/ui/impl-trait/issues/issue-57979-impl-trait-in-path.stderr b/src/test/ui/impl-trait/issues/issue-57979-impl-trait-in-path.stderr index 982ecba291f..f64545d83b8 100644 --- a/src/test/ui/impl-trait/issues/issue-57979-impl-trait-in-path.stderr +++ b/src/test/ui/impl-trait/issues/issue-57979-impl-trait-in-path.stderr @@ -1,30 +1,8 @@ -warning: `impl Trait` is not allowed in path parameters - --> $DIR/issue-57979-impl-trait-in-path.rs:20:52 +error[E0667]: `impl Trait` is not allowed in path parameters + --> $DIR/issue-57979-impl-trait-in-path.rs:8:48 | -LL | pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } - | ^^^^^^^^ - | -note: lint level defined here - --> $DIR/issue-57979-impl-trait-in-path.rs:16:13 - | -LL | #![warn(nested_impl_trait)] - | ^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #59014 - -error: `impl Trait` is not allowed in path parameters - --> $DIR/issue-57979-impl-trait-in-path.rs:31:52 - | -LL | pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } - | ^^^^^^^^ - | -note: lint level defined here - --> $DIR/issue-57979-impl-trait-in-path.rs:27:13 - | -LL | #![deny(nested_impl_trait)] - | ^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #59014 +LL | pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } + | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/impl-trait/issues/issue-57979-nested-impl-trait-in-assoc-proj.rs b/src/test/ui/impl-trait/issues/issue-57979-nested-impl-trait-in-assoc-proj.rs index 5c20ffc7c67..5a444d3dfdd 100644 --- a/src/test/ui/impl-trait/issues/issue-57979-nested-impl-trait-in-assoc-proj.rs +++ b/src/test/ui/impl-trait/issues/issue-57979-nested-impl-trait-in-assoc-proj.rs @@ -3,35 +3,10 @@ // Here we test behavior of occurrences of `impl Trait` within an // `impl Trait` in that context. -mod allowed { - #![allow(nested_impl_trait)] - - pub trait Foo { } - pub trait Bar { } - pub trait Quux { type Assoc; } - pub fn demo(_: impl Quux>) { } -} - -mod warned { - #![warn(nested_impl_trait)] - - pub trait Foo { } - pub trait Bar { } - pub trait Quux { type Assoc; } - pub fn demo(_: impl Quux>) { } - //~^ WARN nested `impl Trait` is not allowed - //~| WARN will become a hard error in a future release! -} - -mod denied { - #![deny(nested_impl_trait)] - - pub trait Foo { } - pub trait Bar { } - pub trait Quux { type Assoc; } - pub fn demo(_: impl Quux>) { } - //~^ ERROR nested `impl Trait` is not allowed - //~| WARN will become a hard error in a future release! -} +pub trait Foo { } +pub trait Bar { } +pub trait Quux { type Assoc; } +pub fn demo(_: impl Quux>) { } +//~^ ERROR nested `impl Trait` is not allowed fn main() { } diff --git a/src/test/ui/impl-trait/issues/issue-57979-nested-impl-trait-in-assoc-proj.stderr b/src/test/ui/impl-trait/issues/issue-57979-nested-impl-trait-in-assoc-proj.stderr index 508aea24321..8d3d4b5e206 100644 --- a/src/test/ui/impl-trait/issues/issue-57979-nested-impl-trait-in-assoc-proj.stderr +++ b/src/test/ui/impl-trait/issues/issue-57979-nested-impl-trait-in-assoc-proj.stderr @@ -1,36 +1,12 @@ -warning: nested `impl Trait` is not allowed - --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:21:45 - | -LL | pub fn demo(_: impl Quux>) { } - | ---------^^^^^^^^- - | | | - | | nested `impl Trait` here - | outer `impl Trait` - | -note: lint level defined here - --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:16:13 - | -LL | #![warn(nested_impl_trait)] - | ^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #59014 - -error: nested `impl Trait` is not allowed - --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:32:45 - | -LL | pub fn demo(_: impl Quux>) { } - | ---------^^^^^^^^- - | | | - | | nested `impl Trait` here - | outer `impl Trait` - | -note: lint level defined here - --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:27:13 - | -LL | #![deny(nested_impl_trait)] - | ^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #59014 +error[E0666]: nested `impl Trait` is not allowed + --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:9:41 + | +LL | pub fn demo(_: impl Quux>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` error: aborting due to previous error +For more information about this error, try `rustc --explain E0666`. -- cgit 1.4.1-3-g733a5