1
Fork 0

Rollup merge of #137712 - meithecatte:extract-binding-mode, r=oli-obk

Clean up TypeckResults::extract_binding_mode

- Remove the `Option` from the result type, as `None` is never returned.
- Document the difference from the `BindingMode` in `PatKind::Binding`.
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2025-02-28 21:42:00 +08:00 committed by GitHub
commit a9f3f02ed7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 45 additions and 45 deletions

View file

@ -1683,6 +1683,12 @@ pub enum PatKind<'hir> {
/// The `HirId` is the canonical ID for the variable being bound,
/// (e.g., in `Ok(x) | Err(x)`, both `x` use the same canonical ID),
/// which is the pattern ID of the first `x`.
///
/// The `BindingMode` is what's provided by the user, before match
/// ergonomics are applied. For the binding mode actually in use,
/// see [`TypeckResults::extract_binding_mode`].
///
/// [`TypeckResults::extract_binding_mode`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.extract_binding_mode
Binding(BindingMode, HirId, Ident, Option<&'hir Pat<'hir>>),
/// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`).