about summary refs log tree commit diff
path: root/compiler/rustc_query_impl
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-08-03 16:58:56 +0000
committerbors <bors@rust-lang.org>2021-08-03 16:58:56 +0000
commitc6bc102fea9f9274202d0bc55a0fef8a3bc92426 (patch)
tree467d0caf4e7b1c0defb58a75a5585eb3f95aecbd /compiler/rustc_query_impl
parentd5fd37f00f1ec5e4a4b0d87f5af0b93f36aab271 (diff)
parent3cb625e4683c43991de6fc27d6b4e0db5a34011f (diff)
downloadrust-c6bc102fea9f9274202d0bc55a0fef8a3bc92426.tar.gz
rust-c6bc102fea9f9274202d0bc55a0fef8a3bc92426.zip
Auto merge of #87515 - crlf0710:trait_upcasting_part2, r=bjorn3
Trait upcasting coercion (part2)

This is the second part of trait upcasting coercion implementation.

Currently this is blocked on #86264 .

The third part might be implemented using unsafety checking

r? `@bjorn3`
Diffstat (limited to 'compiler/rustc_query_impl')
-rw-r--r--compiler/rustc_query_impl/src/keys.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_query_impl/src/keys.rs b/compiler/rustc_query_impl/src/keys.rs
index 0ad360c7d89..ace7cffd16d 100644
--- a/compiler/rustc_query_impl/src/keys.rs
+++ b/compiler/rustc_query_impl/src/keys.rs
@@ -282,6 +282,16 @@ impl<'tcx> Key for ty::PolyTraitRef<'tcx> {
     }
 }
 
+impl<'tcx> Key for (ty::PolyTraitRef<'tcx>, ty::PolyTraitRef<'tcx>) {
+    #[inline(always)]
+    fn query_crate_is_local(&self) -> bool {
+        self.0.def_id().krate == LOCAL_CRATE
+    }
+    fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
+        tcx.def_span(self.0.def_id())
+    }
+}
+
 impl<'tcx> Key for GenericArg<'tcx> {
     #[inline(always)]
     fn query_crate_is_local(&self) -> bool {