rust/compiler/rustc_trait_selection
Weixie Cui 81fb703664 Fix copy-paste bug: use sub_trace.cause instead of sup_trace.cause in report_sub_sup_conflict
In `report_sub_sup_conflict`, when calling `values_str` for
`sub_trace.values`, the code was incorrectly passing `sup_trace.cause`
instead of `sub_trace.cause`. This is a copy-paste error from the
preceding line which correctly uses `sup_trace.cause` for
`sup_trace.values`.

The `cause` parameter matters for `ValuePairs::PolySigs` comparisons,
where `values_str` inspects `cause.code()` to extract
`impl_item_def_id` and `trait_item_def_id` for richer function
signature diagnostics. Using the wrong trace's cause could produce
incorrect function def IDs, leading to misleading diagnostic output
when the sub and sup traces originate from different obligations.

Even for non-PolySigs variants where `cause` is currently unused by
`values_str`, passing the semantically correct cause is the right
thing to do for correctness and maintainability.
2026-02-09 11:15:31 +08:00
..
src Fix copy-paste bug: use sub_trace.cause instead of sup_trace.cause in report_sub_sup_conflict 2026-02-09 11:15:31 +08:00
Cargo.toml Convert to inline diagnostics in rustc_trait_selection 2026-02-05 16:58:59 +01:00