Skip to content

Commit 2c4b0b2

Browse files
committed
Make user_provided_sigs a LocalDefIdMap.
1 parent 290f078 commit 2c4b0b2

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

compiler/rustc_borrowck/src/type_check/input_output.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
4242
user_provided_sig = None;
4343
} else {
4444
let typeck_results = self.tcx().typeck(mir_def_id);
45-
user_provided_sig = typeck_results.user_provided_sigs.get(&mir_def_id.to_def_id()).map(
46-
|user_provided_poly_sig| {
45+
user_provided_sig =
46+
typeck_results.user_provided_sigs.get(&mir_def_id).map(|user_provided_poly_sig| {
4747
// Instantiate the canonicalized variables from
4848
// user-provided signature (e.g., the `_` in the code
4949
// above) with fresh variables.
@@ -60,8 +60,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
6060
LateBoundRegionConversionTime::FnCall,
6161
poly_sig,
6262
)
63-
},
64-
);
63+
});
6564
}
6665

6766
debug!(?normalized_input_tys, ?body.local_decls);

compiler/rustc_hir_typeck/src/closure.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
664664
let result = self.normalize_associated_types_in(self.tcx.hir().span(hir_id), result);
665665

666666
let c_result = self.inh.infcx.canonicalize_response(result);
667-
self.typeck_results.borrow_mut().user_provided_sigs.insert(expr_def_id, c_result);
667+
self.typeck_results
668+
.borrow_mut()
669+
.user_provided_sigs
670+
.insert(expr_def_id.expect_local(), c_result);
668671

669672
result
670673
}

compiler/rustc_hir_typeck/src/writeback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
514514
for (&def_id, c_sig) in fcx_typeck_results.user_provided_sigs.iter() {
515515
if cfg!(debug_assertions) && c_sig.needs_infer() {
516516
span_bug!(
517-
self.fcx.tcx.hir().span_if_local(def_id).unwrap(),
517+
self.fcx.tcx.def_span(def_id),
518518
"writeback: `{:?}` has inference variables",
519519
c_sig
520520
);

compiler/rustc_middle/src/ty/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use rustc_errors::{
4141
};
4242
use rustc_hir as hir;
4343
use rustc_hir::def::{DefKind, Res};
44-
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LOCAL_CRATE};
44+
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalDefIdMap, LOCAL_CRATE};
4545
use rustc_hir::definitions::Definitions;
4646
use rustc_hir::hir_id::OwnerId;
4747
use rustc_hir::intravisit::Visitor;
@@ -443,7 +443,7 @@ pub struct TypeckResults<'tcx> {
443443

444444
/// Stores the canonicalized types provided by the user. See also
445445
/// `AscribeUserType` statement in MIR.
446-
pub user_provided_sigs: DefIdMap<CanonicalPolyFnSig<'tcx>>,
446+
pub user_provided_sigs: LocalDefIdMap<CanonicalPolyFnSig<'tcx>>,
447447

448448
adjustments: ItemLocalMap<Vec<ty::adjustment::Adjustment<'tcx>>>,
449449

0 commit comments

Comments
 (0)