remove tcx from ObligationCauseCode::span
This commit is contained in:
parent
27b6ab9129
commit
78efaf43e4
10 changed files with 12 additions and 18 deletions
|
@ -714,10 +714,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn const_equate(&mut self, _a: Const<'tcx>, _b: Const<'tcx>) {
|
fn const_equate(&mut self, _a: Const<'tcx>, _b: Const<'tcx>) {
|
||||||
span_bug!(
|
span_bug!(self.cause.span(), "generic_const_exprs: unreachable `const_equate`");
|
||||||
self.cause.span(self.infcx.tcx),
|
|
||||||
"generic_const_exprs: unreachable `const_equate`"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn normalization() -> NormalizationStrategy {
|
fn normalization() -> NormalizationStrategy {
|
||||||
|
|
|
@ -1435,7 +1435,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
swap_secondary_and_primary: bool,
|
swap_secondary_and_primary: bool,
|
||||||
force_label: bool,
|
force_label: bool,
|
||||||
) {
|
) {
|
||||||
let span = cause.span(self.tcx);
|
let span = cause.span();
|
||||||
|
|
||||||
// For some types of errors, expected-found does not make
|
// For some types of errors, expected-found does not make
|
||||||
// sense, so just ignore the values we were given.
|
// sense, so just ignore the values we were given.
|
||||||
|
@ -2085,7 +2085,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
debug!("report_and_explain_type_error(trace={:?}, terr={:?})", trace, terr);
|
debug!("report_and_explain_type_error(trace={:?}, terr={:?})", trace, terr);
|
||||||
|
|
||||||
let span = trace.cause.span(self.tcx);
|
let span = trace.cause.span();
|
||||||
let failure_code = trace.cause.as_failure_code(terr);
|
let failure_code = trace.cause.as_failure_code(terr);
|
||||||
let mut diag = match failure_code {
|
let mut diag = match failure_code {
|
||||||
FailureCode::Error0038(did) => {
|
FailureCode::Error0038(did) => {
|
||||||
|
|
|
@ -204,7 +204,7 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
|
||||||
expected_substs: SubstsRef<'tcx>,
|
expected_substs: SubstsRef<'tcx>,
|
||||||
actual_substs: SubstsRef<'tcx>,
|
actual_substs: SubstsRef<'tcx>,
|
||||||
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
||||||
let span = cause.span(self.tcx());
|
let span = cause.span();
|
||||||
let msg = format!(
|
let msg = format!(
|
||||||
"implementation of `{}` is not general enough",
|
"implementation of `{}` is not general enough",
|
||||||
self.tcx().def_path_str(trait_def_id),
|
self.tcx().def_path_str(trait_def_id),
|
||||||
|
|
|
@ -27,10 +27,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
if let Some(span) = self.tcx.hir().span_if_local(trait_item_def_id) {
|
if let Some(span) = self.tcx.hir().span_if_local(trait_item_def_id) {
|
||||||
let item_name = self.tcx.item_name(impl_item_def_id.to_def_id());
|
let item_name = self.tcx.item_name(impl_item_def_id.to_def_id());
|
||||||
err.span_label(
|
err.span_label(span, format!("definition of `{}` from trait", item_name));
|
||||||
span,
|
|
||||||
format!("definition of `{}` from trait", item_name),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err.span_label(error_span, format!("impl has extra requirement {}", requirement));
|
err.span_label(error_span, format!("impl has extra requirement {}", requirement));
|
||||||
|
|
|
@ -139,7 +139,7 @@ impl<'tcx> ObligationCause<'tcx> {
|
||||||
ObligationCause { span, body_id: hir::CRATE_HIR_ID, code: Default::default() }
|
ObligationCause { span, body_id: hir::CRATE_HIR_ID, code: Default::default() }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn span(&self, _tcx: TyCtxt<'tcx>) -> Span {
|
pub fn span(&self) -> Span {
|
||||||
match *self.code() {
|
match *self.code() {
|
||||||
ObligationCauseCode::MatchExpressionArm(box MatchExpressionArmCause {
|
ObligationCauseCode::MatchExpressionArm(box MatchExpressionArmCause {
|
||||||
arm_span,
|
arm_span,
|
||||||
|
|
|
@ -603,7 +603,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
|
||||||
),
|
),
|
||||||
(Err(ErrorHandled::Linted), _) | (_, Err(ErrorHandled::Linted)) => {
|
(Err(ErrorHandled::Linted), _) | (_, Err(ErrorHandled::Linted)) => {
|
||||||
span_bug!(
|
span_bug!(
|
||||||
obligation.cause.span(self.selcx.tcx()),
|
obligation.cause.span(),
|
||||||
"ConstEquate: const_eval_resolve returned an unexpected error"
|
"ConstEquate: const_eval_resolve returned an unexpected error"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
||||||
// Run canonical query. If overflow occurs, rerun from scratch but this time
|
// Run canonical query. If overflow occurs, rerun from scratch but this time
|
||||||
// in standard trait query mode so that overflow is handled appropriately
|
// in standard trait query mode so that overflow is handled appropriately
|
||||||
// within `SelectionContext`.
|
// within `SelectionContext`.
|
||||||
self.tcx.at(obligation.cause.span(self.tcx)).evaluate_obligation(c_pred)
|
self.tcx.at(obligation.cause.span()).evaluate_obligation(c_pred)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function that canonicalizes and runs the query. If an
|
// Helper function that canonicalizes and runs the query. If an
|
||||||
|
|
|
@ -742,7 +742,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
| (_, Err(ErrorHandled::Reported(_))) => Ok(EvaluatedToErr),
|
| (_, Err(ErrorHandled::Reported(_))) => Ok(EvaluatedToErr),
|
||||||
(Err(ErrorHandled::Linted), _) | (_, Err(ErrorHandled::Linted)) => {
|
(Err(ErrorHandled::Linted), _) | (_, Err(ErrorHandled::Linted)) => {
|
||||||
span_bug!(
|
span_bug!(
|
||||||
obligation.cause.span(self.tcx()),
|
obligation.cause.span(),
|
||||||
"ConstEquate: const_eval_resolve returned an unexpected error"
|
"ConstEquate: const_eval_resolve returned an unexpected error"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,7 @@ fn compare_predicate_entailment<'tcx>(
|
||||||
|
|
||||||
let mut diag = struct_span_err!(
|
let mut diag = struct_span_err!(
|
||||||
tcx.sess,
|
tcx.sess,
|
||||||
cause.span(tcx),
|
cause.span(),
|
||||||
E0053,
|
E0053,
|
||||||
"method `{}` has an incompatible type for trait",
|
"method `{}` has an incompatible type for trait",
|
||||||
trait_m.name
|
trait_m.name
|
||||||
|
@ -492,7 +492,7 @@ fn extract_spans_for_error_reporting<'a, 'tcx>(
|
||||||
TypeError::ArgumentSorts(ExpectedFound { .. }, i) => {
|
TypeError::ArgumentSorts(ExpectedFound { .. }, i) => {
|
||||||
(impl_args.nth(i).unwrap(), trait_args.and_then(|mut args| args.nth(i)))
|
(impl_args.nth(i).unwrap(), trait_args.and_then(|mut args| args.nth(i)))
|
||||||
}
|
}
|
||||||
_ => (cause.span(tcx), tcx.hir().span_if_local(trait_m.def_id)),
|
_ => (cause.span(), tcx.hir().span_if_local(trait_m.def_id)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1838,7 +1838,7 @@ fn check_false_global_bounds(fcx: &FnCtxt<'_, '_>, mut span: Span, id: hir::HirI
|
||||||
if let Some(hir::Generics { predicates, .. }) =
|
if let Some(hir::Generics { predicates, .. }) =
|
||||||
hir_node.and_then(|node| node.generics())
|
hir_node.and_then(|node| node.generics())
|
||||||
{
|
{
|
||||||
let obligation_span = obligation.cause.span(fcx.tcx);
|
let obligation_span = obligation.cause.span();
|
||||||
|
|
||||||
span = predicates
|
span = predicates
|
||||||
.iter()
|
.iter()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue