1
Fork 0

experimentally label the spans for default binding modes

This commit is contained in:
dianne 2025-02-04 03:18:10 -08:00
parent 4331f55b72
commit 203d3109d8
8 changed files with 264 additions and 223 deletions

View file

@ -1,3 +1,4 @@
use rustc_data_structures::fx::FxIndexMap;
use rustc_errors::codes::*;
use rustc_errors::{
Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level,
@ -1109,6 +1110,11 @@ pub(crate) struct Rust2024IncompatiblePatSugg {
pub(crate) suggestion: Vec<(Span, String)>,
pub(crate) ref_pattern_count: usize,
pub(crate) binding_mode_count: usize,
/// Internal state: the ref-mutability of the default binding mode at the subpattern being
/// lowered, with the span where it was introduced. `None` for a by-value default mode.
pub(crate) default_mode_span: Option<(Span, ty::Mutability)>,
/// Labels for where incompatibility-causing by-ref default binding modes were introduced.
pub(crate) default_mode_labels: FxIndexMap<Span, ty::Mutability>,
}
impl Subdiagnostic for Rust2024IncompatiblePatSugg {