Skip to content

Commit acdda3d

Browse files
committed
---
yaml --- r: 277030 b: refs/heads/try c: 35a6e6a h: refs/heads/master
1 parent 317fba9 commit acdda3d

File tree

7 files changed

+23
-31
lines changed

7 files changed

+23
-31
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: a563711b6a13eb93ac59d4de29e079281f4866f3
4+
refs/heads/try: 35a6e6a02bb5035c21b3d94fd8238b687bb52573
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_trans/base.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,20 +1400,23 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> {
14001400
pub fn new(ccx: &'blk CrateContext<'blk, 'tcx>,
14011401
llfndecl: ValueRef,
14021402
fn_ty: FnType,
1403-
def_id: Option<DefId>,
1404-
param_substs: &'tcx Substs<'tcx>,
1403+
instance: Option<Instance<'tcx>>,
14051404
block_arena: &'blk TypedArena<common::BlockS<'blk, 'tcx>>)
14061405
-> FunctionContext<'blk, 'tcx> {
1407-
common::validate_substs(param_substs);
1406+
let (param_substs, def_id) = match instance {
1407+
Some(instance) => {
1408+
common::validate_substs(instance.substs);
1409+
(instance.substs, Some(instance.def))
1410+
}
1411+
None => (ccx.tcx().mk_substs(Substs::empty()), None)
1412+
};
14081413

14091414
let inlined_did = def_id.and_then(|def_id| inline::get_local_instance(ccx, def_id));
14101415
let inlined_id = inlined_did.and_then(|id| ccx.tcx().map.as_local_node_id(id));
14111416
let local_id = def_id.and_then(|id| ccx.tcx().map.as_local_node_id(id));
14121417

1413-
debug!("FunctionContext::new(path={}, def_id={:?}, param_substs={:?})",
1414-
inlined_id.map_or(String::new(), |id| ccx.tcx().node_path_str(id)),
1415-
def_id,
1416-
param_substs);
1418+
debug!("FunctionContext::new({})",
1419+
instance.map_or(String::new(), |i| i.to_string()));
14171420

14181421
let debug_context = debuginfo::create_function_debug_context(ccx,
14191422
inlined_id.unwrap_or(ast::DUMMY_NODE_ID), param_substs, llfndecl);
@@ -1810,27 +1813,25 @@ pub fn trans_closure<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
18101813
decl: &hir::FnDecl,
18111814
body: &hir::Block,
18121815
llfndecl: ValueRef,
1813-
param_substs: &'tcx Substs<'tcx>,
1814-
def_id: DefId,
1816+
instance: Instance<'tcx>,
18151817
inlined_id: ast::NodeId,
18161818
fn_ty: FnType,
18171819
abi: Abi,
18181820
closure_env: closure::ClosureEnv) {
18191821
ccx.stats().n_closures.set(ccx.stats().n_closures.get() + 1);
18201822

18211823
if collector::collecting_debug_information(ccx) {
1822-
ccx.record_translation_item_as_generated(
1823-
TransItem::Fn(Instance::new(def_id, param_substs)));
1824+
ccx.record_translation_item_as_generated(TransItem::Fn(instance));
18241825
}
18251826

18261827
let _icx = push_ctxt("trans_closure");
18271828
attributes::emit_uwtable(llfndecl, true);
18281829

1829-
debug!("trans_closure(..., param_substs={:?})", param_substs);
1830+
debug!("trans_closure(..., {})", instance);
18301831

18311832
let (arena, fcx): (TypedArena<_>, FunctionContext);
18321833
arena = TypedArena::new();
1833-
fcx = FunctionContext::new(ccx, llfndecl, fn_ty, Some(def_id), param_substs, &arena);
1834+
fcx = FunctionContext::new(ccx, llfndecl, fn_ty, Some(instance), &arena);
18341835

18351836
if fcx.mir.is_some() {
18361837
return mir::trans_mir(&fcx);
@@ -1921,8 +1922,7 @@ pub fn trans_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
19211922
decl,
19221923
body,
19231924
llfndecl,
1924-
param_substs,
1925-
def_id,
1925+
Instance::new(def_id, param_substs),
19261926
id,
19271927
fn_ty,
19281928
abi,
@@ -2015,9 +2015,7 @@ pub fn trans_ctor_shim<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
20152015

20162016
let (arena, fcx): (TypedArena<_>, FunctionContext);
20172017
arena = TypedArena::new();
2018-
fcx = FunctionContext::new(ccx, llfndecl, fn_ty,
2019-
Some(ccx.tcx().map.local_def_id(ctor_id)),
2020-
param_substs, &arena);
2018+
fcx = FunctionContext::new(ccx, llfndecl, fn_ty, None, &arena);
20212019
let bcx = fcx.init(false, None);
20222020

20232021
assert!(!fcx.needs_ret_allocas);

branches/try/src/librustc_trans/callee.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use middle::cstore::LOCAL_CRATE;
2424
use rustc::hir::def_id::DefId;
2525
use rustc::infer;
2626
use rustc::ty::subst;
27-
use rustc::ty::subst::{Substs};
2827
use rustc::traits;
2928
use rustc::hir::map as hir_map;
3029
use abi::{Abi, FnType};
@@ -385,10 +384,9 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
385384
let llfn = declare::define_internal_fn(ccx, &function_name, tuple_fn_ty);
386385

387386
//
388-
let empty_substs = tcx.mk_substs(Substs::empty());
389387
let (block_arena, fcx): (TypedArena<_>, FunctionContext);
390388
block_arena = TypedArena::new();
391-
fcx = FunctionContext::new(ccx, llfn, fn_ty, None, empty_substs, &block_arena);
389+
fcx = FunctionContext::new(ccx, llfn, fn_ty, None, &block_arena);
392390
let mut bcx = fcx.init(false, None);
393391

394392
let llargs = get_params(fcx.llfn);

branches/try/src/librustc_trans/closure.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,7 @@ pub fn trans_closure_expr<'a, 'tcx>(dest: Dest<'a, 'tcx>,
240240
decl,
241241
body,
242242
llfn,
243-
param_substs,
244-
closure_def_id,
243+
Instance::new(closure_def_id, param_substs),
245244
id,
246245
fn_ty,
247246
Abi::RustCall,
@@ -387,7 +386,7 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
387386

388387
let (block_arena, fcx): (TypedArena<_>, FunctionContext);
389388
block_arena = TypedArena::new();
390-
fcx = FunctionContext::new(ccx, lloncefn, fn_ty, None, substs.func_substs, &block_arena);
389+
fcx = FunctionContext::new(ccx, lloncefn, fn_ty, None, &block_arena);
391390
let mut bcx = fcx.init(false, None);
392391

393392

branches/try/src/librustc_trans/glue.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,9 @@ fn get_drop_glue_core<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
272272

273273
let _s = StatRecorder::new(ccx, format!("drop {:?}", t));
274274

275-
let empty_substs = ccx.tcx().mk_substs(Substs::empty());
276275
let (arena, fcx): (TypedArena<_>, FunctionContext);
277276
arena = TypedArena::new();
278-
fcx = FunctionContext::new(ccx, llfn, fn_ty, None, empty_substs, &arena);
277+
fcx = FunctionContext::new(ccx, llfn, fn_ty, None, &arena);
279278

280279
let bcx = fcx.init(false, None);
281280

branches/try/src/librustc_trans/intrinsic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,10 +1319,9 @@ fn gen_fn<'a, 'tcx>(fcx: &FunctionContext<'a, 'tcx>,
13191319
sig: ty::Binder(sig)
13201320
});
13211321
let llfn = declare::define_internal_fn(ccx, name, rust_fn_ty);
1322-
let empty_substs = ccx.tcx().mk_substs(Substs::empty());
13231322
let (fcx, block_arena);
13241323
block_arena = TypedArena::new();
1325-
fcx = FunctionContext::new(ccx, llfn, fn_ty, None, empty_substs, &block_arena);
1324+
fcx = FunctionContext::new(ccx, llfn, fn_ty, None, &block_arena);
13261325
let bcx = fcx.init(true, None);
13271326
trans(bcx);
13281327
fcx.cleanup();

branches/try/src/librustc_trans/meth.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,9 @@ pub fn trans_object_shim<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>,
9393
symbol_names::internal_name_from_type_and_suffix(ccx, method_ty, "object_shim");
9494
let llfn = declare::define_internal_fn(ccx, &function_name, method_ty);
9595

96-
let empty_substs = tcx.mk_substs(Substs::empty());
9796
let (block_arena, fcx): (TypedArena<_>, FunctionContext);
9897
block_arena = TypedArena::new();
99-
fcx = FunctionContext::new(ccx, llfn, fn_ty, None, empty_substs, &block_arena);
98+
fcx = FunctionContext::new(ccx, llfn, fn_ty, None, &block_arena);
10099
let mut bcx = fcx.init(false, None);
101100
assert!(!fcx.needs_ret_allocas);
102101

0 commit comments

Comments
 (0)