about summary refs log tree commit diff
path: root/compiler/rustc_query_impl/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-17 14:49:05 +0000
committerbors <bors@rust-lang.org>2022-08-17 14:49:05 +0000
commit9c20b2a8cc7588decb6de25ac6a7912dcef24d65 (patch)
tree099d3858d3f4e681d153efb1761fb8951b08afa5 /compiler/rustc_query_impl/src
parent86c6ebee8fa0a5ad1e18e375113b06bd2849b634 (diff)
parent1199dbdcf5f651060c1cf1ab089c3feafcd54100 (diff)
downloadrust-9c20b2a8cc7588decb6de25ac6a7912dcef24d65.tar.gz
rust-9c20b2a8cc7588decb6de25ac6a7912dcef24d65.zip
Auto merge of #100677 - matthiaskrgr:rollup-au41ho1, r=matthiaskrgr
Rollup of 15 pull requests

Successful merges:

 - #99474 (Rustdoc json tests: New `@hasexact` test command)
 - #99972 (interpret: only consider 1-ZST when searching for receiver)
 - #100018 (Clean up `LitKind`)
 - #100379 (triagebot: add translation-related mention groups)
 - #100389 (Do not report cycle error when inferring return type for suggestion)
 - #100489 (`is_knowable` use `Result` instead of `Option`)
 - #100532 (unwind: don't build dependency when building for Miri)
 - #100608 (needless separation of impl blocks)
 - #100621 (Pass +atomics-32 feature for {arm,thumb}v4t-none-eabi)
 - #100646 (Migrate emoji identifier diagnostics to `SessionDiagnostic` in rustc_interface)
 - #100652 (Remove deferred sized checks (make them eager))
 - #100655 (Update books)
 - #100656 (Update cargo)
 - #100660 (Fixed a few documentation errors)
 - #100661 (Fixed a few documentation errors)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_query_impl/src')
-rw-r--r--compiler/rustc_query_impl/src/values.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/rustc_query_impl/src/values.rs b/compiler/rustc_query_impl/src/values.rs
index 718a2971c40..0ed48f8d4a0 100644
--- a/compiler/rustc_query_impl/src/values.rs
+++ b/compiler/rustc_query_impl/src/values.rs
@@ -43,3 +43,23 @@ impl<'tcx> Value<'tcx> for AdtSizedConstraint<'_> {
         }
     }
 }
+
+impl<'tcx> Value<'tcx> for ty::Binder<'_, ty::FnSig<'_>> {
+    fn from_cycle_error(tcx: QueryCtxt<'tcx>) -> Self {
+        let err = tcx.ty_error();
+        // FIXME(compiler-errors): It would be nice if we could get the
+        // query key, so we could at least generate a fn signature that
+        // has the right arity.
+        let fn_sig = ty::Binder::dummy(tcx.mk_fn_sig(
+            [].into_iter(),
+            err,
+            false,
+            rustc_hir::Unsafety::Normal,
+            rustc_target::spec::abi::Abi::Rust,
+        ));
+
+        // SAFETY: This is never called when `Self` is not `ty::Binder<'tcx, ty::FnSig<'tcx>>`.
+        // FIXME: Represent the above fact in the trait system somehow.
+        unsafe { std::mem::transmute::<ty::PolyFnSig<'tcx>, ty::Binder<'_, ty::FnSig<'_>>>(fn_sig) }
+    }
+}