-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove generic_associated_types_extended feature gate
- Loading branch information
1 parent
3bff51e
commit 4eed6f6
Showing
24 changed files
with
312 additions
and
125 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
9 changes: 1 addition & 8 deletions
9
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
12 changes: 12 additions & 0 deletions
12
tests/ui/generic-associated-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0276]: impl has stricter requirements than trait | ||
--> $DIR/lending_iterator_2.rs:6:45 | ||
| | ||
LL | fn from_iter<T: for<'x> LendingIterator<Item<'x> = A>>(iter: T) -> Self; | ||
| ------------------------------------------------------------------------ definition of `from_iter` from trait | ||
... | ||
LL | fn from_iter<I: for<'x> LendingIterator<Item<'x> = A>>(mut iter: I) -> Self { | ||
| ^^^^^^^^^^^^ impl has extra requirement `I: 'x` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0276`. |
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.