forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
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#133768 - compiler-errors:gate, r=lcnr,jackh726 Remove `generic_associated_types_extended` feature gate This PR retires nightly support for the `generic_associated_types_extended` feature. This feature hasn't received much attention in the last two years or so, and I believe the feature still remains both unsound and ICEy to use. I think that if we were to redesign and reimplement it, we'd want to first figure out how to implement it soundly, but in the mean time I'd prefer to clean this up. r? ``@lcnr`` cc ``@jackh726`` who added this feature gate I think
- Loading branch information
Showing
24 changed files
with
300 additions
and
124 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 was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
tests/ui/feature-gates/feature-gate-generic_associated_types_extended.rs
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
tests/ui/feature-gates/feature-gate-generic_associated_types_extended.stderr
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
8 changes: 1 addition & 7 deletions
8
tests/ui/generic-associated-types/extended/lending_iterator_2.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
2 changes: 1 addition & 1 deletion
2
...s/extended/lending_iterator_2.base.stderr → ...-types/extended/lending_iterator_2.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
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
58 changes: 58 additions & 0 deletions
58
tests/ui/generic-associated-types/gat-in-trait-path.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,58 @@ | ||
error[E0038]: the trait `Foo` cannot be made into an object | ||
--> $DIR/gat-in-trait-path.rs:22:17 | ||
| | ||
LL | fn f(_arg : Box<dyn for<'a> Foo<A<'a> = &'a ()>>) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object | ||
| | ||
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> | ||
--> $DIR/gat-in-trait-path.rs:6:10 | ||
| | ||
LL | trait Foo { | ||
| --- this trait cannot be made into an object... | ||
LL | type A<'a> where Self: 'a; | ||
| ^ ...because it contains the generic associated type `A` | ||
= help: consider moving `A` to another trait | ||
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Foo` for this new enum and using it instead: | ||
Fooy | ||
Fooer<T> | ||
|
||
error[E0038]: the trait `Foo` cannot be made into an object | ||
--> $DIR/gat-in-trait-path.rs:28:5 | ||
| | ||
LL | f(Box::new(foo)); | ||
| ^^^^^^^^^^^^^ `Foo` cannot be made into an object | ||
| | ||
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> | ||
--> $DIR/gat-in-trait-path.rs:6:10 | ||
| | ||
LL | trait Foo { | ||
| --- this trait cannot be made into an object... | ||
LL | type A<'a> where Self: 'a; | ||
| ^ ...because it contains the generic associated type `A` | ||
= help: consider moving `A` to another trait | ||
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Foo` for this new enum and using it instead: | ||
Fooy | ||
Fooer<T> | ||
|
||
error[E0038]: the trait `Foo` cannot be made into an object | ||
--> $DIR/gat-in-trait-path.rs:28:5 | ||
| | ||
LL | f(Box::new(foo)); | ||
| ^^^^^^^^^^^^^ `Foo` cannot be made into an object | ||
| | ||
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> | ||
--> $DIR/gat-in-trait-path.rs:6:10 | ||
| | ||
LL | trait Foo { | ||
| --- this trait cannot be made into an object... | ||
LL | type A<'a> where Self: 'a; | ||
| ^ ...because it contains the generic associated type `A` | ||
= help: consider moving `A` to another trait | ||
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Foo` for this new enum and using it instead: | ||
Fooy | ||
Fooer<T> | ||
= note: required for the cast from `Box<Fooer<{integer}>>` to `Box<(dyn Foo<A<'a> = &'a ()> + 'static)>` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0038`. |
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,10 @@ | ||
//@ revisions: base extended | ||
//@[base] check-fail | ||
//@[extended] check-pass | ||
|
||
#![cfg_attr(extended, feature(generic_associated_types_extended))] | ||
#![cfg_attr(extended, allow(incomplete_features))] | ||
//@ check-fail | ||
|
||
trait X { | ||
type Y<'a>; | ||
} | ||
|
||
fn _func1<'a>(_x: Box<dyn X<Y<'a>=&'a ()>>) {} | ||
//[base]~^ ERROR the trait `X` cannot be made into an object | ||
//~^ ERROR the trait `X` cannot be made into an object | ||
|
||
fn main() {} |
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 @@ | ||
error[E0038]: the trait `X` cannot be made into an object | ||
--> $DIR/issue-67510-pass.rs:7:23 | ||
| | ||
LL | fn _func1<'a>(_x: Box<dyn X<Y<'a>=&'a ()>>) {} | ||
| ^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object | ||
| | ||
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> | ||
--> $DIR/issue-67510-pass.rs:4:10 | ||
| | ||
LL | trait X { | ||
| - this trait cannot be made into an object... | ||
LL | type Y<'a>; | ||
| ^ ...because it contains the generic associated type `Y` | ||
= help: consider moving `Y` to another trait | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0038`. |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
error[E0107]: missing generics for associated type `SuperTrait::SubType` | ||
--> $DIR/issue-76535.rs:34:33 | ||
| | ||
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0)); | ||
| ^^^^^^^ expected 1 lifetime argument | ||
| | ||
note: associated type defined here, with 1 lifetime parameter: `'a` | ||
--> $DIR/issue-76535.rs:4:10 | ||
| | ||
LL | type SubType<'a>: SubTrait where Self: 'a; | ||
| ^^^^^^^ -- | ||
help: add missing lifetime argument | ||
| | ||
LL | let sub: Box<dyn SuperTrait<SubType<'a> = SubStruct>> = Box::new(SuperStruct::new(0)); | ||
| ++++ | ||
|
||
error[E0038]: the trait `SuperTrait` cannot be made into an object | ||
--> $DIR/issue-76535.rs:34:14 | ||
| | ||
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object | ||
| | ||
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> | ||
--> $DIR/issue-76535.rs:4:10 | ||
| | ||
LL | pub trait SuperTrait { | ||
| ---------- this trait cannot be made into an object... | ||
LL | type SubType<'a>: SubTrait where Self: 'a; | ||
| ^^^^^^^ ...because it contains the generic associated type `SubType` | ||
= help: consider moving `SubType` to another trait | ||
= help: only type `SuperStruct` is seen to implement the trait in this crate, consider using it directly instead | ||
= note: `SuperTrait` can be implemented in other crates; if you want to support your users passing their own types here, you can't refer to a specific type | ||
|
||
error[E0038]: the trait `SuperTrait` cannot be made into an object | ||
--> $DIR/issue-76535.rs:34:57 | ||
| | ||
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object | ||
| | ||
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> | ||
--> $DIR/issue-76535.rs:4:10 | ||
| | ||
LL | pub trait SuperTrait { | ||
| ---------- this trait cannot be made into an object... | ||
LL | type SubType<'a>: SubTrait where Self: 'a; | ||
| ^^^^^^^ ...because it contains the generic associated type `SubType` | ||
= help: consider moving `SubType` to another trait | ||
= help: only type `SuperStruct` is seen to implement the trait in this crate, consider using it directly instead | ||
= note: `SuperTrait` can be implemented in other crates; if you want to support your users passing their own types here, you can't refer to a specific type | ||
= note: required for the cast from `Box<SuperStruct>` to `Box<dyn SuperTrait<SubType<'_> = SubStruct<'_>>>` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0038, E0107. | ||
For more information about an error, try `rustc --explain E0038`. |
Oops, something went wrong.