mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
accommodate new scoping rules in rustc and rustdoc source.
This commit is contained in:
parent
1c87af2eba
commit
86bde933f8
@ -809,6 +809,8 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
|
||||
let scope_id = same_regions[0].scope_id;
|
||||
let parent = self.tcx.map.get_parent(scope_id);
|
||||
let parent_node = self.tcx.map.find(parent);
|
||||
let taken = lifetimes_in_scope(self.tcx, scope_id);
|
||||
let life_giver = LifeGiver::with_taken(&taken[]);
|
||||
let node_inner = match parent_node {
|
||||
Some(ref node) => match *node {
|
||||
ast_map::NodeItem(ref item) => {
|
||||
@ -851,8 +853,6 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
|
||||
};
|
||||
let (fn_decl, generics, unsafety, ident, expl_self, span)
|
||||
= node_inner.expect("expect item fn");
|
||||
let taken = lifetimes_in_scope(self.tcx, scope_id);
|
||||
let life_giver = LifeGiver::with_taken(&taken[]);
|
||||
let rebuilder = Rebuilder::new(self.tcx, fn_decl, expl_self,
|
||||
generics, same_regions, &life_giver);
|
||||
let (fn_decl, expl_self, generics) = rebuilder.rebuild();
|
||||
|
@ -100,6 +100,7 @@ pub fn compile_input(sess: Session,
|
||||
&id[]));
|
||||
|
||||
let mut forest = ast_map::Forest::new(expanded_crate);
|
||||
let arenas = ty::CtxtArenas::new();
|
||||
let ast_map = assign_node_ids_and_map(&sess, &mut forest);
|
||||
|
||||
write_out_deps(&sess, input, &outputs, &id[]);
|
||||
@ -111,7 +112,6 @@ pub fn compile_input(sess: Session,
|
||||
&ast_map,
|
||||
&id[]));
|
||||
|
||||
let arenas = ty::CtxtArenas::new();
|
||||
let analysis = phase_3_run_analysis_passes(sess,
|
||||
ast_map,
|
||||
&arenas,
|
||||
|
@ -1784,15 +1784,16 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
||||
debug!("trans_closure(..., param_substs={})",
|
||||
param_substs.repr(ccx.tcx()));
|
||||
|
||||
let arena = TypedArena::new();
|
||||
let fcx = new_fn_ctxt(ccx,
|
||||
llfndecl,
|
||||
fn_ast_id,
|
||||
closure_env.kind != closure::NotClosure,
|
||||
output_type,
|
||||
param_substs,
|
||||
Some(body.span),
|
||||
&arena);
|
||||
let (arena, fcx): (TypedArena<_>, FunctionContext);
|
||||
arena = TypedArena::new();
|
||||
fcx = new_fn_ctxt(ccx,
|
||||
llfndecl,
|
||||
fn_ast_id,
|
||||
closure_env.kind != closure::NotClosure,
|
||||
output_type,
|
||||
param_substs,
|
||||
Some(body.span),
|
||||
&arena);
|
||||
let mut bcx = init_function(&fcx, false, output_type);
|
||||
|
||||
// cleanup scope for the incoming arguments
|
||||
@ -2046,9 +2047,10 @@ fn trans_enum_variant_or_tuple_like_struct<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx
|
||||
ty_to_string(ccx.tcx(), ctor_ty))[])
|
||||
};
|
||||
|
||||
let arena = TypedArena::new();
|
||||
let fcx = new_fn_ctxt(ccx, llfndecl, ctor_id, false, result_ty,
|
||||
param_substs, None, &arena);
|
||||
let (arena, fcx): (TypedArena<_>, FunctionContext);
|
||||
arena = TypedArena::new();
|
||||
fcx = new_fn_ctxt(ccx, llfndecl, ctor_id, false, result_ty,
|
||||
param_substs, None, &arena);
|
||||
let bcx = init_function(&fcx, false, result_ty);
|
||||
|
||||
assert!(!fcx.needs_ret_allocas);
|
||||
|
@ -322,16 +322,17 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
|
||||
&function_name[]);
|
||||
|
||||
//
|
||||
let block_arena = TypedArena::new();
|
||||
let empty_substs = Substs::trans_empty();
|
||||
let fcx = new_fn_ctxt(ccx,
|
||||
llfn,
|
||||
ast::DUMMY_NODE_ID,
|
||||
false,
|
||||
sig.output,
|
||||
&empty_substs,
|
||||
None,
|
||||
&block_arena);
|
||||
let (block_arena, fcx): (TypedArena<_>, FunctionContext);
|
||||
block_arena = TypedArena::new();
|
||||
fcx = new_fn_ctxt(ccx,
|
||||
llfn,
|
||||
ast::DUMMY_NODE_ID,
|
||||
false,
|
||||
sig.output,
|
||||
&empty_substs,
|
||||
None,
|
||||
&block_arena);
|
||||
let mut bcx = init_function(&fcx, false, sig.output);
|
||||
|
||||
// the first argument (`self`) will be ptr to the the fn pointer
|
||||
|
@ -540,11 +540,12 @@ fn make_generic_glue<'a, 'tcx, F>(ccx: &CrateContext<'a, 'tcx>,
|
||||
let glue_name = format!("glue {} {}", name, ty_to_short_str(ccx.tcx(), t));
|
||||
let _s = StatRecorder::new(ccx, glue_name);
|
||||
|
||||
let arena = TypedArena::new();
|
||||
let empty_param_substs = Substs::trans_empty();
|
||||
let fcx = new_fn_ctxt(ccx, llfn, ast::DUMMY_NODE_ID, false,
|
||||
ty::FnConverging(ty::mk_nil(ccx.tcx())),
|
||||
&empty_param_substs, None, &arena);
|
||||
let (arena, fcx): (TypedArena<_>, FunctionContext);
|
||||
arena = TypedArena::new();
|
||||
fcx = new_fn_ctxt(ccx, llfn, ast::DUMMY_NODE_ID, false,
|
||||
ty::FnConverging(ty::mk_nil(ccx.tcx())),
|
||||
&empty_param_substs, None, &arena);
|
||||
|
||||
let bcx = init_function(&fcx, false, ty::FnConverging(ty::mk_nil(ccx.tcx())));
|
||||
|
||||
|
@ -601,17 +601,17 @@ pub fn trans_object_shim<'a, 'tcx>(
|
||||
|
||||
let sig = ty::erase_late_bound_regions(ccx.tcx(), &fty.sig);
|
||||
|
||||
//
|
||||
let block_arena = TypedArena::new();
|
||||
let empty_substs = Substs::trans_empty();
|
||||
let fcx = new_fn_ctxt(ccx,
|
||||
llfn,
|
||||
ast::DUMMY_NODE_ID,
|
||||
false,
|
||||
sig.output,
|
||||
&empty_substs,
|
||||
None,
|
||||
&block_arena);
|
||||
let (block_arena, fcx): (TypedArena<_>, FunctionContext);
|
||||
block_arena = TypedArena::new();
|
||||
fcx = new_fn_ctxt(ccx,
|
||||
llfn,
|
||||
ast::DUMMY_NODE_ID,
|
||||
false,
|
||||
sig.output,
|
||||
&empty_substs,
|
||||
None,
|
||||
&block_arena);
|
||||
let mut bcx = init_function(&fcx, false, sig.output);
|
||||
|
||||
// the first argument (`self`) will be a trait object
|
||||
|
@ -1049,8 +1049,8 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
|
||||
// if there are any.
|
||||
assert_eq!(substs.types.len(subst::FnSpace), 0);
|
||||
assert_eq!(substs.regions().len(subst::FnSpace), 0);
|
||||
let mut substs = substs;
|
||||
let placeholder;
|
||||
let mut substs = substs;
|
||||
if
|
||||
!method.generics.types.is_empty_in(subst::FnSpace) ||
|
||||
!method.generics.regions.is_empty_in(subst::FnSpace)
|
||||
|
@ -3101,8 +3101,8 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
|
||||
let name = ident.get();
|
||||
// only find fits with at least one matching letter
|
||||
let mut best_dist = name.len();
|
||||
let mut best = None;
|
||||
let fields = ty::lookup_struct_fields(tcx, id);
|
||||
let mut best = None;
|
||||
for elem in fields.iter() {
|
||||
let n = elem.name.as_str();
|
||||
// ignore already set fields
|
||||
|
@ -126,9 +126,9 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs,
|
||||
.expect("phase_2_configure_and_expand aborted in rustdoc!");
|
||||
|
||||
let mut forest = ast_map::Forest::new(krate);
|
||||
let arenas = ty::CtxtArenas::new();
|
||||
let ast_map = driver::assign_node_ids_and_map(&sess, &mut forest);
|
||||
|
||||
let arenas = ty::CtxtArenas::new();
|
||||
let ty::CrateAnalysis {
|
||||
exported_items, public_items, ty_cx, ..
|
||||
} = driver::phase_3_run_analysis_passes(sess,
|
||||
|
Loading…
Reference in New Issue
Block a user