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#94911 - jackh726:gats_extended_2, r=compile…
…r-errors Make GATs object safe under generic_associated_types_extended feature Based on rust-lang#94869 Let's say we have ```rust trait StreamingIterator { type Item<'a> where Self: 'a; } ``` And `dyn for<'a> StreamingIterator<Item<'a> = &'a i32>`. If we ask `(dyn for<'a> StreamingIterator<Item<'a> = &'a i32>): StreamingIterator`, then we have to prove that `for<'x> (&'x i32): Sized`. So, we generate *new* bound vars to subst for the GAT generics. Importantly, this doesn't fully verify that these are usable and sound. r? `@nikomatsakis`
- Loading branch information
Showing
18 changed files
with
223 additions
and
44 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
4 changes: 2 additions & 2 deletions
4
...associated-types/gat-in-trait-path.stderr → ...iated-types/gat-in-trait-path.base.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
4 changes: 2 additions & 2 deletions
4
...-associated-types/issue-67510-pass.stderr → ...ciated-types/issue-67510-pass.base.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
// revisions: base extended | ||
//[base] check-fail | ||
//[extended] check-pass | ||
|
||
#![feature(generic_associated_types)] | ||
#![cfg_attr(extended, feature(generic_associated_types_extended))] | ||
#![cfg_attr(extended, allow(incomplete_features))] | ||
|
||
trait X { | ||
type Y<'a>; | ||
} | ||
|
||
fn _func1<'a>(_x: Box<dyn X<Y<'a>=&'a ()>>) {} | ||
//~^ ERROR the trait `X` cannot be made into an object | ||
//[base]~^ 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
19 changes: 19 additions & 0 deletions
19
src/test/ui/generic-associated-types/issue-76535.extended.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[E0107]: missing generics for associated type `SuperTrait::SubType` | ||
--> $DIR/issue-76535.rs:40: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:10: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: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0107`. |
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
19 changes: 19 additions & 0 deletions
19
src/test/ui/generic-associated-types/issue-78671.extended.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[E0107]: missing generics for associated type `CollectionFamily::Member` | ||
--> $DIR/issue-78671.rs:11:47 | ||
| | ||
LL | Box::new(Family) as &dyn CollectionFamily<Member=usize> | ||
| ^^^^^^ expected 1 generic argument | ||
| | ||
note: associated type defined here, with 1 generic parameter: `T` | ||
--> $DIR/issue-78671.rs:8:10 | ||
| | ||
LL | type Member<T>; | ||
| ^^^^^^ - | ||
help: add missing generic argument | ||
| | ||
LL | Box::new(Family) as &dyn CollectionFamily<Member<T>=usize> | ||
| ~~~~~~~~~ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0107`. |
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
Oops, something went wrong.