accommodate new scoping rules in rustc and rustdoc source.
This commit is contained in:
parent
1c87af2eba
commit
86bde933f8
9 changed files with 45 additions and 41 deletions
|
@ -809,6 +809,8 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
let scope_id = same_regions[0].scope_id;
|
let scope_id = same_regions[0].scope_id;
|
||||||
let parent = self.tcx.map.get_parent(scope_id);
|
let parent = self.tcx.map.get_parent(scope_id);
|
||||||
let parent_node = self.tcx.map.find(parent);
|
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 {
|
let node_inner = match parent_node {
|
||||||
Some(ref node) => match *node {
|
Some(ref node) => match *node {
|
||||||
ast_map::NodeItem(ref item) => {
|
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)
|
let (fn_decl, generics, unsafety, ident, expl_self, span)
|
||||||
= node_inner.expect("expect item fn");
|
= 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,
|
let rebuilder = Rebuilder::new(self.tcx, fn_decl, expl_self,
|
||||||
generics, same_regions, &life_giver);
|
generics, same_regions, &life_giver);
|
||||||
let (fn_decl, expl_self, generics) = rebuilder.rebuild();
|
let (fn_decl, expl_self, generics) = rebuilder.rebuild();
|
||||||
|
|
|
@ -100,6 +100,7 @@ pub fn compile_input(sess: Session,
|
||||||
&id[]));
|
&id[]));
|
||||||
|
|
||||||
let mut forest = ast_map::Forest::new(expanded_crate);
|
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);
|
let ast_map = assign_node_ids_and_map(&sess, &mut forest);
|
||||||
|
|
||||||
write_out_deps(&sess, input, &outputs, &id[]);
|
write_out_deps(&sess, input, &outputs, &id[]);
|
||||||
|
@ -111,7 +112,6 @@ pub fn compile_input(sess: Session,
|
||||||
&ast_map,
|
&ast_map,
|
||||||
&id[]));
|
&id[]));
|
||||||
|
|
||||||
let arenas = ty::CtxtArenas::new();
|
|
||||||
let analysis = phase_3_run_analysis_passes(sess,
|
let analysis = phase_3_run_analysis_passes(sess,
|
||||||
ast_map,
|
ast_map,
|
||||||
&arenas,
|
&arenas,
|
||||||
|
|
|
@ -1784,15 +1784,16 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
||||||
debug!("trans_closure(..., param_substs={})",
|
debug!("trans_closure(..., param_substs={})",
|
||||||
param_substs.repr(ccx.tcx()));
|
param_substs.repr(ccx.tcx()));
|
||||||
|
|
||||||
let arena = TypedArena::new();
|
let (arena, fcx): (TypedArena<_>, FunctionContext);
|
||||||
let fcx = new_fn_ctxt(ccx,
|
arena = TypedArena::new();
|
||||||
llfndecl,
|
fcx = new_fn_ctxt(ccx,
|
||||||
fn_ast_id,
|
llfndecl,
|
||||||
closure_env.kind != closure::NotClosure,
|
fn_ast_id,
|
||||||
output_type,
|
closure_env.kind != closure::NotClosure,
|
||||||
param_substs,
|
output_type,
|
||||||
Some(body.span),
|
param_substs,
|
||||||
&arena);
|
Some(body.span),
|
||||||
|
&arena);
|
||||||
let mut bcx = init_function(&fcx, false, output_type);
|
let mut bcx = init_function(&fcx, false, output_type);
|
||||||
|
|
||||||
// cleanup scope for the incoming arguments
|
// 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))[])
|
ty_to_string(ccx.tcx(), ctor_ty))[])
|
||||||
};
|
};
|
||||||
|
|
||||||
let arena = TypedArena::new();
|
let (arena, fcx): (TypedArena<_>, FunctionContext);
|
||||||
let fcx = new_fn_ctxt(ccx, llfndecl, ctor_id, false, result_ty,
|
arena = TypedArena::new();
|
||||||
param_substs, None, &arena);
|
fcx = new_fn_ctxt(ccx, llfndecl, ctor_id, false, result_ty,
|
||||||
|
param_substs, None, &arena);
|
||||||
let bcx = init_function(&fcx, false, result_ty);
|
let bcx = init_function(&fcx, false, result_ty);
|
||||||
|
|
||||||
assert!(!fcx.needs_ret_allocas);
|
assert!(!fcx.needs_ret_allocas);
|
||||||
|
|
|
@ -322,16 +322,17 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
|
||||||
&function_name[]);
|
&function_name[]);
|
||||||
|
|
||||||
//
|
//
|
||||||
let block_arena = TypedArena::new();
|
|
||||||
let empty_substs = Substs::trans_empty();
|
let empty_substs = Substs::trans_empty();
|
||||||
let fcx = new_fn_ctxt(ccx,
|
let (block_arena, fcx): (TypedArena<_>, FunctionContext);
|
||||||
llfn,
|
block_arena = TypedArena::new();
|
||||||
ast::DUMMY_NODE_ID,
|
fcx = new_fn_ctxt(ccx,
|
||||||
false,
|
llfn,
|
||||||
sig.output,
|
ast::DUMMY_NODE_ID,
|
||||||
&empty_substs,
|
false,
|
||||||
None,
|
sig.output,
|
||||||
&block_arena);
|
&empty_substs,
|
||||||
|
None,
|
||||||
|
&block_arena);
|
||||||
let mut bcx = init_function(&fcx, false, sig.output);
|
let mut bcx = init_function(&fcx, false, sig.output);
|
||||||
|
|
||||||
// the first argument (`self`) will be ptr to the the fn pointer
|
// 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 glue_name = format!("glue {} {}", name, ty_to_short_str(ccx.tcx(), t));
|
||||||
let _s = StatRecorder::new(ccx, glue_name);
|
let _s = StatRecorder::new(ccx, glue_name);
|
||||||
|
|
||||||
let arena = TypedArena::new();
|
|
||||||
let empty_param_substs = Substs::trans_empty();
|
let empty_param_substs = Substs::trans_empty();
|
||||||
let fcx = new_fn_ctxt(ccx, llfn, ast::DUMMY_NODE_ID, false,
|
let (arena, fcx): (TypedArena<_>, FunctionContext);
|
||||||
ty::FnConverging(ty::mk_nil(ccx.tcx())),
|
arena = TypedArena::new();
|
||||||
&empty_param_substs, None, &arena);
|
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())));
|
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 sig = ty::erase_late_bound_regions(ccx.tcx(), &fty.sig);
|
||||||
|
|
||||||
//
|
|
||||||
let block_arena = TypedArena::new();
|
|
||||||
let empty_substs = Substs::trans_empty();
|
let empty_substs = Substs::trans_empty();
|
||||||
let fcx = new_fn_ctxt(ccx,
|
let (block_arena, fcx): (TypedArena<_>, FunctionContext);
|
||||||
llfn,
|
block_arena = TypedArena::new();
|
||||||
ast::DUMMY_NODE_ID,
|
fcx = new_fn_ctxt(ccx,
|
||||||
false,
|
llfn,
|
||||||
sig.output,
|
ast::DUMMY_NODE_ID,
|
||||||
&empty_substs,
|
false,
|
||||||
None,
|
sig.output,
|
||||||
&block_arena);
|
&empty_substs,
|
||||||
|
None,
|
||||||
|
&block_arena);
|
||||||
let mut bcx = init_function(&fcx, false, sig.output);
|
let mut bcx = init_function(&fcx, false, sig.output);
|
||||||
|
|
||||||
// the first argument (`self`) will be a trait object
|
// the first argument (`self`) will be a trait object
|
||||||
|
|
|
@ -1049,8 +1049,8 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
|
||||||
// if there are any.
|
// if there are any.
|
||||||
assert_eq!(substs.types.len(subst::FnSpace), 0);
|
assert_eq!(substs.types.len(subst::FnSpace), 0);
|
||||||
assert_eq!(substs.regions().len(subst::FnSpace), 0);
|
assert_eq!(substs.regions().len(subst::FnSpace), 0);
|
||||||
let mut substs = substs;
|
|
||||||
let placeholder;
|
let placeholder;
|
||||||
|
let mut substs = substs;
|
||||||
if
|
if
|
||||||
!method.generics.types.is_empty_in(subst::FnSpace) ||
|
!method.generics.types.is_empty_in(subst::FnSpace) ||
|
||||||
!method.generics.regions.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();
|
let name = ident.get();
|
||||||
// only find fits with at least one matching letter
|
// only find fits with at least one matching letter
|
||||||
let mut best_dist = name.len();
|
let mut best_dist = name.len();
|
||||||
let mut best = None;
|
|
||||||
let fields = ty::lookup_struct_fields(tcx, id);
|
let fields = ty::lookup_struct_fields(tcx, id);
|
||||||
|
let mut best = None;
|
||||||
for elem in fields.iter() {
|
for elem in fields.iter() {
|
||||||
let n = elem.name.as_str();
|
let n = elem.name.as_str();
|
||||||
// ignore already set fields
|
// 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!");
|
.expect("phase_2_configure_and_expand aborted in rustdoc!");
|
||||||
|
|
||||||
let mut forest = ast_map::Forest::new(krate);
|
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 ast_map = driver::assign_node_ids_and_map(&sess, &mut forest);
|
||||||
|
|
||||||
let arenas = ty::CtxtArenas::new();
|
|
||||||
let ty::CrateAnalysis {
|
let ty::CrateAnalysis {
|
||||||
exported_items, public_items, ty_cx, ..
|
exported_items, public_items, ty_cx, ..
|
||||||
} = driver::phase_3_run_analysis_passes(sess,
|
} = driver::phase_3_run_analysis_passes(sess,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue