Skip to content

Commit aedf78e

Browse files
committed
Auto merge of #98802 - Dylan-DPC:rollup-u6mwx27, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - #98639 (Factor out `hir::Node::Binding`) - #98653 (Add regression test for #79494) - #98763 (bootstrap: illumos platform flags for split-debuginfo) - #98766 (cleanup mir visitor for `rustc::pass_by_value`) - #98783 (interpret: make a comment less scary) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4118ad2 + 7a4f33b commit aedf78e

File tree

45 files changed

+235
-189
lines changed

Some content is hidden

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

45 files changed

+235
-189
lines changed

compiler/rustc_ast_lowering/src/index.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
192192
}
193193

194194
fn visit_pat(&mut self, pat: &'hir Pat<'hir>) {
195-
let node =
196-
if let PatKind::Binding(..) = pat.kind { Node::Binding(pat) } else { Node::Pat(pat) };
197-
self.insert(pat.span, pat.hir_id, node);
195+
self.insert(pat.span, pat.hir_id, Node::Pat(pat));
198196

199197
self.with_parent(pat.hir_id, |this| {
200198
intravisit::walk_pat(this, pat);

compiler/rustc_borrowck/src/borrow_set.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ impl LocalsStateAtExit {
9292
struct HasStorageDead(BitSet<Local>);
9393

9494
impl<'tcx> Visitor<'tcx> for HasStorageDead {
95-
fn visit_local(&mut self, local: &Local, ctx: PlaceContext, _: Location) {
95+
fn visit_local(&mut self, local: Local, ctx: PlaceContext, _: Location) {
9696
if ctx == PlaceContext::NonUse(NonUseContext::StorageDead) {
97-
self.0.insert(*local);
97+
self.0.insert(local);
9898
}
9999
}
100100
}
@@ -223,7 +223,7 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'tcx> {
223223
self.super_assign(assigned_place, rvalue, location)
224224
}
225225

226-
fn visit_local(&mut self, temp: &Local, context: PlaceContext, location: Location) {
226+
fn visit_local(&mut self, temp: Local, context: PlaceContext, location: Location) {
227227
if !context.is_use() {
228228
return;
229229
}
@@ -232,7 +232,7 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'tcx> {
232232
// check whether we (earlier) saw a 2-phase borrow like
233233
//
234234
// TMP = &mut place
235-
if let Some(&borrow_index) = self.pending_activations.get(temp) {
235+
if let Some(&borrow_index) = self.pending_activations.get(&temp) {
236236
let borrow_data = &mut self.location_map[borrow_index.as_usize()];
237237

238238
// Watch out: the use of TMP in the borrow itself

compiler/rustc_borrowck/src/diagnostics/find_all_local_uses.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ struct AllLocalUsesVisitor {
1818
}
1919

2020
impl<'tcx> Visitor<'tcx> for AllLocalUsesVisitor {
21-
fn visit_local(&mut self, local: &Local, _context: PlaceContext, location: Location) {
22-
if *local == self.for_local {
21+
fn visit_local(&mut self, local: Local, _context: PlaceContext, location: Location) {
22+
if local == self.for_local {
2323
self.uses.insert(location);
2424
}
2525
}

compiler/rustc_borrowck/src/diagnostics/find_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ enum DefUseResult {
106106
}
107107

108108
impl<'cx, 'tcx> Visitor<'tcx> for DefUseVisitor<'cx, 'tcx> {
109-
fn visit_local(&mut self, &local: &Local, context: PlaceContext, _: Location) {
109+
fn visit_local(&mut self, local: Local, context: PlaceContext, _: Location) {
110110
let local_ty = self.body.local_decls[local].ty;
111111

112112
let mut found_it = false;

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
362362

363363
let upvar_hir_id = captured_place.get_root_variable();
364364

365-
if let Some(Node::Binding(pat)) = self.infcx.tcx.hir().find(upvar_hir_id)
365+
if let Some(Node::Pat(pat)) = self.infcx.tcx.hir().find(upvar_hir_id)
366366
&& let hir::PatKind::Binding(
367367
hir::BindingAnnotation::Unannotated,
368368
_,

compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl LocalUseMapBuild<'_> {
157157
}
158158

159159
impl Visitor<'_> for LocalUseMapBuild<'_> {
160-
fn visit_local(&mut self, &local: &Local, context: PlaceContext, location: Location) {
160+
fn visit_local(&mut self, local: Local, context: PlaceContext, location: Location) {
161161
if self.locals_with_use_data[local] {
162162
match def_use::categorize(context) {
163163
Some(DefUse::Def) => self.insert_def(local, location),

compiler/rustc_borrowck/src/type_check/liveness/polonius.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl UseFactsExtractor<'_, '_> {
5454
}
5555

5656
impl<'a, 'tcx> Visitor<'tcx> for UseFactsExtractor<'a, 'tcx> {
57-
fn visit_local(&mut self, &local: &Local, context: PlaceContext, location: Location) {
57+
fn visit_local(&mut self, local: Local, context: PlaceContext, location: Location) {
5858
match def_use::categorize(context) {
5959
Some(DefUse::Def) => self.insert_def(local, location),
6060
Some(DefUse::Use) => self.insert_use(local, location),

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ struct TypeVerifier<'a, 'b, 'tcx> {
333333
}
334334

335335
impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
336-
fn visit_span(&mut self, span: &Span) {
336+
fn visit_span(&mut self, span: Span) {
337337
if !span.is_dummy() {
338-
self.last_span = *span;
338+
self.last_span = span;
339339
}
340340
}
341341

compiler/rustc_borrowck/src/used_muts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ impl<'visit, 'cx, 'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'visit, 'cx, 'tc
9191
self.super_statement(statement, location);
9292
}
9393

94-
fn visit_local(&mut self, local: &Local, place_context: PlaceContext, location: Location) {
95-
if place_context.is_place_assignment() && self.temporary_used_locals.contains(local) {
94+
fn visit_local(&mut self, local: Local, place_context: PlaceContext, location: Location) {
95+
if place_context.is_place_assignment() && self.temporary_used_locals.contains(&local) {
9696
// Propagate the Local assigned at this Location as a used mutable local variable
9797
for moi in &self.mbcx.move_data.loc_map[location] {
9898
let mpi = &self.mbcx.move_data.moves[*moi].path;

compiler/rustc_codegen_ssa/src/mir/analyze.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx,
143143
// now that we have moved to the "slice of projections" representation.
144144
if let mir::ProjectionElem::Index(local) = elem {
145145
self.visit_local(
146-
&local,
146+
local,
147147
PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy),
148148
location,
149149
);
150150
}
151151
} else {
152-
self.visit_local(&place_ref.local, context, location);
152+
self.visit_local(place_ref.local, context, location);
153153
}
154154
}
155155
}
@@ -185,7 +185,7 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
185185
self.process_place(&place.as_ref(), context, location);
186186
}
187187

188-
fn visit_local(&mut self, &local: &mir::Local, context: PlaceContext, location: Location) {
188+
fn visit_local(&mut self, local: mir::Local, context: PlaceContext, location: Location) {
189189
match context {
190190
PlaceContext::MutatingUse(MutatingUseContext::Call)
191191
| PlaceContext::MutatingUse(MutatingUseContext::Yield) => {

0 commit comments

Comments
 (0)