Clarify "infinite size" in cyclic-type diagnostic refers to the type name

This commit is contained in:
Haoran Wang
2026-05-23 12:53:44 +08:00
parent 3bf5c6d99b
commit c328459c20
12 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ fn report_maybe_different(expected: &str, found: &str) -> String {
}
match self {
TypeError::CyclicTy(_) => "cyclic type of infinite size".into(),
TypeError::CyclicTy(_) => "recursive type with infinite-size name".into(),
TypeError::CyclicConst(_) => "encountered a self-referencing constant".into(),
TypeError::Mismatch => "types differ".into(),
TypeError::PolarityMismatch(values) => {
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/closure-referencing-itself-issue-25954.rs:16:13
|
LL | let q = || p.b.set(5i32);
| ^^^^^^^^^^^^^^^^ cyclic type of infinite size
| ^^^^^^^^^^^^^^^^ recursive type with infinite-size name
error: aborting due to 1 previous error
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/generic-typed-nested-closures-59494.rs:21:40
|
LL | let t7 = |env| |a| |b| t7p(f, g)(((env, a), b));
| ^^^ cyclic type of infinite size
| ^^^ recursive type with infinite-size name
error: aborting due to 1 previous error
+1 -1
View File
@@ -2,7 +2,7 @@ error[E0644]: closure/coroutine type that references itself
--> $DIR/issue-25439.rs:8:9
|
LL | fix(|_, x| x);
| ^^^^^^ cyclic type of infinite size
| ^^^^^^ recursive type with infinite-size name
|
= note: closures cannot capture themselves or take themselves as argument;
this error may be the result of a recent compiler bug-fix,
@@ -21,7 +21,7 @@ fn bind() -> (T, Self) {
fn main() {
let (mut t, foo) = Foo::bind();
//~^ ERROR mismatched types
//~| NOTE cyclic type
//~| NOTE recursive type
// `t` is `ty::Infer(TyVar(?1t))`
// `foo` contains `ty::Infer(TyVar(?1t))` in its substs
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/unused-substs-2.rs:22:24
|
LL | let (mut t, foo) = Foo::bind();
| ^^^^^^^^^^^ cyclic type of infinite size
| ^^^^^^^^^^^ recursive type with infinite-size name
error: aborting due to 1 previous error
@@ -12,7 +12,7 @@
fn main() {
let (mut t, foo) = bind();
//~^ ERROR mismatched types
//~| NOTE cyclic type
//~| NOTE recursive type
// `t` is `ty::Infer(TyVar(?1t))`
// `foo` contains `ty::Infer(TyVar(?1t))` in its substs
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/unused-substs-3.rs:13:24
|
LL | let (mut t, foo) = bind();
| ^^^^^^ cyclic type of infinite size
| ^^^^^^ recursive type with infinite-size name
error: aborting due to 1 previous error
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/unused-substs-5.rs:15:19
|
LL | x = q::<_, N>(x);
| ^ cyclic type of infinite size
| ^ recursive type with infinite-size name
error: aborting due to 1 previous error
@@ -9,7 +9,7 @@ LL | |
LL | | if false { yield None.unwrap(); }
LL | | None.unwrap()
LL | | })
| |_____^ cyclic type of infinite size
| |_____^ recursive type with infinite-size name
|
= note: closures cannot capture themselves or take themselves as argument;
this error may be the result of a recent compiler bug-fix,
@@ -34,7 +34,7 @@ LL | |
LL | | if false { yield None.unwrap(); }
LL | | None.unwrap()
LL | | })
| |_____^ cyclic type of infinite size
| |_____^ recursive type with infinite-size name
|
= note: closures cannot capture themselves or take themselves as argument;
this error may be the result of a recent compiler bug-fix,
+1 -1
View File
@@ -2,7 +2,7 @@ error[E0644]: closure/coroutine type that references itself
--> $DIR/cyclic_type_ice.rs:3:7
|
LL | f(f);
| ^ cyclic type of infinite size
| ^ recursive type with infinite-size name
|
= note: closures cannot capture themselves or take themselves as argument;
this error may be the result of a recent compiler bug-fix,
@@ -2,7 +2,7 @@ error[E0644]: closure/coroutine type that references itself
--> $DIR/unboxed-closure-no-cyclic-sig.rs:8:7
|
LL | g(|_| { });
| ^^^ cyclic type of infinite size
| ^^^ recursive type with infinite-size name
|
= note: closures cannot capture themselves or take themselves as argument;
this error may be the result of a recent compiler bug-fix,