Uppercase numeric constants
The following are renamed: * `min_value` => `MIN` * `max_value` => `MAX` * `bits` => `BITS` * `bytes` => `BYTES` Fixes #10010.
This commit is contained in:
parent
de57a22b9a
commit
988e4f0a1c
36 changed files with 444 additions and 444 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
// error-pattern:index out of bounds: the len is 3 but the index is
|
||||
|
||||
use std::uint::max_value;
|
||||
use std::uint;
|
||||
use std::mem::size_of;
|
||||
|
||||
fn main() {
|
||||
let xs = [1, 2, 3];
|
||||
xs[max_value / size_of::<int>() + 1];
|
||||
xs[uint::MAX / size_of::<int>() + 1];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
|
|
@ -21,7 +21,7 @@ fn main() {
|
|||
// length (in bytes), because the scaling of the index will cause it to
|
||||
// wrap around to a small number.
|
||||
|
||||
let idx = uint::max_value & !(uint::max_value >> 1u);
|
||||
let idx = uint::MAX & !(uint::MAX >> 1u);
|
||||
error!("ov2 idx = 0x%x", idx);
|
||||
|
||||
// This should fail.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
|
|
@ -23,7 +23,7 @@ fn main() {
|
|||
|
||||
// This test is only meaningful on 32-bit hosts.
|
||||
|
||||
let idx = u64::max_value & !(u64::max_value >> 1u);
|
||||
let idx = u64::MAX & !(u64::MAX >> 1u);
|
||||
error!("ov3 idx = 0x%8.8x%8.8x",
|
||||
(idx >> 32) as uint,
|
||||
idx as uint);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
|
|
@ -13,14 +13,14 @@ use std::int;
|
|||
|
||||
#[deriving(Eq, FromPrimitive)]
|
||||
enum A {
|
||||
Foo = int::max_value,
|
||||
Foo = int::MAX,
|
||||
Bar = 1,
|
||||
Baz = 3,
|
||||
Qux,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let x: Option<A> = FromPrimitive::from_int(int::max_value);
|
||||
let x: Option<A> = FromPrimitive::from_int(int::MAX);
|
||||
assert_eq!(x, Some(Foo));
|
||||
|
||||
let x: Option<A> = FromPrimitive::from_int(1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue