Skip to content

Commit acaf284

Browse files
committed
Remove unused tcx and mir params
1 parent 4dbc7f9 commit acaf284

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

src/librustc_mir/transform/qualify_min_const_fn.rs

+18-22
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ fn check_rvalue(
136136
) -> McfResult {
137137
match rvalue {
138138
Rvalue::Repeat(operand, _) | Rvalue::Use(operand) => {
139-
check_operand(tcx, mir, operand, span)
139+
check_operand(operand, span)
140140
}
141141
Rvalue::Len(place) | Rvalue::Discriminant(place) | Rvalue::Ref(_, _, place) => {
142-
check_place(tcx, mir, place, span)
142+
check_place(place, span)
143143
}
144144
Rvalue::Cast(CastKind::Misc, operand, cast_ty) => {
145145
use rustc::ty::cast::CastTy;
@@ -153,11 +153,11 @@ fn check_rvalue(
153153
(CastTy::RPtr(_), CastTy::Float) => bug!(),
154154
(CastTy::RPtr(_), CastTy::Int(_)) => bug!(),
155155
(CastTy::Ptr(_), CastTy::RPtr(_)) => bug!(),
156-
_ => check_operand(tcx, mir, operand, span),
156+
_ => check_operand(operand, span),
157157
}
158158
}
159159
Rvalue::Cast(CastKind::Pointer(PointerCast::MutToConstPointer), operand, _) => {
160-
check_operand(tcx, mir, operand, span)
160+
check_operand(operand, span)
161161
}
162162
Rvalue::Cast(CastKind::Pointer(PointerCast::UnsafeFnPointer), _, _) |
163163
Rvalue::Cast(CastKind::Pointer(PointerCast::ClosureFnPointer(_)), _, _) |
@@ -171,8 +171,8 @@ fn check_rvalue(
171171
)),
172172
// binops are fine on integers
173173
Rvalue::BinaryOp(_, lhs, rhs) | Rvalue::CheckedBinaryOp(_, lhs, rhs) => {
174-
check_operand(tcx, mir, lhs, span)?;
175-
check_operand(tcx, mir, rhs, span)?;
174+
check_operand(lhs, span)?;
175+
check_operand(rhs, span)?;
176176
let ty = lhs.ty(mir, tcx);
177177
if ty.is_integral() || ty.is_bool() || ty.is_char() {
178178
Ok(())
@@ -191,7 +191,7 @@ fn check_rvalue(
191191
Rvalue::UnaryOp(_, operand) => {
192192
let ty = operand.ty(mir, tcx);
193193
if ty.is_integral() || ty.is_bool() {
194-
check_operand(tcx, mir, operand, span)
194+
check_operand(operand, span)
195195
} else {
196196
Err((
197197
span,
@@ -201,7 +201,7 @@ fn check_rvalue(
201201
}
202202
Rvalue::Aggregate(_, operands) => {
203203
for operand in operands {
204-
check_operand(tcx, mir, operand, span)?;
204+
check_operand(operand, span)?;
205205
}
206206
Ok(())
207207
}
@@ -216,11 +216,11 @@ fn check_statement(
216216
let span = statement.source_info.span;
217217
match &statement.kind {
218218
StatementKind::Assign(place, rval) => {
219-
check_place(tcx, mir, place, span)?;
219+
check_place(place, span)?;
220220
check_rvalue(tcx, mir, rval, span)
221221
}
222222

223-
StatementKind::FakeRead(_, place) => check_place(tcx, mir, place, span),
223+
StatementKind::FakeRead(_, place) => check_place(place, span),
224224

225225
// just an assignment
226226
StatementKind::SetDiscriminant { .. } => Ok(()),
@@ -239,22 +239,18 @@ fn check_statement(
239239
}
240240

241241
fn check_operand(
242-
tcx: TyCtxt<'a, 'tcx, 'tcx>,
243-
mir: &'a Mir<'tcx>,
244242
operand: &Operand<'tcx>,
245243
span: Span,
246244
) -> McfResult {
247245
match operand {
248246
Operand::Move(place) | Operand::Copy(place) => {
249-
check_place(tcx, mir, place, span)
247+
check_place(place, span)
250248
}
251249
Operand::Constant(_) => Ok(()),
252250
}
253251
}
254252

255253
fn check_place(
256-
tcx: TyCtxt<'a, 'tcx, 'tcx>,
257-
mir: &'a Mir<'tcx>,
258254
place: &Place<'tcx>,
259255
span: Span,
260256
) -> McfResult {
@@ -268,7 +264,7 @@ fn check_place(
268264
match proj.elem {
269265
| ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. }
270266
| ProjectionElem::Deref | ProjectionElem::Field(..) | ProjectionElem::Index(_) => {
271-
check_place(tcx, mir, &proj.base, span)
267+
check_place(&proj.base, span)
272268
}
273269
| ProjectionElem::Downcast(..) => {
274270
Err((span, "`match` or `if let` in `const fn` is unstable".into()))
@@ -290,11 +286,11 @@ fn check_terminator(
290286
| TerminatorKind::Resume => Ok(()),
291287

292288
TerminatorKind::Drop { location, .. } => {
293-
check_place(tcx, mir, location, span)
289+
check_place(location, span)
294290
}
295291
TerminatorKind::DropAndReplace { location, value, .. } => {
296-
check_place(tcx, mir, location, span)?;
297-
check_operand(tcx, mir, value, span)
292+
check_place(location, span)?;
293+
check_operand(value, span)
298294
},
299295

300296
TerminatorKind::FalseEdges { .. } | TerminatorKind::SwitchInt { .. } => Err((
@@ -346,10 +342,10 @@ fn check_terminator(
346342
)),
347343
}
348344

349-
check_operand(tcx, mir, func, span)?;
345+
check_operand(func, span)?;
350346

351347
for arg in args {
352-
check_operand(tcx, mir, arg, span)?;
348+
check_operand(arg, span)?;
353349
}
354350
Ok(())
355351
} else {
@@ -363,7 +359,7 @@ fn check_terminator(
363359
msg: _,
364360
target: _,
365361
cleanup: _,
366-
} => check_operand(tcx, mir, cond, span),
362+
} => check_operand(cond, span),
367363

368364
TerminatorKind::FalseUnwind { .. } => {
369365
Err((span, "loops are not allowed in const fn".into()))

0 commit comments

Comments
 (0)