diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-09-14 19:12:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-14 19:12:32 +0200 |
| commit | 57370828b9ff2f5b5a489093924fde308a2d08f6 (patch) | |
| tree | cb21d43954d7b34c9065101b5216775ac7d3a4f7 /compiler/rustc_interface/src/errors.rs | |
| parent | 3dbcc28884c4def54c9b9bc42bf932f75a6f315f (diff) | |
| parent | 7ae301ec47ee6e3ed63a4f34eaad01d3d4b46755 (diff) | |
| download | rust-57370828b9ff2f5b5a489093924fde308a2d08f6.tar.gz rust-57370828b9ff2f5b5a489093924fde308a2d08f6.zip | |
Rollup merge of #115834 - compiler-errors:binder-vars, r=jackh726
Properly consider binder vars in `HasTypeFlagsVisitor`
Given a PolyTraitRef like `for<'a> Ty: Trait` (where neither `Ty` nor `Trait` mention `'a`), we do *not* return true for `.has_type_flags(TypeFlags::HAS_LATE_BOUND)`, even though binders are supposed to act as if they have late-bound vars even if they don't mention them in their bound value: 31ae3b2bdb9376b749fc1d64b531e86806e03c73. This is because we use `HasTypeFlagsVisitor`, which only computes the type flags for `Ty`, `Const` and `Region` and `Predicates`, and we consequently skip any binders (and setting flags for their vars) that are not contained in one of these types.
This ends up causing a problem, because when we call `TyCtxt::erase_regions` (which both erases regions *and* anonymizes bound vars), we will skip such a PolyTraitRef, not anonymizing it, and therefore not making it structurally equal to other binders. This breaks vtable computations.
This PR computes the flags for all binders we enter in `HasTypeFlagsVisitor` if we're looking for `TypeFlags::HAS_LATE_BOUND` (or `TypeFlags::HAS_{RE,TY,CT}_LATE_BOUND`).
Fixes #115807
Diffstat (limited to 'compiler/rustc_interface/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
