Skip to content

Commit 3d5438a

Browse files
Fix binding mode problems
1 parent e1819a8 commit 3d5438a

File tree

67 files changed

+154
-181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+154
-181
lines changed

compiler/rustc_abi/src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -329,19 +329,19 @@ impl TargetDataLayout {
329329
[p] if p.starts_with('P') => {
330330
dl.instruction_address_space = parse_address_space(&p[1..], "P")?
331331
}
332-
["a", ref a @ ..] => dl.aggregate_align = parse_align(a, "a")?,
333-
["f16", ref a @ ..] => dl.f16_align = parse_align(a, "f16")?,
334-
["f32", ref a @ ..] => dl.f32_align = parse_align(a, "f32")?,
335-
["f64", ref a @ ..] => dl.f64_align = parse_align(a, "f64")?,
336-
["f128", ref a @ ..] => dl.f128_align = parse_align(a, "f128")?,
332+
["a", a @ ..] => dl.aggregate_align = parse_align(a, "a")?,
333+
["f16", a @ ..] => dl.f16_align = parse_align(a, "f16")?,
334+
["f32", a @ ..] => dl.f32_align = parse_align(a, "f32")?,
335+
["f64", a @ ..] => dl.f64_align = parse_align(a, "f64")?,
336+
["f128", a @ ..] => dl.f128_align = parse_align(a, "f128")?,
337337
// FIXME(erikdesjardins): we should be parsing nonzero address spaces
338338
// this will require replacing TargetDataLayout::{pointer_size,pointer_align}
339339
// with e.g. `fn pointer_size_in(AddressSpace)`
340-
[p @ "p", s, ref a @ ..] | [p @ "p0", s, ref a @ ..] => {
340+
[p @ "p", s, a @ ..] | [p @ "p0", s, a @ ..] => {
341341
dl.pointer_size = parse_size(s, p)?;
342342
dl.pointer_align = parse_align(a, p)?;
343343
}
344-
[s, ref a @ ..] if s.starts_with('i') => {
344+
[s, a @ ..] if s.starts_with('i') => {
345345
let Ok(bits) = s[1..].parse::<u64>() else {
346346
parse_size(&s[1..], "i")?; // For the user error.
347347
continue;
@@ -362,7 +362,7 @@ impl TargetDataLayout {
362362
dl.i128_align = a;
363363
}
364364
}
365-
[s, ref a @ ..] if s.starts_with('v') => {
365+
[s, a @ ..] if s.starts_with('v') => {
366366
let v_size = parse_size(&s[1..], "v")?;
367367
let a = parse_align(a, s)?;
368368
if let Some(v) = dl.vector_align.iter_mut().find(|v| v.0 == v_size) {
@@ -1802,7 +1802,7 @@ where
18021802
variants,
18031803
max_repr_align,
18041804
unadjusted_abi_align,
1805-
ref randomization_seed,
1805+
randomization_seed,
18061806
} = self;
18071807
f.debug_struct("Layout")
18081808
.field("size", size)

compiler/rustc_ast/src/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ pub fn walk_use_tree<'a, V: Visitor<'a>>(
597597
visit_opt!(visitor, visit_ident, rename);
598598
}
599599
UseTreeKind::Glob => {}
600-
UseTreeKind::Nested { ref items, span: _ } => {
600+
UseTreeKind::Nested { items, span: _ } => {
601601
for &(ref nested_tree, nested_id) in items {
602602
try_visit!(visitor.visit_use_tree(nested_tree, nested_id, true));
603603
}

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2617,7 +2617,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
26172617
if let hir::Pat { kind: hir::PatKind::Binding(_, hir_id, _ident, _), .. } =
26182618
local.pat
26192619
&& let Some(init) = local.init
2620-
&& let hir::Expr {
2620+
&& let &hir::Expr {
26212621
kind:
26222622
hir::ExprKind::Closure(&hir::Closure {
26232623
kind: hir::ClosureKind::Closure,

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
262262
fn visit_expr(&mut self, expr: &'hir hir::Expr<'hir>) {
263263
if let hir::ExprKind::If(cond, _conseq, _alt)
264264
| hir::ExprKind::Loop(
265-
hir::Block {
265+
&hir::Block {
266266
expr:
267267
Some(&hir::Expr {
268268
kind: hir::ExprKind::If(cond, _conseq, _alt),

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
11261126
let hir_id = self.infcx.tcx.local_def_id_to_hir_id(def_id);
11271127
let expr = &self.infcx.tcx.hir().expect_expr(hir_id).kind;
11281128
debug!("closure_span: hir_id={:?} expr={:?}", hir_id, expr);
1129-
if let hir::ExprKind::Closure(&hir::Closure { kind, fn_decl_span, .. }) = expr {
1129+
if let &hir::ExprKind::Closure(&hir::Closure { kind, fn_decl_span, .. }) = expr {
11301130
for (captured_place, place) in
11311131
self.infcx.tcx.closure_captures(def_id).iter().zip(places)
11321132
{

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
681681
let mir_hir_id = self.mir_hir_id();
682682

683683
let (return_span, mir_description, hir_ty) = match tcx.hir_node(mir_hir_id) {
684-
hir::Node::Expr(hir::Expr {
684+
hir::Node::Expr(&hir::Expr {
685685
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl, kind, fn_decl_span, .. }),
686686
..
687687
}) => {
@@ -873,7 +873,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
873873
.name;
874874

875875
let yield_span = match tcx.hir_node(self.mir_hir_id()) {
876-
hir::Node::Expr(hir::Expr {
876+
hir::Node::Expr(&hir::Expr {
877877
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }),
878878
..
879879
}) => tcx.sess.source_map().end_point(fn_decl_span),

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ fn exported_symbols_provider_local(
183183
});
184184

185185
let mut symbols: Vec<_> =
186-
sorted.iter().map(|(&def_id, &info)| (ExportedSymbol::NonGeneric(def_id), info)).collect();
186+
sorted.iter().map(|&(&def_id, &info)| (ExportedSymbol::NonGeneric(def_id), info)).collect();
187187

188188
// Export TLS shims
189189
if !tcx.sess.target.dll_tls_export {
190-
symbols.extend(sorted.iter().filter_map(|(&def_id, &info)| {
190+
symbols.extend(sorted.iter().filter_map(|&(&def_id, &info)| {
191191
tcx.needs_thread_local_shim(def_id).then(|| {
192192
(
193193
ExportedSymbol::ThreadLocalShim(def_id),

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> Option<AutoDiffAttrs> {
894894
let [mode, input_activities @ .., ret_activity] = &list[..] else {
895895
span_bug!(attr.span, "rustc_autodiff attribute must contain mode and activities");
896896
};
897-
let mode = if let MetaItemInner::MetaItem(MetaItem { path: ref p1, .. }) = mode {
897+
let mode = if let MetaItemInner::MetaItem(MetaItem { path: p1, .. }) = mode {
898898
p1.segments.first().unwrap().ident
899899
} else {
900900
span_bug!(attr.span, "rustc_autodiff attribute must contain mode");
@@ -910,7 +910,7 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> Option<AutoDiffAttrs> {
910910
};
911911

912912
// First read the ret symbol from the attribute
913-
let ret_symbol = if let MetaItemInner::MetaItem(MetaItem { path: ref p1, .. }) = ret_activity {
913+
let ret_symbol = if let MetaItemInner::MetaItem(MetaItem { path: p1, .. }) = ret_activity {
914914
p1.segments.first().unwrap().ident
915915
} else {
916916
span_bug!(attr.span, "rustc_autodiff attribute must contain the return activity");
@@ -924,7 +924,7 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> Option<AutoDiffAttrs> {
924924
// Now parse all the intermediate (input) activities
925925
let mut arg_activities: Vec<DiffActivity> = vec![];
926926
for arg in input_activities {
927-
let arg_symbol = if let MetaItemInner::MetaItem(MetaItem { path: ref p2, .. }) = arg {
927+
let arg_symbol = if let MetaItemInner::MetaItem(MetaItem { path: p2, .. }) = arg {
928928
match p2.segments.first() {
929929
Some(x) => x.ident,
930930
None => {

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,14 +720,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
720720

721721
// Put together the arguments to the panic entry point.
722722
let (lang_item, args) = match msg {
723-
AssertKind::BoundsCheck { ref len, ref index } => {
723+
AssertKind::BoundsCheck { len, index } => {
724724
let len = self.codegen_operand(bx, len).immediate();
725725
let index = self.codegen_operand(bx, index).immediate();
726726
// It's `fn panic_bounds_check(index: usize, len: usize)`,
727727
// and `#[track_caller]` adds an implicit third argument.
728728
(LangItem::PanicBoundsCheck, vec![index, len, location])
729729
}
730-
AssertKind::MisalignedPointerDereference { ref required, ref found } => {
730+
AssertKind::MisalignedPointerDereference { required, found } => {
731731
let required = self.codegen_operand(bx, required).immediate();
732732
let found = self.codegen_operand(bx, found).immediate();
733733
// It's `fn panic_misaligned_pointer_dereference(required: usize, found: usize)`,

compiler/rustc_codegen_ssa/src/mir/operand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
584584
// Moves out of scalar and scalar pair fields are trivial.
585585
for elem in place_ref.projection.iter() {
586586
match elem {
587-
mir::ProjectionElem::Field(ref f, _) => {
587+
mir::ProjectionElem::Field(f, _) => {
588588
assert!(
589589
!o.layout.ty.is_any_ptr(),
590590
"Bad PlaceRef: destructing pointers should use cast/PtrMetadata, \

0 commit comments

Comments
 (0)