Make user_provided_sigs a LocalDefIdMap.
This commit is contained in:
parent
290f0781b4
commit
2c4b0b29cf
@ -42,8 +42,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
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 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
LateBoundRegionConversionTime::FnCall,
|
||||
poly_sig,
|
||||
)
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
debug!(?normalized_input_tys, ?body.local_decls);
|
||||
|
@ -664,7 +664,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
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
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||
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
|
||||
);
|
||||
|
@ -41,7 +41,7 @@ use rustc_errors::{
|
||||
};
|
||||
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>>>,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user