about summary refs log tree commit diff
path: root/src/test/ui/inference
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2022-10-19 17:17:19 +0200
committerlcnr <rust@lcnr.de>2022-11-08 14:48:07 +0100
commitf1551bfc02845eb198a71cc5c0264bd71e336274 (patch)
tree25fe95d8c1d6cd83dfc7d794d062cdc9b84d6a6b /src/test/ui/inference
parentddfe1e87f7c85c03773c29180a931447fcd03b65 (diff)
downloadrust-f1551bfc02845eb198a71cc5c0264bd71e336274.tar.gz
rust-f1551bfc02845eb198a71cc5c0264bd71e336274.zip
selection failure: recompute applicable impls
Diffstat (limited to 'src/test/ui/inference')
-rw-r--r--src/test/ui/inference/cannot-infer-async.rs3
-rw-r--r--src/test/ui/inference/cannot-infer-closure.rs3
-rw-r--r--src/test/ui/inference/issue-71732.rs3
-rw-r--r--src/test/ui/inference/issue-72616.rs3
-rw-r--r--src/test/ui/inference/issue-72616.stderr18
-rw-r--r--src/test/ui/inference/question-mark-type-infer.rs3
6 files changed, 27 insertions, 6 deletions
diff --git a/src/test/ui/inference/cannot-infer-async.rs b/src/test/ui/inference/cannot-infer-async.rs
index e7fabd0ffbc..b5152d04f69 100644
--- a/src/test/ui/inference/cannot-infer-async.rs
+++ b/src/test/ui/inference/cannot-infer-async.rs
@@ -10,6 +10,7 @@ fn main() {
     let fut = async {
         make_unit()?;
 
-        Ok(()) //~ ERROR type annotations needed
+        Ok(())
+        //~^ ERROR type annotations needed
     };
 }
diff --git a/src/test/ui/inference/cannot-infer-closure.rs b/src/test/ui/inference/cannot-infer-closure.rs
index 1c350b18f5a..bd5d10b4173 100644
--- a/src/test/ui/inference/cannot-infer-closure.rs
+++ b/src/test/ui/inference/cannot-infer-closure.rs
@@ -1,6 +1,7 @@
 fn main() {
     let x = |a: (), b: ()| {
         Err(a)?;
-        Ok(b) //~ ERROR type annotations needed
+        Ok(b)
+        //~^ ERROR type annotations needed
     };
 }
diff --git a/src/test/ui/inference/issue-71732.rs b/src/test/ui/inference/issue-71732.rs
index 30063a0957c..8a9d2b235f0 100644
--- a/src/test/ui/inference/issue-71732.rs
+++ b/src/test/ui/inference/issue-71732.rs
@@ -15,7 +15,8 @@ use std::collections::hash_map::HashMap;
 
 fn foo(parameters: &HashMap<String, String>) -> bool {
     parameters
-        .get(&"key".into()) //~ ERROR: type annotations needed
+        .get(&"key".into())
+        //~^ ERROR type annotations needed
         .and_then(|found: &String| Some(false))
         .unwrap_or(false)
 }
diff --git a/src/test/ui/inference/issue-72616.rs b/src/test/ui/inference/issue-72616.rs
index 5e5a3babfe0..7b0f5936d84 100644
--- a/src/test/ui/inference/issue-72616.rs
+++ b/src/test/ui/inference/issue-72616.rs
@@ -18,7 +18,8 @@ pub fn main() {
     }
     {
         if String::from("a") == "a".try_into().unwrap() {}
-        //~^ ERROR: type annotations needed
+        //~^ ERROR type annotations needed
+        //~| ERROR type annotations needed
     }
     {
         let _: String = match "_".try_into() {
diff --git a/src/test/ui/inference/issue-72616.stderr b/src/test/ui/inference/issue-72616.stderr
index a71ce9a8ef2..da1a7ccdee1 100644
--- a/src/test/ui/inference/issue-72616.stderr
+++ b/src/test/ui/inference/issue-72616.stderr
@@ -16,6 +16,22 @@ help: try using a fully qualified path to specify the expected types
 LL |         if String::from("a") == <&str as TryInto<T>>::try_into("a").unwrap() {}
    |                                 +++++++++++++++++++++++++++++++   ~
 
-error: aborting due to previous error
+error[E0283]: type annotations needed
+  --> $DIR/issue-72616.rs:20:37
+   |
+LL |         if String::from("a") == "a".try_into().unwrap() {}
+   |                                     ^^^^^^^^
+   |
+   = note: multiple `impl`s satisfying `_: TryFrom<&str>` found in the following crates: `core`, `std`:
+           - impl<> TryFrom<&str> for std::sys_common::net::LookupHost;
+           - impl<T, U> TryFrom<U> for T
+             where U: Into<T>;
+   = note: required for `&str` to implement `TryInto<_>`
+help: try using a fully qualified path to specify the expected types
+   |
+LL |         if String::from("a") == <&str as TryInto<T>>::try_into("a").unwrap() {}
+   |                                 +++++++++++++++++++++++++++++++   ~
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0283`.
diff --git a/src/test/ui/inference/question-mark-type-infer.rs b/src/test/ui/inference/question-mark-type-infer.rs
index 64333a29313..10560f85ed4 100644
--- a/src/test/ui/inference/question-mark-type-infer.rs
+++ b/src/test/ui/inference/question-mark-type-infer.rs
@@ -7,7 +7,8 @@ fn f(x: &i32) -> Result<i32, ()> {
 
 fn g() -> Result<Vec<i32>, ()> {
     let l = [1, 2, 3, 4];
-    l.iter().map(f).collect()? //~ ERROR type annotations needed
+    l.iter().map(f).collect()?
+    //~^ ERROR type annotations needed
 }
 
 fn main() {