Rename rustc::middle::unsafeck to fn_usage

I'm going to add further checks unrelated to unsafe.

Issue #1038
This commit is contained in:
Brian Anderson 2011-10-13 12:25:57 -07:00
parent 60cfa91897
commit 89466ffd74
3 changed files with 15 additions and 15 deletions

View File

@ -5,7 +5,7 @@
import syntax::parse::{parser, token};
import syntax::{ast, codemap};
import front::attr;
import middle::{trans, resolve, freevars, kind, ty, typeck, unsafeck};
import middle::{trans, resolve, freevars, kind, ty, typeck, fn_usage};
import middle::tstate::ck;
import syntax::print::{pp, pprust};
import util::{ppaux, common, filesearch};
@ -129,8 +129,8 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
bind freevars::annotate_freevars(def_map, crate));
let ty_cx = ty::mk_ctxt(sess, def_map, ext_map, ast_map, freevars);
time(time_passes, "typechecking", bind typeck::check_crate(ty_cx, crate));
time(time_passes, "unsafechecking",
bind unsafeck::unsafeck_crate(ty_cx, crate));
time(time_passes, "function usage",
bind fn_usage::check_crate_fn_usage(ty_cx, crate));
time(time_passes, "alt checking",
bind middle::check_alt::check_crate(ty_cx, crate));
if sess.get_opts().run_typestate {

View File

@ -3,22 +3,22 @@
import std::option::some;
import syntax::print::pprust::{expr_to_str, path_to_str};
export unsafeck_crate;
export check_crate_fn_usage;
type unsafe_ctx = {
type fn_usage_ctx = {
tcx: ty::ctxt,
unsafe_fn_legal: bool
};
fn unsafeck_view_item(_vi: @ast::view_item,
_ctx: unsafe_ctx,
_v: visit::vt<unsafe_ctx>) {
fn fn_usage_view_item(_vi: @ast::view_item,
_ctx: fn_usage_ctx,
_v: visit::vt<fn_usage_ctx>) {
// Ignore paths that appear in use, import, etc
}
fn unsafeck_expr(expr: @ast::expr,
ctx: unsafe_ctx,
v: visit::vt<unsafe_ctx>) {
fn fn_usage_expr(expr: @ast::expr,
ctx: fn_usage_ctx,
v: visit::vt<fn_usage_ctx>) {
alt expr.node {
ast::expr_path(path) {
if !ctx.unsafe_fn_legal {
@ -51,11 +51,11 @@ fn unsafeck_expr(expr: @ast::expr,
}
}
fn unsafeck_crate(tcx: ty::ctxt, crate: @ast::crate) {
fn check_crate_fn_usage(tcx: ty::ctxt, crate: @ast::crate) {
let visit =
visit::mk_vt(
@{visit_expr: unsafeck_expr,
visit_view_item: unsafeck_view_item
@{visit_expr: fn_usage_expr,
visit_view_item: fn_usage_view_item
with *visit::default_visitor()});
let ctx = {tcx: tcx, unsafe_fn_legal: false};
visit::visit_crate(*crate, ctx, visit);

View File

@ -25,7 +25,7 @@ mod middle {
mod ast_map;
mod resolve;
mod typeck;
mod unsafeck;
mod fn_usage;
mod check_alt;
mod mut;
mod alias;