Skip to content

Commit 82c9966

Browse files
committed
Make ExprUseVisitor<..> use inherited parameter environments.
1 parent d0f70eb commit 82c9966

File tree

7 files changed

+13
-14
lines changed

7 files changed

+13
-14
lines changed

src/librustc/middle/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ fn check_for_mutation_in_guard<'a, 'tcx>(cx: &'a MatchCheckCtxt<'a, 'tcx>,
10651065
};
10661066
let mut visitor = ExprUseVisitor::new(&mut checker,
10671067
checker.cx.tcx,
1068-
cx.param_env.clone());
1068+
&cx.param_env);
10691069
visitor.walk_expr(guard);
10701070
}
10711071

src/librustc/middle/check_rvalues.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl<'a, 'tcx, 'v> visit::Visitor<'v> for RvalueContext<'a, 'tcx> {
4040
fn_id: ast::NodeId) {
4141
{
4242
let param_env = ParameterEnvironment::for_item(self.tcx, fn_id);
43-
let mut euv = euv::ExprUseVisitor::new(self, self.tcx, param_env);
43+
let mut euv = euv::ExprUseVisitor::new(self, self.tcx, &param_env);
4444
euv.walk_fn(fd, b);
4545
}
4646
visit::walk_fn(self, fk, fd, b, s)

src/librustc/middle/check_static.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn check_crate(tcx: &ty::ctxt) {
7171
};
7272
{
7373
let param_env = ty::empty_parameter_environment();
74-
let visitor = euv::ExprUseVisitor::new(&mut checker, tcx, param_env);
74+
let visitor = euv::ExprUseVisitor::new(&mut checker, tcx, &param_env);
7575
visit::walk_crate(&mut GlobalVisitor(visitor), tcx.map.krate());
7676
}
7777
visit::walk_crate(&mut CheckStaticVisitor {

src/librustc/middle/expr_use_visitor.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,11 @@ impl OverloadedCallType {
295295
// supplies types from the tree. After type checking is complete, you
296296
// can just use the tcx as the typer.
297297

298-
pub struct ExprUseVisitor<'d,'t,'tcx,TYPER:'t> {
298+
pub struct ExprUseVisitor<'d,'t,'tcx:'t,TYPER:'t> {
299299
typer: &'t TYPER,
300300
mc: mc::MemCategorizationContext<'t,TYPER>,
301301
delegate: &'d mut (Delegate<'tcx>+'d),
302-
param_env: ParameterEnvironment<'tcx>,
302+
param_env: &'t ParameterEnvironment<'tcx>,
303303
}
304304

305305
/// Whether the elements of an overloaded operation are passed by value or by reference
@@ -311,7 +311,7 @@ enum PassArgs {
311311
impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
312312
pub fn new(delegate: &'d mut Delegate<'tcx>,
313313
typer: &'t TYPER,
314-
param_env: ParameterEnvironment<'tcx>)
314+
param_env: &'t ParameterEnvironment<'tcx>)
315315
-> ExprUseVisitor<'d,'t,'tcx,TYPER> {
316316
ExprUseVisitor {
317317
typer: typer,
@@ -355,7 +355,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
355355
cmt: mc::cmt<'tcx>) {
356356
let mode = copy_or_move(self.tcx(),
357357
cmt.ty,
358-
&self.param_env,
358+
self.param_env,
359359
DirectRefMove);
360360
self.delegate.consume(consume_id, consume_span, cmt, mode);
361361
}
@@ -991,7 +991,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
991991
ast::PatIdent(ast::BindByValue(_), _, _) => {
992992
match copy_or_move(tcx,
993993
cmt_pat.ty,
994-
&self.param_env,
994+
self.param_env,
995995
PatBindingMove) {
996996
Copy => mode.lub(CopyingMatch),
997997
Move(_) => mode.lub(MovingMatch),
@@ -1021,8 +1021,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
10211021
let typer = self.typer;
10221022
let def_map = &self.typer.tcx().def_map;
10231023
let delegate = &mut self.delegate;
1024-
let param_env = &mut self.param_env;
1025-
1024+
let param_env = self.param_env;
10261025
mc.cat_pattern(cmt_discr.clone(), pat, |mc, cmt_pat, pat| {
10271026
if pat_util::pat_is_binding(def_map, pat) {
10281027
let tcx = typer.tcx();
@@ -1242,7 +1241,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
12421241
closure_expr.span,
12431242
freevar.def);
12441243
let mode = copy_or_move(self.tcx(), cmt_var.ty,
1245-
&self.param_env, CaptureMove);
1244+
self.param_env, CaptureMove);
12461245
self.delegate.consume(closure_expr.id, freevar.span, cmt_var, mode);
12471246
}
12481247
}

src/librustc_borrowck/borrowck/check_loans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
210210
{
211211
let mut euv = euv::ExprUseVisitor::new(&mut clcx,
212212
bccx.tcx,
213-
param_env.clone());
213+
&param_env);
214214
euv.walk_fn(decl, body);
215215
}
216216
}

src/librustc_borrowck/borrowck/gather_loans/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn gather_loans_in_fn<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
5353
{
5454
let mut euv = euv::ExprUseVisitor::new(&mut glcx,
5555
bccx.tcx,
56-
param_env);
56+
&param_env);
5757
euv.walk_fn(decl, body);
5858
}
5959

src/librustc_trans/trans/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ fn is_discr_reassigned(bcx: Block, discr: &ast::Expr, body: &ast::Expr) -> bool
12611261
};
12621262
{
12631263
let param_env = ty::empty_parameter_environment();
1264-
let mut visitor = euv::ExprUseVisitor::new(&mut rc, bcx, param_env);
1264+
let mut visitor = euv::ExprUseVisitor::new(&mut rc, bcx, &param_env);
12651265
visitor.walk_expr(body);
12661266
}
12671267
rc.reassigned

0 commit comments

Comments
 (0)