pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
                                         ast_map: ast_map::Map<'tcx>,
                                         type_arena: &'tcx TypedArena<ty::TyS<'tcx>>,
                                         name: String) -> ty::CrateAnalysis<'tcx> {
    let time_passes = sess.time_passes();
    let krate = ast_map.krate();

    time(time_passes, "external crate/lib resolution", (), |_|
         creader::read_crates(&sess, krate));

    let lang_items = time(time_passes, "language item collection", (), |_|
                          middle::lang_items::collect_language_items(krate, &sess));

    let middle::resolve::CrateMap {
        def_map,
        freevars,
        capture_mode_map,
        exp_map2,
        trait_map,
        external_exports,
        last_private_map
    } =
        time(time_passes, "resolution", (), |_|
             middle::resolve::resolve_crate(&sess, &lang_items, krate));

    // Discard MTWT tables that aren't required past resolution.
    syntax::ext::mtwt::clear_tables();

    let named_region_map = time(time_passes, "lifetime resolution", (),
                                |_| middle::resolve_lifetime::krate(&sess, krate, &def_map));

    time(time_passes, "looking for entry point", (),
         |_| middle::entry::find_entry_point(&sess, &ast_map));

    sess.plugin_registrar_fn.set(
        time(time_passes, "looking for plugin registrar", (), |_|
            plugin::build::find_plugin_registrar(
                sess.diagnostic(), krate)));

    let region_map = time(time_passes, "region resolution", (), |_|
                          middle::region::resolve_crate(&sess, krate));

    time(time_passes, "loop checking", (), |_|
         middle::check_loop::check_crate(&sess, krate));

    let stability_index = time(time_passes, "stability index", (), |_|
                               stability::Index::build(krate));

    time(time_passes, "static item recursion checking", (), |_|
         middle::check_static_recursion::check_crate(&sess, krate, &def_map, &ast_map));

    let ty_cx = ty::mk_ctxt(sess,
                            type_arena,
                            def_map,
                            named_region_map,
                            ast_map,
                            freevars,
                            capture_mode_map,
                            region_map,
                            lang_items,
                            stability_index);

    // passes are timed inside typeck
    typeck::check_crate(&ty_cx, trait_map);

    time(time_passes, "check static items", (), |_|
         middle::check_static::check_crate(&ty_cx));

    // These next two const passes can probably be merged
    time(time_passes, "const marking", (), |_|
         middle::const_eval::process_crate(&ty_cx));

    time(time_passes, "const checking", (), |_|
         middle::check_const::check_crate(&ty_cx));

    let maps = (external_exports, last_private_map);
    let (exported_items, public_items) =
            time(time_passes, "privacy checking", maps, |(a, b)|
                 middle::privacy::check_crate(&ty_cx, &exp_map2, a, b));

    time(time_passes, "intrinsic checking", (), |_|
         middle::intrinsicck::check_crate(&ty_cx));

    time(time_passes, "effect checking", (), |_|
         middle::effect::check_crate(&ty_cx));

    time(time_passes, "match checking", (), |_|
         middle::check_match::check_crate(&ty_cx));

    time(time_passes, "liveness checking", (), |_|
         middle::liveness::check_crate(&ty_cx));

    time(time_passes, "borrow checking", (), |_|
         middle::borrowck::check_crate(&ty_cx));

    time(time_passes, "rvalue checking", (), |_|
         middle::check_rvalues::check_crate(&ty_cx, krate));

    // Avoid overwhelming user with errors if type checking failed.
    // I'm not sure how helpful this is, to be honest, but it avoids a
    // lot of annoying errors in the compile-fail tests (basically,
    // lint warnings and so on -- kindck used to do this abort, but
    // kindck is gone now). -nmatsakis
    ty_cx.sess.abort_if_errors();

    let reachable_map =
        time(time_passes, "reachability checking", (), |_|
             reachable::find_reachable(&ty_cx, &exported_items));

    time(time_passes, "death checking", (), |_| {
        middle::dead::check_crate(&ty_cx,
                                  &exported_items,
                                  &reachable_map)
    });

    time(time_passes, "lint checking", (), |_|
         lint::check_crate(&ty_cx, &exported_items));

    ty::CrateAnalysis {
        exp_map2: exp_map2,
        ty_cx: ty_cx,
        exported_items: exported_items,
        public_items: public_items,
        reachable: reachable_map,
        name: name,
    }
}
/// Run the resolution, typechecking, region checking and other
/// miscellaneous analysis passes on the crate. Return various
/// structures carrying the results of the analysis.
Run the resolution, typechecking, region checking and other
miscellaneous analysis passes on the crate. Return various
structures carrying the results of the analysis.
Run the resolution typechecking region checking and other miscellaneous analysis passes on the crate . Return various structures carrying the results of the analysis .
pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
                                         ast_map: ast_map::Map<'tcx>,
                                         type_arena: &'tcx TypedArena<ty::TyS<'tcx>>,
                                         name: String) -> ty::CrateAnalysis<'tcx> {
    let time_passes = sess.time_passes();
    let krate = ast_map.krate();
    time(time_passes, "external crate/lib resolution", (), |_|
         creader::read_crates(&sess, krate));
    let lang_items = time(time_passes, "language item collection", (), |_|
                          middle::lang_items::collect_language_items(krate, &sess));
    let middle::resolve::CrateMap {
        def_map,
        freevars,
        capture_mode_map,
        exp_map2,
        trait_map,
        external_exports,
        last_private_map
    } =
        time(time_passes, "resolution", (), |_|
             middle::resolve::resolve_crate(&sess, &lang_items, krate));
    // Discard MTWT tables that aren't required past resolution.
    syntax::ext::mtwt::clear_tables();
    let named_region_map = time(time_passes, "lifetime resolution", (),
                                |_| middle::resolve_lifetime::krate(&sess, krate, &def_map));
    time(time_passes, "looking for entry point", (),
         |_| middle::entry::find_entry_point(&sess, &ast_map));
    sess.plugin_registrar_fn.set(
        time(time_passes, "looking for plugin registrar", (), |_|
            plugin::build::find_plugin_registrar(
                sess.diagnostic(), krate)));
    let region_map = time(time_passes, "region resolution", (), |_|
                          middle::region::resolve_crate(&sess, krate));
    time(time_passes, "loop checking", (), |_|
         middle::check_loop::check_crate(&sess, krate));
    let stability_index = time(time_passes, "stability index", (), |_|
                               stability::Index::build(krate));
    time(time_passes, "static item recursion checking", (), |_|
         middle::check_static_recursion::check_crate(&sess, krate, &def_map, &ast_map));
    let ty_cx = ty::mk_ctxt(sess,
                            type_arena,
                            def_map,
                            named_region_map,
                            ast_map,
                            freevars,
                            capture_mode_map,
                            region_map,
                            lang_items,
                            stability_index);
    // passes are timed inside typeck
    typeck::check_crate(&ty_cx, trait_map);
    time(time_passes, "check static items", (), |_|
         middle::check_static::check_crate(&ty_cx));
    // These next two const passes can probably be merged
    time(time_passes, "const marking", (), |_|
         middle::const_eval::process_crate(&ty_cx));
    time(time_passes, "const checking", (), |_|
         middle::check_const::check_crate(&ty_cx));
    let maps = (external_exports, last_private_map);
    let (exported_items, public_items) =
            time(time_passes, "privacy checking", maps, |(a, b)|
                 middle::privacy::check_crate(&ty_cx, &exp_map2, a, b));
    time(time_passes, "intrinsic checking", (), |_|
         middle::intrinsicck::check_crate(&ty_cx));
    time(time_passes, "effect checking", (), |_|
         middle::effect::check_crate(&ty_cx));
    time(time_passes, "match checking", (), |_|
         middle::check_match::check_crate(&ty_cx));
    time(time_passes, "liveness checking", (), |_|
         middle::liveness::check_crate(&ty_cx));
    time(time_passes, "borrow checking", (), |_|
         middle::borrowck::check_crate(&ty_cx));
    time(time_passes, "rvalue checking", (), |_|
         middle::check_rvalues::check_crate(&ty_cx, krate));
    // Avoid overwhelming user with errors if type checking failed.
    // I'm not sure how helpful this is, to be honest, but it avoids a
    // lot of annoying errors in the compile-fail tests (basically,
    // lint warnings and so on -- kindck used to do this abort, but
    // kindck is gone now). -nmatsakis
    ty_cx.sess.abort_if_errors();
    let reachable_map =
        time(time_passes, "reachability checking", (), |_|
             reachable::find_reachable(&ty_cx, &exported_items));
    time(time_passes, "death checking", (), |_| {
        middle::dead::check_crate(&ty_cx,
                                  &exported_items,
                                  &reachable_map)
    });
    time(time_passes, "lint checking", (), |_|
         lint::check_crate(&ty_cx, &exported_items));
    ty::CrateAnalysis {
        exp_map2: exp_map2,
        ty_cx: ty_cx,
        exported_items: exported_items,
        public_items: public_items,
        reachable: reachable_map,
        name: name,
    }
}
pub fn phase_3_run_analysis_passes < ' tcx > ( sess : Session , ast_map : ast_map :: Map < ' tcx > , type_arena : & ' tcx TypedArena < ty :: TyS < ' tcx > > , name : String ) -> ty :: CrateAnalysis < ' tcx > { let time_passes = sess . time_passes ( ) ; let krate = ast_map . krate ( ) ; time ( time_passes , " " , ( ) , | _ | creader :: read_crates ( & sess , krate ) ) ; let lang_items = time ( time_passes , " " , ( ) , | _ | middle :: lang_items :: collect_language_items ( krate , & sess ) ) ; let middle :: resolve :: CrateMap { def_map , freevars , capture_mode_map , exp_map2 , trait_map , external_exports , last_private_map } = time ( time_passes , " " , ( ) , | _ | middle :: resolve :: resolve_crate ( & sess , & lang_items , krate ) ) ; // Discard MTWT tables that aren't required past resolution. syntax :: ext :: mtwt :: clear_tables ( ) ; let named_region_map = time ( time_passes , " " , ( ) , | _ | middle :: resolve_lifetime :: krate ( & sess , krate , & def_map ) ) ; time ( time_passes , " " , ( ) , | _ | middle :: entry :: find_entry_point ( & sess , & ast_map ) ) ; sess . plugin_registrar_fn . set ( time ( time_passes , " " , ( ) , | _ | plugin :: build :: find_plugin_registrar ( sess . diagnostic ( ) , krate ) ) ) ; let region_map = time ( time_passes , " " , ( ) , | _ | middle :: region :: resolve_crate ( & sess , krate ) ) ; time ( time_passes , " " , ( ) , | _ | middle :: check_loop :: check_crate ( & sess , krate ) ) ; let stability_index = time ( time_passes , " " , ( ) , | _ | stability :: Index :: build ( krate ) ) ; time ( time_passes , " " , ( ) , | _ | middle :: check_static_recursion :: check_crate ( & sess , krate , & def_map , & ast_map ) ) ; let ty_cx = ty :: mk_ctxt ( sess , type_arena , def_map , named_region_map , ast_map , freevars , capture_mode_map , region_map , lang_items , stability_index ) ; // passes are timed inside typeck typeck :: check_crate ( & ty_cx , trait_map ) ; time ( time_passes , " " , ( ) , | _ | middle :: check_static :: check_crate ( & ty_cx ) ) ; // These next two const passes can probably be merged time ( time_passes , " " , ( ) , | _ | middle :: const_eval :: process_crate ( & ty_cx ) ) ; time ( time_passes , " " , ( ) , | _ | middle :: check_const :: check_crate ( & ty_cx ) ) ; let maps = ( external_exports , last_private_map ) ; let ( exported_items , public_items ) = time ( time_passes , " " , maps , | ( a , b ) | middle :: privacy :: check_crate ( & ty_cx , & exp_map2 , a , b ) ) ; time ( time_passes , " " , ( ) , | _ | middle :: intrinsicck :: check_crate ( & ty_cx ) ) ; time ( time_passes , " " , ( ) , | _ | middle :: effect :: check_crate ( & ty_cx ) ) ; time ( time_passes , " " , ( ) , | _ | middle :: check_match :: check_crate ( & ty_cx ) ) ; time ( time_passes , " " , ( ) , | _ | middle :: liveness :: check_crate ( & ty_cx ) ) ; time ( time_passes , " " , ( ) , | _ | middle :: borrowck :: check_crate ( & ty_cx ) ) ; time ( time_passes , " " , ( ) , | _ | middle :: check_rvalues :: check_crate ( & ty_cx , krate ) ) ; // Avoid overwhelming user with errors if type checking failed. // I'm not sure how helpful this is, to be honest, but it avoids a // lot of annoying errors in the compile-fail tests (basically, // lint warnings and so on -- kindck used to do this abort, but // kindck is gone now). -nmatsakis ty_cx . sess . abort_if_errors ( ) ; let reachable_map = time ( time_passes , " " , ( ) , | _ | reachable :: find_reachable ( & ty_cx , & exported_items ) ) ; time ( time_passes , " " , ( ) , | _ | { middle :: dead :: check_crate ( & ty_cx , & exported_items , & reachable_map ) } ) ; time ( time_passes , " " , ( ) , | _ | lint :: check_crate ( & ty_cx , & exported_items ) ) ; ty :: CrateAnalysis { exp_map2 : exp_map2 , ty_cx : ty_cx , exported_items : exported_items , public_items : public_items , reachable : reachable_map , name : name , } }
Run the resolution, typechecking, region checking and other
miscellaneous analysis passes on the crate.
Run the resolution typechecking region checking and other miscellaneous analysis passes on the crate .
sess
Session
ast_map
ast_map::Map<'tcx>
type_arena
&'tcx TypedArena<ty::TyS<'tcx>>
name
String