Skip to content

Commit f843ad6

Browse files
committed
Auto merge of #60389 - Centril:rollup-nefreyr, r=Centril
Rollup of 4 pull requests Successful merges: - #59869 (SGX target: implemented vectored I/O) - #60238 (Update rustfmt to 1.2.2) - #60276 (Cleanup the MIR visitor) - #60380 (Fix line number display in source view) Failed merges: r? @ghost
2 parents 03122e1 + 116dcff commit f843ad6

34 files changed

+246
-303
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -2272,7 +2272,7 @@ dependencies = [
22722272
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
22732273
"rustc-workspace-hack 1.0.0",
22742274
"rustc_tools_util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
2275-
"rustfmt-nightly 1.2.1",
2275+
"rustfmt-nightly 1.2.2",
22762276
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
22772277
"serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
22782278
"serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3090,7 +3090,7 @@ dependencies = [
30903090

30913091
[[package]]
30923092
name = "rustfmt-nightly"
3093-
version = "1.2.1"
3093+
version = "1.2.2"
30943094
dependencies = [
30953095
"annotate-snippets 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
30963096
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",

src/librustc/mir/visit.rs

+59-120
Large diffs are not rendered by default.

src/librustc_codegen_ssa/mir/analyze.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,10 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
9797
impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
9898
for LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
9999
fn visit_assign(&mut self,
100-
block: mir::BasicBlock,
101100
place: &mir::Place<'tcx>,
102101
rvalue: &mir::Rvalue<'tcx>,
103102
location: Location) {
104-
debug!("visit_assign(block={:?}, place={:?}, rvalue={:?})", block, place, rvalue);
103+
debug!("visit_assign(place={:?}, rvalue={:?})", place, rvalue);
105104

106105
if let mir::Place::Base(mir::PlaceBase::Local(index)) = *place {
107106
self.assign(index, location);
@@ -120,7 +119,6 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
120119
}
121120

122121
fn visit_terminator_kind(&mut self,
123-
block: mir::BasicBlock,
124122
kind: &mir::TerminatorKind<'tcx>,
125123
location: Location) {
126124
let check = match *kind {
@@ -148,12 +146,12 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
148146
}
149147
}
150148

151-
self.super_terminator_kind(block, kind, location);
149+
self.super_terminator_kind(kind, location);
152150
}
153151

154152
fn visit_place(&mut self,
155153
place: &mir::Place<'tcx>,
156-
context: PlaceContext<'tcx>,
154+
context: PlaceContext,
157155
location: Location) {
158156
debug!("visit_place(place={:?}, context={:?})", place, context);
159157
let cx = self.fx.cx;
@@ -205,7 +203,7 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
205203

206204
fn visit_local(&mut self,
207205
&local: &mir::Local,
208-
context: PlaceContext<'tcx>,
206+
context: PlaceContext,
209207
location: Location) {
210208
match context {
211209
PlaceContext::MutatingUse(MutatingUseContext::Call) => {
@@ -235,11 +233,11 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
235233
PlaceContext::NonMutatingUse(NonMutatingUseContext::Inspect) |
236234
PlaceContext::MutatingUse(MutatingUseContext::Store) |
237235
PlaceContext::MutatingUse(MutatingUseContext::AsmOutput) |
238-
PlaceContext::MutatingUse(MutatingUseContext::Borrow(..)) |
236+
PlaceContext::MutatingUse(MutatingUseContext::Borrow) |
239237
PlaceContext::MutatingUse(MutatingUseContext::Projection) |
240-
PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow(..)) |
241-
PlaceContext::NonMutatingUse(NonMutatingUseContext::UniqueBorrow(..)) |
242-
PlaceContext::NonMutatingUse(NonMutatingUseContext::ShallowBorrow(..)) |
238+
PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow) |
239+
PlaceContext::NonMutatingUse(NonMutatingUseContext::UniqueBorrow) |
240+
PlaceContext::NonMutatingUse(NonMutatingUseContext::ShallowBorrow) |
243241
PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection) => {
244242
self.not_ssa(local);
245243
}

src/librustc_mir/borrow_check/borrow_set.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl LocalsStateAtExit {
9696
struct HasStorageDead(BitSet<Local>);
9797

9898
impl<'tcx> Visitor<'tcx> for HasStorageDead {
99-
fn visit_local(&mut self, local: &Local, ctx: PlaceContext<'tcx>, _: Location) {
99+
fn visit_local(&mut self, local: &Local, ctx: PlaceContext, _: Location) {
100100
if ctx == PlaceContext::NonUse(NonUseContext::StorageDead) {
101101
self.0.insert(*local);
102102
}
@@ -185,7 +185,6 @@ struct GatherBorrows<'a, 'gcx: 'tcx, 'tcx: 'a> {
185185
impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> {
186186
fn visit_assign(
187187
&mut self,
188-
block: mir::BasicBlock,
189188
assigned_place: &mir::Place<'tcx>,
190189
rvalue: &mir::Rvalue<'tcx>,
191190
location: mir::Location,
@@ -216,13 +215,13 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> {
216215
}
217216
}
218217

219-
self.super_assign(block, assigned_place, rvalue, location)
218+
self.super_assign(assigned_place, rvalue, location)
220219
}
221220

222221
fn visit_local(
223222
&mut self,
224223
temp: &Local,
225-
context: PlaceContext<'tcx>,
224+
context: PlaceContext,
226225
location: Location,
227226
) {
228227
if !context.is_use() {
@@ -288,15 +287,6 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> {
288287

289288
return self.super_rvalue(rvalue, location);
290289
}
291-
292-
fn visit_statement(
293-
&mut self,
294-
block: mir::BasicBlock,
295-
statement: &mir::Statement<'tcx>,
296-
location: Location,
297-
) {
298-
return self.super_statement(block, statement, location);
299-
}
300290
}
301291

302292
impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> {

src/librustc_mir/borrow_check/nll/constraint_generation.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx
100100

101101
fn visit_statement(
102102
&mut self,
103-
block: BasicBlock,
104103
statement: &Statement<'tcx>,
105104
location: Location,
106105
) {
@@ -117,12 +116,11 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx
117116
));
118117
}
119118

120-
self.super_statement(block, statement, location);
119+
self.super_statement(statement, location);
121120
}
122121

123122
fn visit_assign(
124123
&mut self,
125-
block: BasicBlock,
126124
place: &Place<'tcx>,
127125
rvalue: &Rvalue<'tcx>,
128126
location: Location,
@@ -141,12 +139,11 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx
141139
}
142140
}
143141

144-
self.super_assign(block, place, rvalue, location);
142+
self.super_assign(place, rvalue, location);
145143
}
146144

147145
fn visit_terminator(
148146
&mut self,
149-
block: BasicBlock,
150147
terminator: &Terminator<'tcx>,
151148
location: Location,
152149
) {
@@ -167,7 +164,7 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx
167164
}
168165
}
169166

170-
self.super_terminator(block, terminator, location);
167+
self.super_terminator(terminator, location);
171168
}
172169

173170
fn visit_ascribe_user_ty(

src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ enum DefUseResult {
113113
}
114114

115115
impl<'cx, 'gcx, 'tcx> Visitor<'tcx> for DefUseVisitor<'cx, 'gcx, 'tcx> {
116-
fn visit_local(&mut self, &local: &Local, context: PlaceContext<'tcx>, _: Location) {
116+
fn visit_local(&mut self, &local: &Local, context: PlaceContext, _: Location) {
117117
let local_ty = self.mir.local_decls[local].ty;
118118

119119
let mut found_it = false;

src/librustc_mir/borrow_check/nll/invalidation.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc::ty::TyCtxt;
1414
use rustc::mir::visit::Visitor;
1515
use rustc::mir::{BasicBlock, Location, Mir, Place, PlaceBase, Rvalue};
1616
use rustc::mir::{Statement, StatementKind};
17-
use rustc::mir::{Terminator, TerminatorKind};
17+
use rustc::mir::TerminatorKind;
1818
use rustc::mir::{Operand, BorrowKind};
1919
use rustc_data_structures::graph::dominators::Dominators;
2020

@@ -58,7 +58,6 @@ struct InvalidationGenerator<'cx, 'tcx: 'cx, 'gcx: 'tcx> {
5858
impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> {
5959
fn visit_statement(
6060
&mut self,
61-
block: BasicBlock,
6261
statement: &Statement<'tcx>,
6362
location: Location,
6463
) {
@@ -134,18 +133,17 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> {
134133
}
135134
}
136135

137-
self.super_statement(block, statement, location);
136+
self.super_statement(statement, location);
138137
}
139138

140-
fn visit_terminator(
139+
fn visit_terminator_kind(
141140
&mut self,
142-
block: BasicBlock,
143-
terminator: &Terminator<'tcx>,
141+
kind: &TerminatorKind<'tcx>,
144142
location: Location
145143
) {
146144
self.check_activations(location);
147145

148-
match terminator.kind {
146+
match kind {
149147
TerminatorKind::SwitchInt {
150148
ref discr,
151149
switch_ty: _,
@@ -258,7 +256,7 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> {
258256
}
259257
}
260258

261-
self.super_terminator(block, terminator, location);
259+
self.super_terminator_kind(kind, location);
262260
}
263261
}
264262

src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl LocalUseMapBuild<'_> {
160160
}
161161

162162
impl Visitor<'tcx> for LocalUseMapBuild<'_> {
163-
fn visit_local(&mut self, &local: &Local, context: PlaceContext<'tcx>, location: Location) {
163+
fn visit_local(&mut self, &local: &Local, context: PlaceContext, location: Location) {
164164
if self.locals_with_use_data[local] {
165165
match categorize(context) {
166166
Some(DefUse::Def) => self.insert_def(local, location),

src/librustc_mir/borrow_check/nll/type_check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> {
269269
}
270270
}
271271

272-
fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext<'_>, location: Location) {
272+
fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location: Location) {
273273
self.sanitize_place(place, location, context);
274274
}
275275

@@ -447,7 +447,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
447447
&mut self,
448448
place: &Place<'tcx>,
449449
location: Location,
450-
context: PlaceContext<'_>,
450+
context: PlaceContext,
451451
) -> PlaceTy<'tcx> {
452452
debug!("sanitize_place: {:?}", place);
453453
let place_ty = match place {

src/librustc_mir/borrow_check/used_muts.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc::mir::visit::{PlaceContext, Visitor};
22
use rustc::mir::{
3-
BasicBlock, Local, Location, Place, PlaceBase, Statement, StatementKind, TerminatorKind
3+
Local, Location, Place, PlaceBase, Statement, StatementKind, TerminatorKind
44
};
55

66
use rustc_data_structures::fx::FxHashSet;
@@ -55,7 +55,6 @@ struct GatherUsedMutsVisitor<'visit, 'cx: 'visit, 'gcx: 'tcx, 'tcx: 'cx> {
5555
impl<'visit, 'cx, 'gcx, 'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'visit, 'cx, 'gcx, 'tcx> {
5656
fn visit_terminator_kind(
5757
&mut self,
58-
_block: BasicBlock,
5958
kind: &TerminatorKind<'tcx>,
6059
_location: Location,
6160
) {
@@ -77,7 +76,6 @@ impl<'visit, 'cx, 'gcx, 'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'visit, 'c
7776

7877
fn visit_statement(
7978
&mut self,
80-
_block: BasicBlock,
8179
statement: &Statement<'tcx>,
8280
_location: Location,
8381
) {
@@ -104,7 +102,7 @@ impl<'visit, 'cx, 'gcx, 'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'visit, 'c
104102
fn visit_local(
105103
&mut self,
106104
local: &Local,
107-
place_context: PlaceContext<'tcx>,
105+
place_context: PlaceContext,
108106
location: Location,
109107
) {
110108
if place_context.is_place_assignment() && self.temporary_used_locals.contains(local) {

src/librustc_mir/dataflow/impls/borrowed_locals.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<'a, 'tcx> BitDenotation<'tcx> for HaveBeenBorrowedLocals<'a, 'tcx> {
4444

4545
BorrowedLocalsVisitor {
4646
sets,
47-
}.visit_statement(loc.block, stmt, loc);
47+
}.visit_statement(stmt, loc);
4848

4949
// StorageDead invalidates all borrows and raw pointers to a local
5050
match stmt.kind {
@@ -58,7 +58,7 @@ impl<'a, 'tcx> BitDenotation<'tcx> for HaveBeenBorrowedLocals<'a, 'tcx> {
5858
loc: Location) {
5959
BorrowedLocalsVisitor {
6060
sets,
61-
}.visit_terminator(loc.block, self.mir[loc.block].terminator(), loc);
61+
}.visit_terminator(self.mir[loc.block].terminator(), loc);
6262
}
6363

6464
fn propagate_call_return(

src/librustc_mir/monomorphize/collector.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,6 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
615615
}
616616

617617
fn visit_terminator_kind(&mut self,
618-
block: mir::BasicBlock,
619618
kind: &mir::TerminatorKind<'tcx>,
620619
location: Location) {
621620
debug!("visiting terminator {:?} @ {:?}", kind, location);
@@ -654,12 +653,12 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
654653
mir::TerminatorKind::FalseUnwind { .. } => bug!(),
655654
}
656655

657-
self.super_terminator_kind(block, kind, location);
656+
self.super_terminator_kind(kind, location);
658657
}
659658

660659
fn visit_place(&mut self,
661660
place: &mir::Place<'tcx>,
662-
context: mir::visit::PlaceContext<'tcx>,
661+
context: mir::visit::PlaceContext,
663662
location: Location) {
664663
match place {
665664
Place::Base(

src/librustc_mir/transform/check_unsafety.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ impl<'a, 'gcx, 'tcx> UnsafetyChecker<'a, 'tcx> {
6565

6666
impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
6767
fn visit_terminator(&mut self,
68-
block: BasicBlock,
6968
terminator: &Terminator<'tcx>,
7069
location: Location)
7170
{
@@ -97,11 +96,10 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
9796
}
9897
}
9998
}
100-
self.super_terminator(block, terminator, location);
99+
self.super_terminator(terminator, location);
101100
}
102101

103102
fn visit_statement(&mut self,
104-
block: BasicBlock,
105103
statement: &Statement<'tcx>,
106104
location: Location)
107105
{
@@ -124,7 +122,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
124122
UnsafetyViolationKind::General)
125123
},
126124
}
127-
self.super_statement(block, statement, location);
125+
self.super_statement(statement, location);
128126
}
129127

130128
fn visit_rvalue(&mut self,
@@ -201,7 +199,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
201199

202200
fn visit_place(&mut self,
203201
place: &Place<'tcx>,
204-
context: PlaceContext<'tcx>,
202+
context: PlaceContext,
205203
location: Location) {
206204
match place {
207205
&Place::Projection(box Projection {

src/librustc_mir/transform/cleanup_post_borrowck.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! [`FakeRead`]: rustc::mir::StatementKind::FakeRead
1717
//! [`Nop`]: rustc::mir::StatementKind::Nop
1818
19-
use rustc::mir::{BasicBlock, BorrowKind, Rvalue, Location, Mir};
19+
use rustc::mir::{BorrowKind, Rvalue, Location, Mir};
2020
use rustc::mir::{Statement, StatementKind};
2121
use rustc::mir::visit::MutVisitor;
2222
use rustc::ty::TyCtxt;
@@ -38,7 +38,6 @@ impl MirPass for CleanupNonCodegenStatements {
3838

3939
impl<'tcx> MutVisitor<'tcx> for DeleteNonCodegenStatements {
4040
fn visit_statement(&mut self,
41-
block: BasicBlock,
4241
statement: &mut Statement<'tcx>,
4342
location: Location) {
4443
match statement.kind {
@@ -47,6 +46,6 @@ impl<'tcx> MutVisitor<'tcx> for DeleteNonCodegenStatements {
4746
| StatementKind::FakeRead(..) => statement.make_nop(),
4847
_ => (),
4948
}
50-
self.super_statement(block, statement, location);
49+
self.super_statement(statement, location);
5150
}
5251
}

0 commit comments

Comments
 (0)