-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
202 additions
and
29 deletions.
There are no files selected for viewing
36 changes: 33 additions & 3 deletions
36
src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
149
src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters