about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-17 16:28:37 +0000
committerbors <bors@rust-lang.org>2023-12-17 16:28:37 +0000
commitd14e52b47ab27bcc3c3e083ed5f009a57db63eff (patch)
tree957393900fddfc8cd487d8386067c6350da84fd3 /tests
parent3a2aa5854cbeb6fea24d6d0175d16c734aa9302e (diff)
parent64e311add2361600d22688554f0229fdf5a19ba3 (diff)
downloadrust-d14e52b47ab27bcc3c3e083ed5f009a57db63eff.tar.gz
rust-d14e52b47ab27bcc3c3e083ed5f009a57db63eff.zip
Auto merge of #117884 - bvanjoi:fix-117794, r=compiler-errors
skip rpit constraint checker if borrowck return type error

Fixes #117794
Fixes #117886
Fixes #119025

Prior to change #117418, the value of `concrete_opaque_types` for `mir_borrock(T::a::opaque)` was `None`. However, due to modifications in `body.local_decls`, the return value had been changed.

The changed of `body.local_decls` has let to the addition of `ty:Error` to `infcx.opaque_type_storage.opaque_types` during `TypeChecker::equate_inputs_and_outputs`. This is due to it utilizing the output of a function signature that was appended during `construct_error`(which previously only appended a `ty::Error`) and then execute `TypeChecker::Related_types`.

Therefore, in this PR, I've implemented a condition to bypass the rpit check when an error is encountered.

r? `@compiler-errors`
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/traits/issue-117794.rs10
-rw-r--r--tests/ui/traits/issue-117794.stderr9
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/traits/issue-117794.rs b/tests/ui/traits/issue-117794.rs
new file mode 100644
index 00000000000..a66d6eb10ed
--- /dev/null
+++ b/tests/ui/traits/issue-117794.rs
@@ -0,0 +1,10 @@
+trait Foo {}
+
+trait T {
+    fn a(&self) -> impl Foo {
+        self.b(|| 0)
+        //~^ ERROR no method named `b` found for reference `&Self` in the current scope
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/traits/issue-117794.stderr b/tests/ui/traits/issue-117794.stderr
new file mode 100644
index 00000000000..af63b47f07d
--- /dev/null
+++ b/tests/ui/traits/issue-117794.stderr
@@ -0,0 +1,9 @@
+error[E0599]: no method named `b` found for reference `&Self` in the current scope
+  --> $DIR/issue-117794.rs:5:14
+   |
+LL |         self.b(|| 0)
+   |              ^ help: there is a method with a similar name: `a`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0599`.