Skip to content

Commit 7bf6fc1

Browse files
committed
tests: add variance test for const traits
Added to demonstrate change in output in following commit. Many more interesting tests change with different output, missing errors, new errors, etc related to this but they all depend on feature flags and are much more complex than this.
1 parent ad27045 commit 7bf6fc1

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![feature(rustc_attrs, const_trait_impl)]
2+
#![allow(internal_features)]
3+
#![rustc_variance_of_opaques]
4+
5+
#[const_trait]
6+
trait Foo {}
7+
8+
impl const Foo for () {}
9+
10+
fn foo<'a: 'a>() -> impl const Foo {}
11+
//~^ ERROR ['a: o]
12+
13+
fn main() {}
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: ['a: o]
2+
--> $DIR/variance.rs:10:21
3+
|
4+
LL | fn foo<'a: 'a>() -> impl const Foo {}
5+
| ^^^^^^^^^^^^^^
6+
7+
error: aborting due to 1 previous error
8+

0 commit comments

Comments
 (0)