Skip to content

Commit ab01463

Browse files
committed
Show that the opaque type works in the new solver and is actually instantiatable
1 parent 1474ee5 commit ab01463

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

tests/ui/type-alias-impl-trait/self-referential-in-fn-trait.stderr renamed to tests/ui/type-alias-impl-trait/self-referential-in-fn-trait.next.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: unconstrained opaque type
2-
--> $DIR/self-referential-in-fn-trait.rs:3:16
2+
--> $DIR/self-referential-in-fn-trait.rs:13:16
33
|
44
LL | type Foo<'a> = impl Fn() -> Foo<'a>;
55
| ^^^^^^^^^^^^^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: unconstrained opaque type
2+
--> $DIR/self-referential-in-fn-trait.rs:13:16
3+
|
4+
LL | type Foo<'a> = impl Fn() -> Foo<'a>;
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `Foo` must be used in combination with a concrete type within the same module
8+
9+
error: aborting due to previous error
10+
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1+
//! This test checks that we do not
2+
//! end up with an infinite recursion,
3+
//! a cycle error or an overflow when
4+
//! encountering an opaque type that has
5+
//! an associated type that is just itself
6+
//! again.
7+
18
#![feature(type_alias_impl_trait)]
9+
// revisions: next old working
10+
//[next] compile-flags: -Ztrait-solver=next
11+
//[working] check-pass
212

313
type Foo<'a> = impl Fn() -> Foo<'a>;
4-
//~^ ERROR: unconstrained opaque type
14+
//[old,next]~^ ERROR: unconstrained opaque type
515

616
fn crash<'a>(_: &'a (), x: Foo<'a>) -> Foo<'a> {
717
x
818
}
919

20+
#[cfg(working)]
21+
fn foo<'a>() -> Foo<'a> {
22+
foo
23+
}
24+
1025
fn main() {}

0 commit comments

Comments
 (0)