Avoid various uses of Option<Span>
in favor of using DUMMY_SP
in the few cases that used None
This commit is contained in:
parent
1e30c2915b
commit
003c4bc7bf
@ -290,14 +290,14 @@ fn is_value_unfrozen_poly<'tcx>(&self, cx: &LateContext<'tcx>, body_id: BodyId,
|
|||||||
promoted: None,
|
promoted: None,
|
||||||
};
|
};
|
||||||
let param_env = cx.tcx.param_env(def_id).with_reveal_all_normalized(cx.tcx);
|
let param_env = cx.tcx.param_env(def_id).with_reveal_all_normalized(cx.tcx);
|
||||||
let result = cx.tcx.const_eval_global_id_for_typeck(param_env, cid, None);
|
let result = cx.tcx.const_eval_global_id_for_typeck(param_env, cid, rustc_span::DUMMY_SP);
|
||||||
self.is_value_unfrozen_raw(cx, result, ty)
|
self.is_value_unfrozen_raw(cx, result, ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_value_unfrozen_expr<'tcx>(&self, cx: &LateContext<'tcx>, hir_id: HirId, def_id: DefId, ty: Ty<'tcx>) -> bool {
|
fn is_value_unfrozen_expr<'tcx>(&self, cx: &LateContext<'tcx>, hir_id: HirId, def_id: DefId, ty: Ty<'tcx>) -> bool {
|
||||||
let args = cx.typeck_results().node_args(hir_id);
|
let args = cx.typeck_results().node_args(hir_id);
|
||||||
|
|
||||||
let result = Self::const_eval_resolve(cx.tcx, cx.param_env, ty::UnevaluatedConst::new(def_id, args), None);
|
let result = Self::const_eval_resolve(cx.tcx, cx.param_env, ty::UnevaluatedConst::new(def_id, args), rustc_span::DUMMY_SP);
|
||||||
self.is_value_unfrozen_raw(cx, result, ty)
|
self.is_value_unfrozen_raw(cx, result, ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ pub fn const_eval_resolve<'tcx>(
|
|||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
ct: ty::UnevaluatedConst<'tcx>,
|
ct: ty::UnevaluatedConst<'tcx>,
|
||||||
span: Option<Span>,
|
span: Span,
|
||||||
) -> EvalToValTreeResult<'tcx> {
|
) -> EvalToValTreeResult<'tcx> {
|
||||||
match ty::Instance::resolve(tcx, param_env, ct.def, ct.args) {
|
match ty::Instance::resolve(tcx, param_env, ct.def, ct.args) {
|
||||||
Ok(Some(instance)) => {
|
Ok(Some(instance)) => {
|
||||||
@ -315,8 +315,8 @@ pub fn const_eval_resolve<'tcx>(
|
|||||||
};
|
};
|
||||||
tcx.const_eval_global_id_for_typeck(param_env, cid, span)
|
tcx.const_eval_global_id_for_typeck(param_env, cid, span)
|
||||||
},
|
},
|
||||||
Ok(None) => Err(ErrorHandled::TooGeneric(span.unwrap_or(rustc_span::DUMMY_SP))),
|
Ok(None) => Err(ErrorHandled::TooGeneric(span)),
|
||||||
Err(err) => Err(ErrorHandled::Reported(err.into(), span.unwrap_or(rustc_span::DUMMY_SP))),
|
Err(err) => Err(ErrorHandled::Reported(err.into(), span)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -550,7 +550,7 @@ fn fetch_path(&mut self, qpath: &QPath<'_>, id: HirId, ty: Ty<'tcx>) -> Option<C
|
|||||||
let result = self
|
let result = self
|
||||||
.lcx
|
.lcx
|
||||||
.tcx
|
.tcx
|
||||||
.const_eval_resolve(self.param_env, mir::UnevaluatedConst::new(def_id, args), None)
|
.const_eval_resolve(self.param_env, mir::UnevaluatedConst::new(def_id, args), qpath.span())
|
||||||
.ok()
|
.ok()
|
||||||
.map(|val| rustc_middle::mir::Const::from_value(val, ty))?;
|
.map(|val| rustc_middle::mir::Const::from_value(val, ty))?;
|
||||||
let result = mir_to_const(self.lcx, result)?;
|
let result = mir_to_const(self.lcx, result)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user