/// Helper type of a temporary returned by `.for_item(...)`.
/// This is necessary because we can't write the following bound:
///
-/// ```rust
+/// ```ignore (illustrative)
/// F: for<'b, 'tcx> where 'tcx FnOnce(FnCtxt<'b, 'tcx>)
/// ```
struct CheckWfFcxBuilder<'tcx> {
let suggestion = format!(
"{} {}",
- if !gat_item_hir.generics.where_clause.predicates.is_empty() {
- ","
- } else {
- " where"
- },
+ if !gat_item_hir.generics.predicates.is_empty() { "," } else { " where" },
unsatisfied_bounds.join(", "),
);
err.span_suggestion(
- gat_item_hir.generics.where_clause.tail_span_for_suggestion(),
+ gat_item_hir.generics.tail_span_for_predicate_suggestion(),
&format!("add the required where clause{plural}"),
suggestion,
Applicability::MachineApplicable,
let explicitly_bounded_params = Lazy::new(|| {
let icx = crate::collect::ItemCtxt::new(tcx, item.def_id.to_def_id());
hir_generics
- .where_clause
.predicates
.iter()
.filter_map(|predicate| match predicate {
match param.name {
hir::ParamName::Error => {}
_ => {
- let has_explicit_bounds =
- !param.bounds.is_empty() || explicitly_bounded_params.contains(¶meter);
+ let has_explicit_bounds = explicitly_bounded_params.contains(¶meter);
report_bivariance(tcx, param, has_explicit_bounds);
}
}
// only use the span of the predicate clause (#90869)
- if let Some(hir::Generics { where_clause, .. }) =
+ if let Some(hir::Generics { predicates, .. }) =
hir_node.and_then(|node| node.generics())
{
let obligation_span = obligation.cause.span(fcx.tcx);
- span = where_clause
- .predicates
+ span = predicates
.iter()
// There seems to be no better way to find out which predicate we are in
.find(|pred| pred.span().contains(obligation_span))