Match ergonomics 2024: migration lint
Unfortunately, we can't always offer a machine-applicable suggestion when there are subpatterns from macro expansion. Co-Authored-By: Guillaume Boisseau <Nadrieril@users.noreply.github.com>
This commit is contained in:
parent
686bfc4c42
commit
9d92a7f355
17 changed files with 409 additions and 116 deletions
|
@ -79,6 +79,10 @@ pub struct TypeckResults<'tcx> {
|
|||
/// Stores the actual binding mode for all instances of [`BindingMode`].
|
||||
pat_binding_modes: ItemLocalMap<BindingMode>,
|
||||
|
||||
/// Top-level patterns whose match ergonomics need to be desugared
|
||||
/// by the Rust 2021 -> 2024 migration lint.
|
||||
rust_2024_migration_desugared_pats: ItemLocalSet,
|
||||
|
||||
/// Stores the types which were implicitly dereferenced in pattern binding modes
|
||||
/// for later usage in THIR lowering. For example,
|
||||
///
|
||||
|
@ -229,6 +233,7 @@ impl<'tcx> TypeckResults<'tcx> {
|
|||
adjustments: Default::default(),
|
||||
pat_binding_modes: Default::default(),
|
||||
pat_adjustments: Default::default(),
|
||||
rust_2024_migration_desugared_pats: Default::default(),
|
||||
skipped_ref_pats: Default::default(),
|
||||
closure_kind_origins: Default::default(),
|
||||
liberated_fn_sigs: Default::default(),
|
||||
|
@ -432,6 +437,20 @@ impl<'tcx> TypeckResults<'tcx> {
|
|||
LocalTableInContextMut { hir_owner: self.hir_owner, data: &mut self.pat_adjustments }
|
||||
}
|
||||
|
||||
pub fn rust_2024_migration_desugared_pats(&self) -> LocalSetInContext<'_> {
|
||||
LocalSetInContext {
|
||||
hir_owner: self.hir_owner,
|
||||
data: &self.rust_2024_migration_desugared_pats,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rust_2024_migration_desugared_pats_mut(&mut self) -> LocalSetInContextMut<'_> {
|
||||
LocalSetInContextMut {
|
||||
hir_owner: self.hir_owner,
|
||||
data: &mut self.rust_2024_migration_desugared_pats,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn skipped_ref_pats(&self) -> LocalSetInContext<'_> {
|
||||
LocalSetInContext { hir_owner: self.hir_owner, data: &self.skipped_ref_pats }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue