Skip to content

Commit b5cee77

Browse files
Remove unnecessary UnsatisfiedConst reporting logic
1 parent ca77504 commit b5cee77

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use super::on_unimplemented::{AppendConstMessage, OnUnimplementedNote};
3737
use super::suggestions::get_explanation_based_on_obligation;
3838
use super::{
3939
ArgKind, CandidateSimilarity, FindExprBySpan, GetSafeTransmuteErrorAndReason, ImplCandidate,
40-
UnsatisfiedConst,
4140
};
4241
use crate::error_reporting::TypeErrCtxt;
4342
use crate::error_reporting::infer::TyCategory;
@@ -374,13 +373,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
374373
}
375374
}
376375

377-
let UnsatisfiedConst(unsatisfied_const) = self
378-
.maybe_add_note_for_unsatisfied_const(
379-
leaf_trait_predicate,
380-
&mut err,
381-
span,
382-
);
383-
384376
if let Some((msg, span)) = type_def {
385377
err.span_label(span, msg);
386378
}
@@ -506,7 +498,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
506498
span,
507499
is_fn_trait,
508500
suggested,
509-
unsatisfied_const,
510501
);
511502

512503
// Changing mutability doesn't make a difference to whether we have
@@ -2716,7 +2707,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
27162707
span: Span,
27172708
is_fn_trait: bool,
27182709
suggested: bool,
2719-
unsatisfied_const: bool,
27202710
) {
27212711
let body_def_id = obligation.cause.body_id;
27222712
let span = if let ObligationCauseCode::BinOp { rhs_span: Some(rhs_span), .. } =
@@ -2763,10 +2753,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
27632753
self.tcx.def_span(trait_def_id),
27642754
crate::fluent_generated::trait_selection_trait_has_no_impls,
27652755
);
2766-
} else if !suggested
2767-
&& !unsatisfied_const
2768-
&& trait_predicate.polarity() == ty::PredicatePolarity::Positive
2769-
{
2756+
} else if !suggested && trait_predicate.polarity() == ty::PredicatePolarity::Positive {
27702757
// Can't show anything else useful, try to find similar impls.
27712758
let impl_candidates = self.find_similar_impl_candidates(trait_predicate);
27722759
if !self.report_similar_impl_candidates(
@@ -2878,17 +2865,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
28782865
}
28792866
}
28802867

2881-
fn maybe_add_note_for_unsatisfied_const(
2882-
&self,
2883-
_trait_predicate: ty::PolyTraitPredicate<'tcx>,
2884-
_err: &mut Diag<'_>,
2885-
_span: Span,
2886-
) -> UnsatisfiedConst {
2887-
let unsatisfied_const = UnsatisfiedConst(false);
2888-
// FIXME(const_trait_impl)
2889-
unsatisfied_const
2890-
}
2891-
28922868
fn report_closure_error(
28932869
&self,
28942870
obligation: &PredicateObligation<'tcx>,

compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ enum GetSafeTransmuteErrorAndReason {
5151
Error { err_msg: String, safe_transmute_explanation: Option<String> },
5252
}
5353

54-
struct UnsatisfiedConst(pub bool);
55-
5654
/// Crude way of getting back an `Expr` from a `Span`.
5755
pub struct FindExprBySpan<'hir> {
5856
pub span: Span,

0 commit comments

Comments
 (0)