From b3480126d4acbd197836089257e9a4c751a78f5b Mon Sep 17 00:00:00 2001 From: Jad Ghalayini Date: Mon, 27 May 2019 19:37:20 -0400 Subject: [PATCH] Incorporated suggested changes --- src/librustc/error_codes.rs | 9 ++++----- .../associated-types-overridden-binding.stderr | 1 + .../associated-types-unconstrained.stderr | 1 + src/test/ui/issues/issue-12028.stderr | 1 + src/test/ui/question-mark-type-infer.stderr | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/librustc/error_codes.rs b/src/librustc/error_codes.rs index ef4d13096baa..6243e911bd5f 100644 --- a/src/librustc/error_codes.rs +++ b/src/librustc/error_codes.rs @@ -1217,7 +1217,7 @@ For example: ```compile_fail,E0284 fn foo() -> Result { let results = [Ok(true), Ok(false), Err(())].iter().cloned(); - let v : Vec = results.collect()?; + let v: Vec = results.collect()?; // Do things with v... Ok(true) } @@ -1228,7 +1228,7 @@ Hence, `results.collect()` can return any type implementing `FromIterator>`. On the other hand, the `?` operator can accept any type implementing `Try`. -The user of this code probably wants `collect()` to return a +The author of this code probably wants `collect()` to return a `Result, ()>`, but the compiler can't be sure that there isn't another type `T` implementing both `Try` and `FromIterator>` in scope such that @@ -1241,16 +1241,15 @@ To resolve this error, use a concrete type for the intermediate expression: fn foo() -> Result { let results = [Ok(true), Ok(false), Err(())].iter().cloned(); let v = { - let temp : Result, ()> = results.collect(); + let temp: Result, ()> = results.collect(); temp? }; // Do things with v... Ok(true) } ``` -Note that the type of `v` can now be inferred from the type of `temp` - +Note that the type of `v` can now be inferred from the type of `temp`. "##, E0308: r##" diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.stderr b/src/test/ui/associated-types/associated-types-overridden-binding.stderr index fced38caaba9..a26ee23894f6 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding.stderr @@ -12,3 +12,4 @@ LL | trait Foo: Iterator {} error: aborting due to previous error +For more information about this error, try `rustc --explain E0284`. diff --git a/src/test/ui/associated-types/associated-types-unconstrained.stderr b/src/test/ui/associated-types/associated-types-unconstrained.stderr index 26e5a6a503c6..da14a69ae306 100644 --- a/src/test/ui/associated-types/associated-types-unconstrained.stderr +++ b/src/test/ui/associated-types/associated-types-unconstrained.stderr @@ -6,3 +6,4 @@ LL | let x: isize = Foo::bar(); error: aborting due to previous error +For more information about this error, try `rustc --explain E0284`. diff --git a/src/test/ui/issues/issue-12028.stderr b/src/test/ui/issues/issue-12028.stderr index b9e2e80492b3..64694c7a8d0b 100644 --- a/src/test/ui/issues/issue-12028.stderr +++ b/src/test/ui/issues/issue-12028.stderr @@ -6,3 +6,4 @@ LL | self.input_stream(&mut stream); error: aborting due to previous error +For more information about this error, try `rustc --explain E0284`. diff --git a/src/test/ui/question-mark-type-infer.stderr b/src/test/ui/question-mark-type-infer.stderr index 2a1bdf57a88c..f62a540572c9 100644 --- a/src/test/ui/question-mark-type-infer.stderr +++ b/src/test/ui/question-mark-type-infer.stderr @@ -6,3 +6,4 @@ LL | l.iter().map(f).collect()? error: aborting due to previous error +For more information about this error, try `rustc --explain E0284`.