forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#110237 - oli-obk:impl_trait_in_assoc_tys, r…
…=jackh726 Split out a separate feature gate for impl trait in associated types in rust-lang#107645 it was decided that we'll take a new route for type alias impl trait. The exact route isn't clear yet, so while I'm working on implementing some of these proposed changes (e.g. in rust-lang#110010) to be able to experiment with them, I will also work on stabilizing another sugar version first: impl trait in associated types. Similarly I'll look into creating feature gates for impl trait in const/static types. This PR does nothing but split the feature gate, so that you need to enable a different feature gate for ```rust impl Trait for Type { type Assoc = impl SomeTrait; } ``` than what you need for `type Foo = impl SomeTrait;`
- Loading branch information
Showing
68 changed files
with
217 additions
and
148 deletions.
There are no files selected for viewing
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
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
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
18 changes: 18 additions & 0 deletions
18
tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
trait Foo { | ||
type Bar; | ||
} | ||
|
||
impl Foo for () { | ||
type Bar = impl std::fmt::Debug; | ||
//~^ ERROR: `impl Trait` in associated types is unstable | ||
} | ||
|
||
struct Mop; | ||
|
||
impl Mop { | ||
type Bop = impl std::fmt::Debug; | ||
//~^ ERROR: `impl Trait` in associated types is unstable | ||
//~| ERROR: inherent associated types are unstable | ||
} | ||
|
||
fn main() {} |
30 changes: 30 additions & 0 deletions
30
tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
error[E0658]: `impl Trait` in associated types is unstable | ||
--> $DIR/feature-gate-impl_trait_in_assoc_type.rs:6:16 | ||
| | ||
LL | type Bar = impl std::fmt::Debug; | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information | ||
= help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable | ||
|
||
error[E0658]: `impl Trait` in associated types is unstable | ||
--> $DIR/feature-gate-impl_trait_in_assoc_type.rs:13:16 | ||
| | ||
LL | type Bop = impl std::fmt::Debug; | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information | ||
= help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable | ||
|
||
error[E0658]: inherent associated types are unstable | ||
--> $DIR/feature-gate-impl_trait_in_assoc_type.rs:13:5 | ||
| | ||
LL | type Bop = impl std::fmt::Debug; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information | ||
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
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
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
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
2 changes: 1 addition & 1 deletion
2
tests/ui/impl-trait/associated-impl-trait-type-generic-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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#![feature(type_alias_impl_trait)] | ||
#![feature(impl_trait_in_assoc_type)] | ||
|
||
pub trait Bar { | ||
type E: Copy; | ||
|
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#![feature(type_alias_impl_trait)] | ||
#![feature(impl_trait_in_assoc_type)] | ||
|
||
pub trait Bar { | ||
type E: Copy; | ||
|
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,4 +1,4 @@ | ||
#![feature(type_alias_impl_trait)] | ||
#![feature(impl_trait_in_assoc_type)] | ||
|
||
trait Trait { | ||
type Associated; | ||
|
Oops, something went wrong.