about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-10-23 23:49:46 +0000
committerMichael Goulet <michael@errs.io>2024-10-24 01:48:44 +0000
commitd8dc31fd3d2a03bc4b01974328c92d2ffb2f4fea (patch)
treeee3dc46be9840ae6f3a5235ba6330c4bf43349c5 /tests/ui
parentb8bb2968ce1e44d01520c9d59ee6299ed66df3f9 (diff)
downloadrust-d8dc31fd3d2a03bc4b01974328c92d2ffb2f4fea.tar.gz
rust-d8dc31fd3d2a03bc4b01974328c92d2ffb2f4fea.zip
Consider param-env candidates even if they have errors
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/async-await/in-trait/unconstrained-impl-region.rs1
-rw-r--r--tests/ui/async-await/in-trait/unconstrained-impl-region.stderr17
-rw-r--r--tests/ui/traits/error-reporting/apit-with-bad-path.rs10
-rw-r--r--tests/ui/traits/error-reporting/apit-with-bad-path.stderr14
-rw-r--r--tests/ui/traits/error-reporting/where-clause-with-bad-path.rs10
-rw-r--r--tests/ui/traits/error-reporting/where-clause-with-bad-path.stderr14
6 files changed, 50 insertions, 16 deletions
diff --git a/tests/ui/async-await/in-trait/unconstrained-impl-region.rs b/tests/ui/async-await/in-trait/unconstrained-impl-region.rs
index 95ba1f3f277..9382c232364 100644
--- a/tests/ui/async-await/in-trait/unconstrained-impl-region.rs
+++ b/tests/ui/async-await/in-trait/unconstrained-impl-region.rs
@@ -14,7 +14,6 @@ impl<'a> Actor for () {
 //~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
     type Message = &'a ();
     async fn on_mount(self, _: impl Inbox<&'a ()>) {}
-    //~^ ERROR the trait bound `impl Inbox<&'a ()>: Inbox<&'a ()>` is not satisfied
 }
 
 fn main() {}
diff --git a/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr b/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr
index 80dc5fdc747..ef7e4ef0eb8 100644
--- a/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr
+++ b/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr
@@ -1,22 +1,9 @@
-error[E0277]: the trait bound `impl Inbox<&'a ()>: Inbox<&'a ()>` is not satisfied
-  --> $DIR/unconstrained-impl-region.rs:16:5
-   |
-LL |     async fn on_mount(self, _: impl Inbox<&'a ()>) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Inbox<&'a ()>` is not implemented for `impl Inbox<&'a ()>`
-   |
-note: required by a bound in `<() as Actor>::on_mount`
-  --> $DIR/unconstrained-impl-region.rs:16:37
-   |
-LL |     async fn on_mount(self, _: impl Inbox<&'a ()>) {}
-   |                                     ^^^^^^^^^^^^^ required by this bound in `<() as Actor>::on_mount`
-
 error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
   --> $DIR/unconstrained-impl-region.rs:13:6
    |
 LL | impl<'a> Actor for () {
    |      ^^ unconstrained lifetime parameter
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0207, E0277.
-For more information about an error, try `rustc --explain E0207`.
+For more information about this error, try `rustc --explain E0207`.
diff --git a/tests/ui/traits/error-reporting/apit-with-bad-path.rs b/tests/ui/traits/error-reporting/apit-with-bad-path.rs
new file mode 100644
index 00000000000..57184b9d0a9
--- /dev/null
+++ b/tests/ui/traits/error-reporting/apit-with-bad-path.rs
@@ -0,0 +1,10 @@
+// Ensure that we don't emit an E0270 for "`impl AsRef<Path>: AsRef<Path>` not satisfied".
+
+fn foo(filename: impl AsRef<Path>) {
+    //~^ ERROR cannot find type `Path` in this scope
+    std::fs::write(filename, "hello").unwrap();
+}
+
+fn main() {
+    foo("/tmp/hello");
+}
diff --git a/tests/ui/traits/error-reporting/apit-with-bad-path.stderr b/tests/ui/traits/error-reporting/apit-with-bad-path.stderr
new file mode 100644
index 00000000000..19bd5e78b47
--- /dev/null
+++ b/tests/ui/traits/error-reporting/apit-with-bad-path.stderr
@@ -0,0 +1,14 @@
+error[E0412]: cannot find type `Path` in this scope
+  --> $DIR/apit-with-bad-path.rs:3:29
+   |
+LL | fn foo(filename: impl AsRef<Path>) {
+   |                             ^^^^ not found in this scope
+   |
+help: consider importing this struct
+   |
+LL + use std::path::Path;
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/traits/error-reporting/where-clause-with-bad-path.rs b/tests/ui/traits/error-reporting/where-clause-with-bad-path.rs
new file mode 100644
index 00000000000..cbe14887de4
--- /dev/null
+++ b/tests/ui/traits/error-reporting/where-clause-with-bad-path.rs
@@ -0,0 +1,10 @@
+// Ensure that we don't emit an E0270 for "`impl AsRef<Path>: AsRef<Path>` not satisfied".
+
+fn foo<T: AsRef<Path>>(filename: T) {
+    //~^ ERROR cannot find type `Path` in this scope
+    std::fs::write(filename, "hello").unwrap();
+}
+
+fn main() {
+    foo("/tmp/hello");
+}
diff --git a/tests/ui/traits/error-reporting/where-clause-with-bad-path.stderr b/tests/ui/traits/error-reporting/where-clause-with-bad-path.stderr
new file mode 100644
index 00000000000..1137178f611
--- /dev/null
+++ b/tests/ui/traits/error-reporting/where-clause-with-bad-path.stderr
@@ -0,0 +1,14 @@
+error[E0412]: cannot find type `Path` in this scope
+  --> $DIR/where-clause-with-bad-path.rs:3:17
+   |
+LL | fn foo<T: AsRef<Path>>(filename: T) {
+   |                 ^^^^ not found in this scope
+   |
+help: consider importing this struct
+   |
+LL + use std::path::Path;
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0412`.