From e29765250b84809dc11fc26220dfcc544680d582 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Sat, 25 Jul 2020 21:27:34 +0100 Subject: [PATCH] Don't immediately error for recursive projections --- compiler/rustc_error_codes/src/error_codes/E0284.md | 2 +- .../associated-type-bounds/bad-bounds-on-assoc-in-trait.rs | 4 +++- .../bad-bounds-on-assoc-in-trait.stderr | 6 +++--- src/test/ui/associated-types/defaults-cyclic-fail-1.stderr | 7 +++---- src/test/ui/associated-types/defaults-cyclic-fail-2.stderr | 4 ++-- src/test/ui/issues/issue-21946.stderr | 2 +- src/test/ui/issues/issue-23122-1.stderr | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/compiler/rustc_error_codes/src/error_codes/E0284.md b/compiler/rustc_error_codes/src/error_codes/E0284.md index 18519b471b2..82598aeec02 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0284.md +++ b/compiler/rustc_error_codes/src/error_codes/E0284.md @@ -14,7 +14,7 @@ fn main() { Here we have an addition of `d` and `n.into()`. Hence, `n.into()` can return any type `T` where `u64: Add`. On the other hand, the `into` method can -rteurn any type where `u32: Into`. +return any type where `u32: Into`. The author of this code probably wants `into()` to return a `u64`, but the compiler can't be sure that there isn't another type `T` where both diff --git a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.rs b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.rs index 8093c4b9d9e..4f9100b6774 100644 --- a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.rs +++ b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.rs @@ -24,7 +24,9 @@ impl<'a, 'b> Lam<&'a &'b u8> for L2 { trait Case1 { type C: Clone + Iterator Lam<&'a u8, App: Debug>> + Sync>; - //~^ ERROR overflow evaluating the requirement `<::C as std::iter::Iterator>::Item` + //~^ ERROR `<::C as std::iter::Iterator>::Item` is not an iterator + //~| ERROR `<::C as std::iter::Iterator>::Item` cannot be sent between threads safely + //~| ERROR `<::C as std::iter::Iterator>::Item` cannot be shared between threads safely } pub struct S1; diff --git a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr index abaae7e5343..c95c5ca5884 100644 --- a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr +++ b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `<::C as std::iter::Iterator>::Item` +error[E0277]: `<::C as std::iter::Iterator>::Item` is not an iterator --> $DIR/bad-bounds-on-assoc-in-trait.rs:28:5 | LL | / type C: Clone + Iterator::C as std::iter::Iterator>::Item: std::marker::Sync { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/associated-types/defaults-cyclic-fail-1.stderr b/src/test/ui/associated-types/defaults-cyclic-fail-1.stderr index 28decb0934c..ae7150d47ca 100644 --- a/src/test/ui/associated-types/defaults-cyclic-fail-1.stderr +++ b/src/test/ui/associated-types/defaults-cyclic-fail-1.stderr @@ -1,10 +1,10 @@ -error[E0275]: overflow evaluating the requirement `::B` +error[E0271]: type mismatch resolving `::B == _` --> $DIR/defaults-cyclic-fail-1.rs:26:5 | LL | type A = Box; | ^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size -error[E0275]: overflow evaluating the requirement `::A` +error[E0271]: type mismatch resolving `::A == _` --> $DIR/defaults-cyclic-fail-1.rs:32:5 | LL | type B = &'static Self::A; @@ -12,5 +12,4 @@ LL | type B = &'static Self::A; error: aborting due to 2 previous errors -Some errors have detailed explanations: E0271, E0275. -For more information about an error, try `rustc --explain E0271`. +For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/associated-types/defaults-cyclic-fail-2.stderr b/src/test/ui/associated-types/defaults-cyclic-fail-2.stderr index 6b6d5348c15..0dfbac2dec5 100644 --- a/src/test/ui/associated-types/defaults-cyclic-fail-2.stderr +++ b/src/test/ui/associated-types/defaults-cyclic-fail-2.stderr @@ -1,10 +1,10 @@ -error[E0275]: overflow evaluating the requirement `::B` +error[E0271]: type mismatch resolving `::B == _` --> $DIR/defaults-cyclic-fail-2.rs:27:5 | LL | type A = Box; | ^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size -error[E0275]: overflow evaluating the requirement `::A` +error[E0271]: type mismatch resolving `::A == _` --> $DIR/defaults-cyclic-fail-2.rs:33:5 | LL | type B = &'static Self::A; diff --git a/src/test/ui/issues/issue-21946.stderr b/src/test/ui/issues/issue-21946.stderr index 8b96e0f3382..0497bd20469 100644 --- a/src/test/ui/issues/issue-21946.stderr +++ b/src/test/ui/issues/issue-21946.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `::A` +error[E0275]: overflow evaluating the requirement `::A == _` --> $DIR/issue-21946.rs:8:5 | LL | type A = ::A; diff --git a/src/test/ui/issues/issue-23122-1.stderr b/src/test/ui/issues/issue-23122-1.stderr index f8374905370..1f78b0d152d 100644 --- a/src/test/ui/issues/issue-23122-1.stderr +++ b/src/test/ui/issues/issue-23122-1.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement ` as Next>::Next` +error[E0275]: overflow evaluating the requirement ` as Next>::Next == _` --> $DIR/issue-23122-1.rs:8:5 | LL | type Next = as Next>::Next;