]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_middle/query/mod.rs
Helper method for whether type has structural equality
[rust.git] / src / librustc_middle / query / mod.rs
index 5a3ab205fc2381d323fe1a898d2a2ab0103e2192..be15e6c576f69379f628818b89adda626770167b 100644 (file)
@@ -735,7 +735,7 @@ fn describe_as_module(def_id: DefId, tcx: TyCtxt<'_>) -> String {
     Codegen {
         query codegen_fulfill_obligation(
             key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)
-        ) -> Result<Vtable<'tcx, ()>, ErrorReported> {
+        ) -> Result<ImplSource<'tcx, ()>, ErrorReported> {
             cache_on_disk_if { true }
             desc { |tcx|
                 "checking if `{}` fulfills its obligations",
@@ -789,6 +789,17 @@ fn describe_as_module(def_id: DefId, tcx: TyCtxt<'_>) -> String {
             desc { "computing whether `{}` needs drop", env.value }
         }
 
+        /// Query backing `TyS::is_structural_eq_shallow`.
+        ///
+        /// This is only correct for ADTs. Call `is_structural_eq_shallow` to handle all types
+        /// correctly.
+        query has_structural_eq_impls(ty: Ty<'tcx>) -> bool {
+            desc {
+                "computing whether `{:?}` implements `PartialStructuralEq` and `StructuralEq`",
+                ty
+            }
+        }
+
         /// A list of types where the ADT requires drop if and only if any of
         /// those types require drop. If the ADT is known to always need drop
         /// then `Err(AlwaysRequiresDrop)` is returned.
@@ -865,8 +876,8 @@ fn describe_as_module(def_id: DefId, tcx: TyCtxt<'_>) -> String {
     }
 
     Other {
-        query module_exports(def_id: DefId) -> Option<&'tcx [Export<hir::HirId>]> {
-            desc { |tcx| "looking up items exported by `{}`", tcx.def_path_str(def_id) }
+        query module_exports(def_id: LocalDefId) -> Option<&'tcx [Export<LocalDefId>]> {
+            desc { |tcx| "looking up items exported by `{}`", tcx.def_path_str(def_id.to_def_id()) }
             eval_always
         }
     }