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.
* Make some run-pass or check-pass * Use `#![allow(incomplete_features)]` * Update FIXMEs now that some of the issues have been addressed * Add regression tests
- Loading branch information
1 parent
0a5c91c
commit c268798
Showing
61 changed files
with
760 additions
and
546 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
error: type-generic associated types are not yet implemented | ||
--> $DIR/collections.rs:13:5 | ||
| | ||
LL | / type Sibling<U>: Collection<U> = | ||
LL | | <<Self as Collection<T>>::Family as CollectionFamily>::Member<U>; | ||
| |_________________________________________________________________________^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/44265 | ||
|
||
error: type-generic associated types are not yet implemented | ||
--> $DIR/collections.rs:25:5 | ||
| | ||
LL | type Member<T>: Collection<T, Family = Self>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/44265 | ||
|
||
error: aborting due to 2 previous errors | ||
|
26 changes: 26 additions & 0 deletions
26
src/test/ui/generic-associated-types/construct_with_other_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,26 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(generic_associated_types)] | ||
|
||
// FIXME(#30472) normalize enough to handle this. | ||
|
||
use std::ops::Deref; | ||
|
||
trait Foo { | ||
type Bar<'a, 'b>; | ||
} | ||
|
||
trait Baz { | ||
type Quux<'a>: Foo where Self: 'a; | ||
|
||
// This weird type tests that we can use universal function call syntax to access the Item on | ||
type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>> where Self: 'a; | ||
} | ||
|
||
impl<T> Baz for T where T: Foo { | ||
//~^ ERROR type mismatch resolving | ||
type Quux<'a> where T: 'a = T; | ||
|
||
type Baa<'a> where T: 'a = &'a <T as Foo>::Bar<'a, 'static>; | ||
} | ||
|
||
fn main() {} |
13 changes: 13 additions & 0 deletions
13
src/test/ui/generic-associated-types/construct_with_other_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,13 @@ | ||
error[E0271]: type mismatch resolving `for<'a> <<T as Baz>::Baa<'a> as std::ops::Deref>::Target == <<T as Baz>::Quux<'a> as Foo>::Bar<'a, 'static>` | ||
--> $DIR/construct_with_other_type.rs:19:9 | ||
| | ||
LL | impl<T> Baz for T where T: Foo { | ||
| ^^^ expected type parameter `T`, found associated type | ||
| | ||
= note: expected associated type `<T as Foo>::Bar<'_, 'static>` | ||
found associated type `<<T as Baz>::Quux<'_> as Foo>::Bar<'_, 'static>` | ||
= note: you might be missing a type parameter or trait bound | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0271`. |
2 changes: 1 addition & 1 deletion
2
...eneric-associated-types/empty_generics.rs → ...eneric-associated-types/empty_generics.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: expected one of `>`, `const`, identifier, or lifetime, found `,` | ||
--> $DIR/empty_generics.rs:5:14 | ||
| | ||
LL | type Bar<,>; | ||
| ^ expected one of `>`, `const`, identifier, or lifetime | ||
|
||
error: aborting due to previous error | ||
|
17 changes: 17 additions & 0 deletions
17
src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// rust-lang/rust#60654: Do not ICE on an attempt to use GATs that is | ||
// missing the feature gate. | ||
|
||
struct Foo; | ||
|
||
trait MyTrait { | ||
type Item<T>; | ||
//~^ ERROR generic associated types are unstable [E0658] | ||
//~| ERROR type-generic associated types are not yet implemented | ||
} | ||
|
||
impl MyTrait for Foo { | ||
type Item<T> = T; | ||
//~^ ERROR generic associated types are unstable [E0658] | ||
} | ||
|
||
fn main() { } |
29 changes: 29 additions & 0 deletions
29
src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-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,29 @@ | ||
error[E0658]: generic associated types are unstable | ||
--> $DIR/gat-dont-ice-on-absent-feature-2.rs:7:5 | ||
| | ||
LL | type Item<T>; | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/44265 | ||
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable | ||
|
||
error[E0658]: generic associated types are unstable | ||
--> $DIR/gat-dont-ice-on-absent-feature-2.rs:13:5 | ||
| | ||
LL | type Item<T> = T; | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/44265 | ||
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable | ||
|
||
error: type-generic associated types are not yet implemented | ||
--> $DIR/gat-dont-ice-on-absent-feature-2.rs:7:5 | ||
| | ||
LL | type Item<T>; | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/44265 | ||
|
||
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
19 changes: 19 additions & 0 deletions
19
src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.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,19 @@ | ||
error[E0658]: generic associated types are unstable | ||
--> $DIR/gat-dont-ice-on-absent-feature.rs:7:5 | ||
| | ||
LL | type Item<'b> = &'b Foo; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/44265 | ||
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable | ||
|
||
error[E0195]: lifetime parameters or bounds on type `Item` do not match the trait declaration | ||
--> $DIR/gat-dont-ice-on-absent-feature.rs:7:14 | ||
| | ||
LL | type Item<'b> = &'b Foo; | ||
| ^^^^ lifetimes do not match type in trait | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0195, E0658. | ||
For more information about an error, try `rustc --explain E0195`. |
File renamed without changes.
File renamed without changes.
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
26 changes: 26 additions & 0 deletions
26
src/test/ui/generic-associated-types/generic-associated-types-where.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,26 @@ | ||
error: type-generic associated types are not yet implemented | ||
--> $DIR/generic-associated-types-where.rs:11:5 | ||
| | ||
LL | type Assoc2<T> where T: Display; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/44265 | ||
|
||
error: type-generic associated types are not yet implemented | ||
--> $DIR/generic-associated-types-where.rs:13:5 | ||
| | ||
LL | type Assoc3<T>; | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/44265 | ||
|
||
error: type-generic associated types are not yet implemented | ||
--> $DIR/generic-associated-types-where.rs:15:5 | ||
| | ||
LL | type WithDefault<'a, T: Debug + 'a> = dyn Iterator<Item=T>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/44265 | ||
|
||
error: aborting due to 3 previous errors | ||
|
16 changes: 16 additions & 0 deletions
16
src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.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,16 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(generic_associated_types)] | ||
|
||
use std::ops::Deref; | ||
|
||
trait Iterable { | ||
type Item<'a>; | ||
type Iter<'a>: Iterator<Item = Self::Item<'a>> | ||
+ Deref<Target = Self::Item<'b>>; | ||
//~^ ERROR undeclared lifetime | ||
|
||
fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; | ||
//~^ ERROR undeclared lifetime | ||
} | ||
|
||
fn main() {} |
15 changes: 15 additions & 0 deletions
15
src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.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,15 @@ | ||
error[E0261]: use of undeclared lifetime name `'b` | ||
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:9:37 | ||
| | ||
LL | + Deref<Target = Self::Item<'b>>; | ||
| ^^ undeclared lifetime | ||
|
||
error[E0261]: use of undeclared lifetime name `'undeclared` | ||
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:12:41 | ||
| | ||
LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; | ||
| ^^^^^^^^^^^ undeclared lifetime | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0261`. |
Oops, something went wrong.