1
Fork 0
rust/compiler/rustc_hir_analysis/src
Matthias Krüger 09b255d3d4
Rollup merge of #130116 - veera-sivarajan:freeze-suggestions, r=chenyukang
Implement a Method to Seal `DiagInner`'s Suggestions

This PR adds a method on `DiagInner` called `.seal_suggestions()` to prevent new suggestions from being added while preserving existing suggestions.

This is useful because currently there is no way to prevent new suggestions from being added to a diagnostic. `.disable_suggestions()` is the closest but it gets rid of all suggestions before and after the call.

Therefore, `.seal_suggestions()` can be used when, for example, misspelled keyword is detected and reported. In such cases, we may want to prevent other suggestions from being added to the diagnostic, as they would likely be meaningless once the misspelled keyword is identified. For context: https://github.com/rust-lang/rust/pull/129899#discussion_r1741307132

To store an additional state, the type of the `suggestions` field in `DiagInner` was changed into a three variant enum. While this change affects files across different crates, care was taken to preserve the existing code's semantics. This is validated by the fact that all UI tests pass without any modifications.

r? chenyukang
2024-09-18 04:42:31 +02:00
..
check Don't ICE when RPITIT captures more method args than trait definition 2024-09-16 10:57:06 -04:00
coherence Rollup merge of #130235 - compiler-errors:nested-if, r=michaelwoerister 2024-09-12 20:37:16 +10:00
collect Rollup merge of #130116 - veera-sivarajan:freeze-suggestions, r=chenyukang 2024-09-18 04:42:31 +02:00
errors Introduce distinct error codes for precise capturing 2024-09-16 10:56:22 -04:00
hir_ty_lowering Also fix if in else 2024-09-11 17:24:01 -04:00
impl_wf_check Remove #[macro_use] extern crate tracing from rustc_hir_analysis. 2024-08-30 17:14:59 +10:00
outlives Remove #[macro_use] extern crate tracing from rustc_hir_analysis. 2024-08-30 17:14:59 +10:00
variance Remove #[macro_use] extern crate tracing from rustc_hir_analysis. 2024-08-30 17:14:59 +10:00
autoderef.rs Remove #[macro_use] extern crate tracing from rustc_hir_analysis. 2024-08-30 17:14:59 +10:00
bounds.rs Add warn(unreachable_pub) to rustc_hir_analysis. 2024-08-27 13:14:50 +10:00
check_unused.rs Remove #[macro_use] extern crate tracing from rustc_hir_analysis. 2024-08-30 17:14:59 +10:00
collect.rs Revert ed7bdbb17b 2024-09-06 19:06:59 +02:00
constrained_generic_params.rs Remove #[macro_use] extern crate tracing from rustc_hir_analysis. 2024-08-30 17:14:59 +10:00
delegation.rs Delegation: support generics in associated delegation items 2024-09-05 16:04:50 +03:00
errors.rs Add warn(unreachable_pub) to rustc_hir_analysis. 2024-08-27 13:14:50 +10:00
hir_wf_check.rs Remove #[macro_use] extern crate tracing from rustc_hir_analysis. 2024-08-30 17:14:59 +10:00
impl_wf_check.rs Add warn(unreachable_pub) to rustc_hir_analysis. 2024-08-27 13:14:50 +10:00
lib.rs Remove #[macro_use] extern crate tracing from rustc_hir_analysis. 2024-08-30 17:14:59 +10:00