1
Fork 0

Rename BindingAnnotation to BindingMode

This commit is contained in:
Jules Bertholet 2024-04-16 19:23:30 -04:00
parent d19e48d79a
commit 2a4624ddd1
No known key found for this signature in database
GPG key ID: 32034DAFC38C1BFC
81 changed files with 222 additions and 256 deletions

View file

@ -14,7 +14,7 @@ use rustc_data_structures::{
fx::{FxHashSet, FxIndexMap, FxIndexSet},
stack::ensure_sufficient_stack,
};
use rustc_hir::{BindingAnnotation, ByRef};
use rustc_hir::{BindingMode, ByRef};
use rustc_middle::middle::region;
use rustc_middle::mir::{self, *};
use rustc_middle::thir::{self, *};
@ -621,12 +621,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
) -> BlockAnd<()> {
match irrefutable_pat.kind {
// Optimize the case of `let x = ...` to write directly into `x`
PatKind::Binding {
mode: BindingAnnotation(ByRef::No, _),
var,
subpattern: None,
..
} => {
PatKind::Binding { mode: BindingMode(ByRef::No, _), var, subpattern: None, .. } => {
let place =
self.storage_live_binding(block, var, irrefutable_pat.span, OutsideGuard, true);
unpack!(block = self.expr_into_dest(place, block, initializer_id));
@ -652,7 +647,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
box Pat {
kind:
PatKind::Binding {
mode: BindingAnnotation(ByRef::No, _),
mode: BindingMode(ByRef::No, _),
var,
subpattern: None,
..
@ -893,7 +888,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
f: &mut impl FnMut(
&mut Self,
Symbol,
BindingAnnotation,
BindingMode,
LocalVarId,
Span,
Ty<'tcx>,
@ -1148,7 +1143,7 @@ struct Binding<'tcx> {
span: Span,
source: Place<'tcx>,
var_id: LocalVarId,
binding_mode: BindingAnnotation,
binding_mode: BindingMode,
}
/// Indicates that the type of `source` must be a subtype of the
@ -2412,7 +2407,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
source_info: SourceInfo,
visibility_scope: SourceScope,
name: Symbol,
mode: BindingAnnotation,
mode: BindingMode,
var_id: LocalVarId,
var_ty: Ty<'tcx>,
user_ty: UserTypeProjections,

View file

@ -9,7 +9,7 @@ use rustc_data_structures::sorted_map::SortedIndexMultiMap;
use rustc_errors::ErrorGuaranteed;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::{self as hir, BindingAnnotation, ByRef, HirId, Node};
use rustc_hir::{self as hir, BindingMode, ByRef, HirId, Node};
use rustc_index::bit_set::GrowableBitSet;
use rustc_index::{Idx, IndexSlice, IndexVec};
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
@ -931,7 +931,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// Don't introduce extra copies for simple bindings
PatKind::Binding {
var,
mode: BindingAnnotation(ByRef::No, mutability),
mode: BindingMode(ByRef::No, mutability),
subpattern: None,
..
} => {
@ -941,7 +941,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
if let Some(kind) = param.self_kind {
LocalInfo::User(BindingForm::ImplicitSelf(kind))
} else {
let binding_mode = BindingAnnotation(ByRef::No, mutability);
let binding_mode = BindingMode(ByRef::No, mutability);
LocalInfo::User(BindingForm::Var(VarBindingForm {
binding_mode,
opt_ty_info: param.ty_span,

View file

@ -2,7 +2,7 @@ use crate::build::ExprCategory;
use crate::errors::*;
use rustc_errors::DiagArgValue;
use rustc_hir::{self as hir, BindingAnnotation, ByRef, HirId, Mutability};
use rustc_hir::{self as hir, BindingMode, ByRef, HirId, Mutability};
use rustc_middle::mir::BorrowKind;
use rustc_middle::thir::visit::Visitor;
use rustc_middle::thir::*;
@ -288,7 +288,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
visit::walk_pat(self, pat);
}
}
PatKind::Binding { mode: BindingAnnotation(ByRef::Yes(rm), _), ty, .. } => {
PatKind::Binding { mode: BindingMode(ByRef::Yes(rm), _), ty, .. } => {
if self.inside_adt {
let ty::Ref(_, ty, _) = ty.kind() else {
span_bug!(

View file

@ -15,7 +15,7 @@ use rustc_errors::{
};
use rustc_hir::def::*;
use rustc_hir::def_id::LocalDefId;
use rustc_hir::{self as hir, BindingAnnotation, ByRef, HirId};
use rustc_hir::{self as hir, BindingMode, ByRef, HirId};
use rustc_middle::middle::limits::get_limit_size;
use rustc_middle::thir::visit::Visitor;
use rustc_middle::thir::*;
@ -839,7 +839,7 @@ fn check_for_bindings_named_same_as_variants(
) {
if let PatKind::Binding {
name,
mode: BindingAnnotation(ByRef::No, Mutability::Not),
mode: BindingMode(ByRef::No, Mutability::Not),
subpattern: None,
ty,
..