Skip to content

Commit 5f33a8c

Browse files
authored
Rollup merge of #110563 - bryangarza:refactor-trait-selection-error-reporting, r=compiler-errors
Break up long function in trait selection error reporting + clean up nearby code - Move blocks of code into their own functions - Replace a few function argument types with their type aliases - Create "AppendConstMessage" enum to replace a nested `Option`.
2 parents f6830a2 + 55e5a1d commit 5f33a8c

File tree

6 files changed

+680
-441
lines changed

6 files changed

+680
-441
lines changed

compiler/rustc_hir_typeck/src/method/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
300300
trait_def_id: DefId,
301301
self_ty: Ty<'tcx>,
302302
opt_input_types: Option<&[Ty<'tcx>]>,
303-
) -> (traits::Obligation<'tcx, ty::Predicate<'tcx>>, &'tcx ty::List<ty::subst::GenericArg<'tcx>>)
304-
{
303+
) -> (traits::PredicateObligation<'tcx>, &'tcx ty::List<ty::subst::GenericArg<'tcx>>) {
305304
// Construct a trait-reference `self_ty : Trait<input_tys>`
306305
let substs = InternalSubsts::for_item(self.tcx, trait_def_id, |param, _| {
307306
match param.kind {

compiler/rustc_infer/src/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub struct FulfillmentError<'tcx> {
123123
#[derive(Clone)]
124124
pub enum FulfillmentErrorCode<'tcx> {
125125
/// Inherently impossible to fulfill; this trait is implemented if and only if it is already implemented.
126-
CodeCycle(Vec<Obligation<'tcx, ty::Predicate<'tcx>>>),
126+
CodeCycle(Vec<PredicateObligation<'tcx>>),
127127
CodeSelectionError(SelectionError<'tcx>),
128128
CodeProjectionError(MismatchedProjectionTypes<'tcx>),
129129
CodeSubtypeError(ExpectedFound<Ty<'tcx>>, TypeError<'tcx>), // always comes from a SubtypePredicate

compiler/rustc_trait_selection/src/traits/auto_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
591591
fn evaluate_nested_obligations(
592592
&self,
593593
ty: Ty<'_>,
594-
nested: impl Iterator<Item = Obligation<'tcx, ty::Predicate<'tcx>>>,
594+
nested: impl Iterator<Item = PredicateObligation<'tcx>>,
595595
computed_preds: &mut FxIndexSet<ty::Predicate<'tcx>>,
596596
fresh_preds: &mut FxHashSet<ty::Predicate<'tcx>>,
597597
predicates: &mut VecDeque<ty::PolyTraitPredicate<'tcx>>,

0 commit comments

Comments
 (0)