Mark some fns as pure so type_is_unique_box doesn't need to be unchecked

This commit is contained in:
Jesse Ruderman 2011-09-24 15:36:09 -07:00
parent 48c2c9b3a7
commit 064f52fa96
3 changed files with 10 additions and 12 deletions

View File

@ -20,9 +20,7 @@ export trans_uniq, make_free_glue, type_is_unique_box, copy_val,
autoderef, duplicate;
pure fn type_is_unique_box(bcx: @block_ctxt, ty: ty::t) -> bool {
unchecked {
ty::type_is_unique_box(bcx_tcx(bcx), ty)
}
ty::type_is_unique_box(bcx_tcx(bcx), ty)
}
fn trans_uniq(cx: @block_ctxt, contents: @ast::expr,

View File

@ -592,7 +592,7 @@ fn mk_iter_body_fn(cx: ctxt, output: t) -> t {
}
// Returns the one-level-deep type structure of the given type.
fn struct(cx: ctxt, typ: t) -> sty { ret interner::get(*cx.ts, typ).struct; }
pure fn struct(cx: ctxt, typ: t) -> sty { interner::get(*cx.ts, typ).struct }
// Returns the canonical name of the given type.
@ -862,28 +862,28 @@ fn get_element_type(cx: ctxt, ty: t, i: uint) -> t {
// tag.
}
fn type_is_box(cx: ctxt, ty: t) -> bool {
pure fn type_is_box(cx: ctxt, ty: t) -> bool {
alt struct(cx, ty) {
ty_box(_) { ret true; }
_ { ret false; }
}
}
fn type_is_boxed(cx: ctxt, ty: t) -> bool {
pure fn type_is_boxed(cx: ctxt, ty: t) -> bool {
alt struct(cx, ty) {
ty_box(_) { ret true; }
_ { ret false; }
}
}
fn type_is_unique_box(cx: ctxt, ty: t) -> bool {
pure fn type_is_unique_box(cx: ctxt, ty: t) -> bool {
alt struct(cx, ty) {
ty_uniq(_) { ret true; }
_ { ret false; }
}
}
fn type_is_vec(cx: ctxt, ty: t) -> bool {
pure fn type_is_vec(cx: ctxt, ty: t) -> bool {
ret alt struct(cx, ty) {
ty_vec(_) { true }
ty_str. { true }
@ -891,7 +891,7 @@ fn type_is_vec(cx: ctxt, ty: t) -> bool {
};
}
fn type_is_unique(cx: ctxt, ty: t) -> bool {
pure fn type_is_unique(cx: ctxt, ty: t) -> bool {
alt struct(cx, ty) {
ty_uniq(_) { ret true; }
ty_vec(_) { true }
@ -900,7 +900,7 @@ fn type_is_unique(cx: ctxt, ty: t) -> bool {
}
}
fn type_is_scalar(cx: ctxt, ty: t) -> bool {
pure fn type_is_scalar(cx: ctxt, ty: t) -> bool {
alt struct(cx, ty) {
ty_nil. { ret true; }
ty_bool. { ret true; }

View File

@ -28,7 +28,7 @@ fn intern<@T>(itr: interner<T>, val: T) -> uint {
}
}
fn get<@T>(itr: interner<T>, idx: uint) -> T { ret itr.vect[idx]; }
pure fn get<@T>(itr: interner<T>, idx: uint) -> T { ret itr.vect[idx]; }
fn len<T>(itr: interner<T>) -> uint { ret vec::len(itr.vect); }
pure fn len<T>(itr: interner<T>) -> uint { ret vec::len(itr.vect); }