diff options
| author | lcnr <rust@lcnr.de> | 2025-08-07 12:09:48 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2025-08-14 17:43:39 +0200 |
| commit | 5c716bdc8754a3d919396768fed2ec76110257cd (patch) | |
| tree | ca4859bc2fe95f1b98cf2ccd614119d6efea8833 | |
| parent | a95a2ac476ef04ccf8cfabd35e6fcdb9569f053d (diff) | |
| download | rust-5c716bdc8754a3d919396768fed2ec76110257cd.tar.gz rust-5c716bdc8754a3d919396768fed2ec76110257cd.zip | |
add comment
| -rw-r--r-- | compiler/rustc_borrowck/src/diagnostics/mod.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/diagnostics/region_errors.rs | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index 7d7d0abc3f4..5642cdf87fd 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -687,6 +687,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { return; }; + // Look for the where-bound which introduces the placeholder. + // As we're using the HIR, we need to handle both `for<'a> T: Trait<'a>` + // and `T: for<'a> Trait`<'a>. for pred in generics.predicates { let WherePredicateKind::BoundPredicate(WhereBoundPredicate { bound_generic_params, diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index cd03daad593..fe4e1b6011e 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -236,7 +236,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { .collect::<Vec<_>>(); debug!(?gat_id_and_generics); - // find higher-ranked trait bounds bounded to the generic associated types + // Look for the where-bound which introduces the placeholder. + // As we're using the HIR, we need to handle both `for<'a> T: Trait<'a>` + // and `T: for<'a> Trait`<'a>. let mut hrtb_bounds = vec![]; gat_id_and_generics.iter().flatten().for_each(|&(gat_hir_id, generics)| { for pred in generics.predicates { |
