Assorted cleanups suggested by reviewers.

This commit is contained in:
Jed Davis 2013-09-25 09:41:10 -07:00
parent 01097cbab0
commit 727731f89e
7 changed files with 12 additions and 12 deletions

View File

@ -139,7 +139,8 @@ mod test {
use enum_set::*;
#[deriving(Eq)] #[repr(uint)]
#[deriving(Eq)]
#[repr(uint)]
enum Foo {
A, B, C
}

View File

@ -111,7 +111,8 @@ pub static tag_items_data_item_reexport_def_id: uint = 0x4e;
pub static tag_items_data_item_reexport_name: uint = 0x4f;
// used to encode crate_ctxt side tables
#[deriving(Eq)] #[repr(uint)]
#[deriving(Eq)]
#[repr(uint)]
pub enum astencode_tag { // Reserves 0x50 -- 0x6f
tag_ast = 0x50,

View File

@ -359,7 +359,7 @@ fn bounds_usable(cx: &mut CrateContext, ity: IntType, bounds: &IntBounds) -> boo
}
}
fn ty_of_inttype(ity: IntType) -> ty::t {
pub fn ty_of_inttype(ity: IntType) -> ty::t {
match ity {
attr::SignedInt(t) => ty::mk_mach_int(t),
attr::UnsignedInt(t) => ty::mk_mach_uint(t)

View File

@ -109,7 +109,6 @@ use std::libc::{c_uint, c_ulonglong, c_longlong};
use std::ptr;
use std::unstable::atomics;
use std::vec;
use syntax::attr;
use syntax::codemap::{Span, Pos};
use syntax::{ast, codemap, ast_util, ast_map, opt_vec};
use syntax::parse::token;
@ -1422,10 +1421,8 @@ fn prepare_enum_metadata(cx: &mut CrateContext,
let discriminant_type_metadata = |inttype| {
let discriminant_llvm_type = adt::ll_inttype(cx, inttype);
let (discriminant_size, discriminant_align) = size_and_align_of(cx, discriminant_llvm_type);
let discriminant_base_type_metadata = type_metadata(cx, match inttype {
attr::SignedInt(t) => ty::mk_mach_int(t),
attr::UnsignedInt(t) => ty::mk_mach_uint(t)
}, codemap::dummy_sp());
let discriminant_base_type_metadata = type_metadata(cx, adt::ty_of_inttype(inttype),
codemap::dummy_sp());
do enum_name.with_c_str |enum_name| {
unsafe {
llvm::LLVMDIBuilderCreateEnumerationType(

View File

@ -715,7 +715,8 @@ pub struct ParamBounds {
pub type BuiltinBounds = EnumSet<BuiltinBound>;
#[deriving(Clone, Eq, IterBytes, ToStr)] #[repr(uint)]
#[deriving(Clone, Eq, IterBytes, ToStr)]
#[repr(uint)]
pub enum BuiltinBound {
BoundStatic,
BoundSend,

View File

@ -385,8 +385,7 @@ pub fn find_repr_attr(diagnostic: @mut span_handler, attr: @ast::MetaItem, acc:
for item in items.iter() {
match item.node {
ast::MetaWord(word) => {
let word: &str = word;
let hint = match word {
let hint = match word.as_slice() {
// Can't use "extern" because it's not a lexical identifier.
"C" => ReprExtern,
_ => match int_type_of_word(word) {

View File

@ -26,7 +26,8 @@ pub mod pipes {
payload: Option<T>
}
#[deriving(Eq)] #[repr(int)]
#[deriving(Eq)]
#[repr(int)]
pub enum state {
empty,
full,