Skip to content

Commit

Permalink
TAIT: adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Nov 14, 2019
1 parent 8b663ec commit 03cf0d7
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 29 deletions.
36 changes: 33 additions & 3 deletions src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.rs
@@ -1,15 +1,45 @@
type Foo = impl std::fmt::Debug; //~ ERROR `impl Trait` in type aliases is unstable
use std::fmt::Debug;

type Foo = impl Debug; //~ ERROR `impl Trait` in type aliases is unstable

trait Bar {
type Baa: std::fmt::Debug;
type Baa: Debug;
fn define() -> Self::Baa;
}

impl Bar for () {
type Baa = impl std::fmt::Debug; //~ ERROR `impl Trait` in type aliases is unstable
type Baa = impl Debug; //~ ERROR `impl Trait` in type aliases is unstable
fn define() -> Self::Baa { 0 }
}

fn define() -> Foo { 0 }

trait TraitWithDefault {
type Assoc = impl Debug;
//~^ ERROR associated type defaults are unstable
//~| ERROR `impl Trait` not allowed outside of function
//~| ERROR `impl Trait` in type aliases is unstable
}

type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
//~^ ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` not allowed outside of function
//~| ERROR `impl Trait` not allowed outside of function
//~| ERROR `impl Trait` not allowed outside of function

impl Bar for u8 {
type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
//~^ ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` not allowed outside of function
//~| ERROR `impl Trait` not allowed outside of function
//~| ERROR `impl Trait` not allowed outside of function
fn define() -> Self::Baa { (vec![true], 0u8, 0i32..1) }
}

fn main() {}
149 changes: 141 additions & 8 deletions src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr
@@ -1,21 +1,154 @@
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:1:1
--> $DIR/feature-gate-type_alias_impl_trait.rs:3:12
|
LL | type Foo = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Foo = impl Debug;
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:9:5
--> $DIR/feature-gate-type_alias_impl_trait.rs:11:16
|
LL | type Baa = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Baa = impl Debug;
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error: aborting due to 2 previous errors
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:18:18
|
LL | type Assoc = impl Debug;
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0658]: associated type defaults are unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:18:5
|
LL | type Assoc = impl Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29661
= help: add `#![feature(associated_type_defaults)]` to the crate attributes to enable

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:24
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:37
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:49
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:70
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:21
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:34
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:46
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:67
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:18:18
|
LL | type Assoc = impl Debug;
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:24
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:37
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:49
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:21
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:34
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:46
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 19 previous errors

For more information about this error, try `rustc --explain E0658`.
Some errors have detailed explanations: E0562, E0658.
For more information about an error, try `rustc --explain E0562`.
1 change: 1 addition & 0 deletions src/test/ui/impl-trait/where-allowed.rs
Expand Up @@ -163,6 +163,7 @@ type InTypeAlias<R> = impl Debug;

type InReturnInTypeAlias<R> = fn() -> impl Debug;
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~| ERROR `impl Trait` in type aliases is unstable

// Disallowed in impl headers
impl PartialEq<impl Debug> for () {
Expand Down
41 changes: 25 additions & 16 deletions src/test/ui/impl-trait/where-allowed.stderr
Expand Up @@ -17,19 +17,28 @@ LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic
| outer `impl Trait`

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/where-allowed.rs:124:5
--> $DIR/where-allowed.rs:124:16
|
LL | type Out = impl Debug;
| ^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/where-allowed.rs:160:1
--> $DIR/where-allowed.rs:160:23
|
LL | type InTypeAlias<R> = impl Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/where-allowed.rs:164:39
|
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
| ^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
Expand Down Expand Up @@ -179,69 +188,69 @@ LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/where-allowed.rs:168:16
--> $DIR/where-allowed.rs:169:16
|
LL | impl PartialEq<impl Debug> for () {
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/where-allowed.rs:173:24
--> $DIR/where-allowed.rs:174:24
|
LL | impl PartialEq<()> for impl Debug {
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/where-allowed.rs:178:6
--> $DIR/where-allowed.rs:179:6
|
LL | impl impl Debug {
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/where-allowed.rs:184:24
--> $DIR/where-allowed.rs:185:24
|
LL | impl InInherentImplAdt<impl Debug> {
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/where-allowed.rs:190:11
--> $DIR/where-allowed.rs:191:11
|
LL | where impl Debug: Debug
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/where-allowed.rs:197:15
--> $DIR/where-allowed.rs:198:15
|
LL | where Vec<impl Debug>: Debug
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/where-allowed.rs:204:24
--> $DIR/where-allowed.rs:205:24
|
LL | where T: PartialEq<impl Debug>
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/where-allowed.rs:211:17
--> $DIR/where-allowed.rs:212:17
|
LL | where T: Fn(impl Debug)
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/where-allowed.rs:218:22
--> $DIR/where-allowed.rs:219:22
|
LL | where T: Fn() -> impl Debug
| ^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/where-allowed.rs:224:29
--> $DIR/where-allowed.rs:225:29
|
LL | let _in_local_variable: impl Fn() = || {};
| ^^^^^^^^^
|
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/where-allowed.rs:226:46
--> $DIR/where-allowed.rs:227:46
|
LL | let _in_return_in_local_variable = || -> impl Fn() { || {} };
| ^^^^^^^^^
Expand Down Expand Up @@ -270,7 +279,7 @@ error: could not find defining uses
LL | type Out = impl Debug;
| ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 43 previous errors
error: aborting due to 44 previous errors

Some errors have detailed explanations: E0282, E0562, E0658, E0666.
For more information about an error, try `rustc --explain E0282`.
4 changes: 2 additions & 2 deletions src/test/ui/type-alias-impl-trait/issue-60371.stderr
@@ -1,8 +1,8 @@
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/issue-60371.rs:8:5
--> $DIR/issue-60371.rs:8:17
|
LL | type Item = impl Bug;
| ^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
Expand Down

0 comments on commit 03cf0d7

Please sign in to comment.