Skip to content

Commit

Permalink
Rename rustc::middle::unsafeck to fn_usage
Browse files Browse the repository at this point in the history
I'm going to add further checks unrelated to unsafe.

Issue #1038
  • Loading branch information
brson committed Oct 13, 2011
1 parent 60cfa91 commit 89466ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/comp/driver/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import metadata::{creader, cstore};
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};
Expand Down Expand Up @@ -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 {
Expand Down
22 changes: 11 additions & 11 deletions src/comp/middle/unsafeck.rs → src/comp/middle/fn_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import syntax::visit;
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 {
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/comp/rustc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 89466ff

Please sign in to comment.