-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
136 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#![feature(rustc_attrs, type_alias_impl_trait, impl_trait_in_assoc_type)] | ||
#![allow(internal_features)] | ||
#![rustc_variance_of_opaques] | ||
|
||
trait Captures<'a> {} | ||
impl<T> Captures<'_> for T {} | ||
|
||
type NotCapturedEarly<'a> = impl Sized; //~ [o] | ||
|
||
type CapturedEarly<'a> = impl Sized + Captures<'a>; //~ [o] | ||
|
||
type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; //~ [o] | ||
|
||
type CapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'b>>; //~ [o] | ||
|
||
type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a> + Captures<'b>>; //~ [o] | ||
|
||
type Bar<'a, 'b: 'b, T> = impl Sized; //~ ERROR [o, o, o] | ||
|
||
trait Foo<'i> { | ||
type ImplicitCapturedEarly<'a>; | ||
|
||
type ExplicitCaptureEarly<'a>; | ||
|
||
type ImplicitCaptureLate<'a>; | ||
|
||
type ExplicitCaptureLate<'a>; | ||
} | ||
|
||
impl<'i> Foo<'i> for &'i () { | ||
type ImplicitCapturedEarly<'a> = impl Sized; //~ [o, o] | ||
|
||
type ExplicitCaptureEarly<'a> = impl Sized + Captures<'i>; //~ [o, o] | ||
|
||
type ImplicitCaptureLate<'a> = impl Sized; //~ [o, o] | ||
|
||
type ExplicitCaptureLate<'a> = impl Sized + Captures<'a>; //~ [o, o] | ||
} | ||
|
||
impl<'i> Foo<'i> for () { | ||
type ImplicitCapturedEarly<'a> = impl Sized; //~ [o, o] | ||
|
||
type ExplicitCaptureEarly<'a> = impl Sized + Captures<'i>; //~ [o, o] | ||
|
||
type ImplicitCaptureLate<'a> = impl Sized; //~ [o, o] | ||
|
||
type ExplicitCaptureLate<'a> = impl Sized + Captures<'a>; //~ [o, o] | ||
} | ||
|
||
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,86 @@ | ||
error: [o] | ||
--> $DIR/variance.rs:8:29 | ||
| | ||
LL | type NotCapturedEarly<'a> = impl Sized; | ||
| ^^^^^^^^^^ | ||
|
||
error: [o] | ||
--> $DIR/variance.rs:10:26 | ||
| | ||
LL | type CapturedEarly<'a> = impl Sized + Captures<'a>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: [o] | ||
--> $DIR/variance.rs:12:56 | ||
| | ||
LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; | ||
| ^^^^^^^^^^ | ||
|
||
error: [o] | ||
--> $DIR/variance.rs:14:53 | ||
| | ||
LL | type CapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'b>>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: [o] | ||
--> $DIR/variance.rs:16:49 | ||
| | ||
LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a> + Captures<'b>>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: [o, o, o] | ||
--> $DIR/variance.rs:18:27 | ||
| | ||
LL | type Bar<'a, 'b: 'b, T> = impl Sized; | ||
| ^^^^^^^^^^ | ||
|
||
error: [o, o] | ||
--> $DIR/variance.rs:31:38 | ||
| | ||
LL | type ImplicitCapturedEarly<'a> = impl Sized; | ||
| ^^^^^^^^^^ | ||
|
||
error: [o, o] | ||
--> $DIR/variance.rs:33:37 | ||
| | ||
LL | type ExplicitCaptureEarly<'a> = impl Sized + Captures<'i>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: [o, o] | ||
--> $DIR/variance.rs:35:36 | ||
| | ||
LL | type ImplicitCaptureLate<'a> = impl Sized; | ||
| ^^^^^^^^^^ | ||
|
||
error: [o, o] | ||
--> $DIR/variance.rs:37:36 | ||
| | ||
LL | type ExplicitCaptureLate<'a> = impl Sized + Captures<'a>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: [o, o] | ||
--> $DIR/variance.rs:41:38 | ||
| | ||
LL | type ImplicitCapturedEarly<'a> = impl Sized; | ||
| ^^^^^^^^^^ | ||
|
||
error: [o, o] | ||
--> $DIR/variance.rs:43:37 | ||
| | ||
LL | type ExplicitCaptureEarly<'a> = impl Sized + Captures<'i>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: [o, o] | ||
--> $DIR/variance.rs:45:36 | ||
| | ||
LL | type ImplicitCaptureLate<'a> = impl Sized; | ||
| ^^^^^^^^^^ | ||
|
||
error: [o, o] | ||
--> $DIR/variance.rs:47:36 | ||
| | ||
LL | type ExplicitCaptureLate<'a> = impl Sized + Captures<'a>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 14 previous errors | ||
|