]> git.lizzy.rs Git - rust.git/commitdiff
Make user_provided_sigs a LocalDefIdMap.
authorCamille GILLOT <gillot.camille@gmail.com>
Sun, 6 Nov 2022 18:11:32 +0000 (18:11 +0000)
committerCamille GILLOT <gillot.camille@gmail.com>
Sun, 13 Nov 2022 14:04:42 +0000 (14:04 +0000)
compiler/rustc_borrowck/src/type_check/input_output.rs
compiler/rustc_hir_typeck/src/closure.rs
compiler/rustc_hir_typeck/src/writeback.rs
compiler/rustc_middle/src/ty/context.rs

index a66ddd27dbb2ee178b2fccfc6924e63fb7ee797a..62c6f9581373edd69ff70e5236cec85ee6c15fc6 100644 (file)
@@ -42,8 +42,8 @@ pub(super) fn equate_inputs_and_outputs(
             user_provided_sig = None;
         } else {
             let typeck_results = self.tcx().typeck(mir_def_id);
-            user_provided_sig = typeck_results.user_provided_sigs.get(&mir_def_id.to_def_id()).map(
-                |user_provided_poly_sig| {
+            user_provided_sig =
+                typeck_results.user_provided_sigs.get(&mir_def_id).map(|user_provided_poly_sig| {
                     // Instantiate the canonicalized variables from
                     // user-provided signature (e.g., the `_` in the code
                     // above) with fresh variables.
@@ -60,8 +60,7 @@ pub(super) fn equate_inputs_and_outputs(
                         LateBoundRegionConversionTime::FnCall,
                         poly_sig,
                     )
-                },
-            );
+                });
         }
 
         debug!(?normalized_input_tys, ?body.local_decls);
index 3001e7994767296fc940ee2e653953c89b0dd1a3..7a881acee4217f77b405617d42e593817e374195 100644 (file)
@@ -664,7 +664,10 @@ fn supplied_sig_of_closure(
         let result = self.normalize_associated_types_in(self.tcx.hir().span(hir_id), result);
 
         let c_result = self.inh.infcx.canonicalize_response(result);
-        self.typeck_results.borrow_mut().user_provided_sigs.insert(expr_def_id, c_result);
+        self.typeck_results
+            .borrow_mut()
+            .user_provided_sigs
+            .insert(expr_def_id.expect_local(), c_result);
 
         result
     }
index 1e26daa9c2c72fa08054bb812935cbb2f3179f08..2eca40d678a849c48633b738d34bf022907c88ce 100644 (file)
@@ -514,7 +514,7 @@ fn visit_user_provided_sigs(&mut self) {
         for (&def_id, c_sig) in fcx_typeck_results.user_provided_sigs.iter() {
             if cfg!(debug_assertions) && c_sig.needs_infer() {
                 span_bug!(
-                    self.fcx.tcx.hir().span_if_local(def_id).unwrap(),
+                    self.fcx.tcx.def_span(def_id),
                     "writeback: `{:?}` has inference variables",
                     c_sig
                 );
index 8f96f5a9eb3e99b3e8db919853a31c4c5aff0b0b..1c714f594253aad47b83cbac6631f662568662a3 100644 (file)
@@ -41,7 +41,7 @@
 };
 use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Res};
-use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LOCAL_CRATE};
+use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalDefIdMap, LOCAL_CRATE};
 use rustc_hir::definitions::Definitions;
 use rustc_hir::hir_id::OwnerId;
 use rustc_hir::intravisit::Visitor;
@@ -443,7 +443,7 @@ pub struct TypeckResults<'tcx> {
 
     /// Stores the canonicalized types provided by the user. See also
     /// `AscribeUserType` statement in MIR.
-    pub user_provided_sigs: DefIdMap<CanonicalPolyFnSig<'tcx>>,
+    pub user_provided_sigs: LocalDefIdMap<CanonicalPolyFnSig<'tcx>>,
 
     adjustments: ItemLocalMap<Vec<ty::adjustment::Adjustment<'tcx>>>,