Skip to content

Commit 6f9afd9

Browse files
author
berleon
committed
capitalized std::int::min_value, max_value Closes #10010
1 parent 0966ec0 commit 6f9afd9

37 files changed

+386
-386
lines changed

src/libextra/ebml.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ pub mod reader {
377377
fn read_u8 (&mut self) -> u8 { doc_as_u8 (self.next_doc(EsU8 )) }
378378
fn read_uint(&mut self) -> uint {
379379
let v = doc_as_u64(self.next_doc(EsUint));
380-
if v > (::std::uint::max_value as u64) {
380+
if v > (::std::uint::MAX_VALUE as u64) {
381381
fail!("uint {} too large for this architecture", v);
382382
}
383383
v as uint
@@ -397,7 +397,7 @@ pub mod reader {
397397
}
398398
fn read_int(&mut self) -> int {
399399
let v = doc_as_u64(self.next_doc(EsInt)) as i64;
400-
if v > (int::max_value as i64) || v < (int::min_value as i64) {
400+
if v > (int::MAX_VALUE as i64) || v < (int::MIN_VALUE as i64) {
401401
debug!("FIXME \\#6122: Removing this makes this function miscompile");
402402
fail!("int {} out of range for this architecture", v);
403403
}

src/libextra/getopts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ pub mod groups {
849849
t("hello", 15, [~"hello"]);
850850
t("\nMary had a little lamb\nLittle lamb\n", 15,
851851
[~"Mary had a", ~"little lamb", ~"Little lamb"]);
852-
t("\nMary had a little lamb\nLittle lamb\n", ::std::uint::max_value,
852+
t("\nMary had a little lamb\nLittle lamb\n", ::std::uint::MAX_VALUE,
853853
[~"Mary had a little lamb\nLittle lamb"]);
854854
}
855855
} // end groups module

src/libextra/num/bigint.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ impl ToPrimitive for BigInt {
11871187
if n < m {
11881188
Some(-(n as i64))
11891189
} else if n == m {
1190-
Some(i64::min_value)
1190+
Some(i64::MIN_VALUE)
11911191
} else {
11921192
None
11931193
}
@@ -1214,7 +1214,7 @@ impl FromPrimitive for BigInt {
12141214
Some(BigInt::from_biguint(Plus, n))
12151215
}
12161216
} else if n < 0 {
1217-
do FromPrimitive::from_u64(u64::max_value - (n as u64) + 1).and_then |n| {
1217+
do FromPrimitive::from_u64(u64::MAX_VALUE - (n as u64) + 1).and_then |n| {
12181218
Some(BigInt::from_biguint(Minus, n))
12191219
}
12201220
} else {
@@ -1624,7 +1624,7 @@ mod biguint_tests {
16241624

16251625
check(Zero::zero(), 0);
16261626
check(One::one(), 1);
1627-
check(i64::max_value.to_biguint().unwrap(), i64::max_value);
1627+
check(i64::MAX_VALUE.to_biguint().unwrap(), i64::MAX_VALUE);
16281628

16291629
check(BigUint::new(~[ ]), 0);
16301630
check(BigUint::new(~[ 1 ]), (1 << (0*BigDigit::bits)));
@@ -1634,9 +1634,9 @@ mod biguint_tests {
16341634
check(BigUint::new(~[ 0, 0, 1 ]), (1 << (2*BigDigit::bits)));
16351635
check(BigUint::new(~[-1, -1, -1 ]), (1 << (3*BigDigit::bits)) - 1);
16361636
check(BigUint::new(~[ 0, 0, 0, 1 ]), (1 << (3*BigDigit::bits)));
1637-
check(BigUint::new(~[-1, -1, -1, -1 >> 1]), i64::max_value);
1637+
check(BigUint::new(~[-1, -1, -1, -1 >> 1]), i64::MAX_VALUE);
16381638

1639-
assert_eq!(i64::min_value.to_biguint(), None);
1639+
assert_eq!(i64::MIN_VALUE.to_biguint(), None);
16401640
assert_eq!(BigUint::new(~[-1, -1, -1, -1 ]).to_i64(), None);
16411641
assert_eq!(BigUint::new(~[ 0, 0, 0, 0, 1]).to_i64(), None);
16421642
assert_eq!(BigUint::new(~[-1, -1, -1, -1, -1]).to_i64(), None);
@@ -1653,15 +1653,15 @@ mod biguint_tests {
16531653

16541654
check(Zero::zero(), 0);
16551655
check(One::one(), 1);
1656-
check(i64::max_value.to_biguint().unwrap(), i64::max_value);
1656+
check(i64::MAX_VALUE.to_biguint().unwrap(), i64::MAX_VALUE);
16571657

16581658
check(BigUint::new(~[ ]), 0);
16591659
check(BigUint::new(~[ 1 ]), (1 << (0*BigDigit::bits)));
16601660
check(BigUint::new(~[-1 ]), (1 << (1*BigDigit::bits)) - 1);
16611661
check(BigUint::new(~[ 0, 1 ]), (1 << (1*BigDigit::bits)));
1662-
check(BigUint::new(~[-1, -1 >> 1]), i64::max_value);
1662+
check(BigUint::new(~[-1, -1 >> 1]), i64::MAX_VALUE);
16631663

1664-
assert_eq!(i64::min_value.to_biguint(), None);
1664+
assert_eq!(i64::MIN_VALUE.to_biguint(), None);
16651665
assert_eq!(BigUint::new(~[-1, -1 ]).to_i64(), None);
16661666
assert_eq!(BigUint::new(~[ 0, 0, 1]).to_i64(), None);
16671667
assert_eq!(BigUint::new(~[-1, -1, -1]).to_i64(), None);
@@ -1678,8 +1678,8 @@ mod biguint_tests {
16781678

16791679
check(Zero::zero(), 0);
16801680
check(One::one(), 1);
1681-
check(u64::min_value.to_biguint().unwrap(), u64::min_value);
1682-
check(u64::max_value.to_biguint().unwrap(), u64::max_value);
1681+
check(u64::MIN_VALUE.to_biguint().unwrap(), u64::MIN_VALUE);
1682+
check(u64::MAX_VALUE.to_biguint().unwrap(), u64::MAX_VALUE);
16831683

16841684
check(BigUint::new(~[ ]), 0);
16851685
check(BigUint::new(~[ 1 ]), (1 << (0*BigDigit::bits)));
@@ -1689,7 +1689,7 @@ mod biguint_tests {
16891689
check(BigUint::new(~[ 0, 0, 1 ]), (1 << (2*BigDigit::bits)));
16901690
check(BigUint::new(~[-1, -1, -1 ]), (1 << (3*BigDigit::bits)) - 1);
16911691
check(BigUint::new(~[ 0, 0, 0, 1]), (1 << (3*BigDigit::bits)));
1692-
check(BigUint::new(~[-1, -1, -1, -1]), u64::max_value);
1692+
check(BigUint::new(~[-1, -1, -1, -1]), u64::MAX_VALUE);
16931693

16941694
assert_eq!(BigUint::new(~[ 0, 0, 0, 0, 1]).to_u64(), None);
16951695
assert_eq!(BigUint::new(~[-1, -1, -1, -1, -1]).to_u64(), None);
@@ -1706,14 +1706,14 @@ mod biguint_tests {
17061706

17071707
check(Zero::zero(), 0);
17081708
check(One::one(), 1);
1709-
check(u64::min_value.to_biguint().unwrap(), u64::min_value);
1710-
check(u64::max_value.to_biguint().unwrap(), u64::max_value);
1709+
check(u64::MIN_VALUE.to_biguint().unwrap(), u64::MIN_VALUE);
1710+
check(u64::MAX_VALUE.to_biguint().unwrap(), u64::MAX_VALUE);
17111711

17121712
check(BigUint::new(~[ ]), 0);
17131713
check(BigUint::new(~[ 1 ]), (1 << (0*BigDigit::bits)));
17141714
check(BigUint::new(~[-1 ]), (1 << (1*BigDigit::bits)) - 1);
17151715
check(BigUint::new(~[ 0, 1]), (1 << (1*BigDigit::bits)));
1716-
check(BigUint::new(~[-1, -1]), u64::max_value);
1716+
check(BigUint::new(~[-1, -1]), u64::MAX_VALUE);
17171717

17181718
assert_eq!(BigUint::new(~[ 0, 0, 1]).to_u64(), None);
17191719
assert_eq!(BigUint::new(~[-1, -1, -1]).to_u64(), None);
@@ -2164,11 +2164,11 @@ mod bigint_tests {
21642164

21652165
check(Zero::zero(), 0);
21662166
check(One::one(), 1);
2167-
check(i64::min_value.to_bigint().unwrap(), i64::min_value);
2168-
check(i64::max_value.to_bigint().unwrap(), i64::max_value);
2167+
check(i64::MIN_VALUE.to_bigint().unwrap(), i64::MIN_VALUE);
2168+
check(i64::MAX_VALUE.to_bigint().unwrap(), i64::MAX_VALUE);
21692169

21702170
assert_eq!(
2171-
(i64::max_value as u64 + 1).to_bigint().unwrap().to_i64(),
2171+
(i64::MAX_VALUE as u64 + 1).to_bigint().unwrap().to_i64(),
21722172
None);
21732173

21742174
assert_eq!(
@@ -2194,15 +2194,15 @@ mod bigint_tests {
21942194

21952195
check(Zero::zero(), 0);
21962196
check(One::one(), 1);
2197-
check(u64::min_value.to_bigint().unwrap(), u64::min_value);
2198-
check(u64::max_value.to_bigint().unwrap(), u64::max_value);
2197+
check(u64::MIN_VALUE.to_bigint().unwrap(), u64::MIN_VALUE);
2198+
check(u64::MAX_VALUE.to_bigint().unwrap(), u64::MAX_VALUE);
21992199

22002200
assert_eq!(
22012201
BigInt::from_biguint(Plus, BigUint::new(~[1, 2, 3, 4, 5])).to_u64(),
22022202
None);
22032203

2204-
let max_value: BigUint = FromPrimitive::from_u64(u64::max_value).unwrap();
2205-
assert_eq!(BigInt::from_biguint(Minus, max_value).to_u64(), None);
2204+
let MAX_VALUE: BigUint = FromPrimitive::from_u64(u64::MAX_VALUE).unwrap();
2205+
assert_eq!(BigInt::from_biguint(Minus, MAX_VALUE).to_u64(), None);
22062206
assert_eq!(BigInt::from_biguint(Minus, BigUint::new(~[1, 2, 3, 4, 5])).to_u64(), None);
22072207
}
22082208

src/librustc/driver/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ impl Session_ {
275275
pub fn reserve_node_ids(&self, count: uint) -> ast::NodeId {
276276
let v = *self.node_id;
277277
*self.node_id += count;
278-
if v > (int::max_value as uint) {
278+
if v > (int::MAX_VALUE as uint) {
279279
self.bug("Input too large, ran out of node ids!");
280280
}
281281
v as int

src/librustc/middle/borrowck/move_data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ impl Clone for MovePathIndex {
7878
}
7979

8080
static InvalidMovePathIndex: MovePathIndex =
81-
MovePathIndex(uint::max_value);
81+
MovePathIndex(uint::MAX_VALUE);
8282

8383
/// Index into `MoveData.moves`, used like a pointer
8484
#[deriving(Eq)]
8585
pub struct MoveIndex(uint);
8686

8787
static InvalidMoveIndex: MoveIndex =
88-
MoveIndex(uint::max_value);
88+
MoveIndex(uint::MAX_VALUE);
8989

9090
pub struct MovePath {
9191
/// Loan path corresponding to this move path

src/librustc/middle/dataflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
213213
len
214214
};
215215
if expanded {
216-
let entry = if self.oper.initial_value() { uint::max_value } else {0};
216+
let entry = if self.oper.initial_value() { uint::MAX_VALUE } else {0};
217217
do self.words_per_id.times {
218218
self.gens.push(0);
219219
self.kills.push(0);
@@ -905,7 +905,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
905905
}
906906

907907
fn reset(&mut self, bits: &mut [uint]) {
908-
let e = if self.dfcx.oper.initial_value() {uint::max_value} else {0};
908+
let e = if self.dfcx.oper.initial_value() {uint::MAX_VALUE} else {0};
909909
for b in bits.mut_iter() { *b = e; }
910910
}
911911

src/librustc/middle/graph.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ pub struct Edge<E> {
5656

5757
#[deriving(Eq)]
5858
pub struct NodeIndex(uint);
59-
pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::max_value);
59+
pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX_VALUE);
6060

6161
#[deriving(Eq)]
6262
pub struct EdgeIndex(uint);
63-
pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::max_value);
63+
pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX_VALUE);
6464

6565
// Use a private field here to guarantee no more instances are created:
6666
pub struct Direction { priv repr: uint }

src/librustc/middle/lint.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -537,21 +537,21 @@ fn check_type_limits(cx: &Context, e: &ast::Expr) {
537537
// warnings are consistent between 32- and 64-bit platforms
538538
fn int_ty_range(int_ty: ast::int_ty) -> (i64, i64) {
539539
match int_ty {
540-
ast::ty_i => (i64::min_value, i64::max_value),
541-
ast::ty_i8 => (i8::min_value as i64, i8::max_value as i64),
542-
ast::ty_i16 => (i16::min_value as i64, i16::max_value as i64),
543-
ast::ty_i32 => (i32::min_value as i64, i32::max_value as i64),
544-
ast::ty_i64 => (i64::min_value, i64::max_value)
540+
ast::ty_i => (i64::MIN_VALUE, i64::MAX_VALUE),
541+
ast::ty_i8 => (i8::MIN_VALUE as i64, i8::MAX_VALUE as i64),
542+
ast::ty_i16 => (i16::MIN_VALUE as i64, i16::MAX_VALUE as i64),
543+
ast::ty_i32 => (i32::MIN_VALUE as i64, i32::MAX_VALUE as i64),
544+
ast::ty_i64 => (i64::MIN_VALUE, i64::MAX_VALUE)
545545
}
546546
}
547547

548548
fn uint_ty_range(uint_ty: ast::uint_ty) -> (u64, u64) {
549549
match uint_ty {
550-
ast::ty_u => (u64::min_value, u64::max_value),
551-
ast::ty_u8 => (u8::min_value as u64, u8::max_value as u64),
552-
ast::ty_u16 => (u16::min_value as u64, u16::max_value as u64),
553-
ast::ty_u32 => (u32::min_value as u64, u32::max_value as u64),
554-
ast::ty_u64 => (u64::min_value, u64::max_value)
550+
ast::ty_u => (u64::MIN_VALUE, u64::MAX_VALUE),
551+
ast::ty_u8 => (u8::MIN_VALUE as u64, u8::MAX_VALUE as u64),
552+
ast::ty_u16 => (u16::MIN_VALUE as u64, u16::MAX_VALUE as u64),
553+
ast::ty_u32 => (u32::MIN_VALUE as u64, u32::MAX_VALUE as u64),
554+
ast::ty_u64 => (u64::MIN_VALUE, u64::MAX_VALUE)
555555
}
556556
}
557557

src/librustc/middle/liveness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ impl to_str::ToStr for Variable {
208208

209209
impl LiveNode {
210210
pub fn is_valid(&self) -> bool {
211-
**self != uint::max_value
211+
**self != uint::MAX_VALUE
212212
}
213213
}
214214

215-
fn invalid_node() -> LiveNode { LiveNode(uint::max_value) }
215+
fn invalid_node() -> LiveNode { LiveNode(uint::MAX_VALUE) }
216216

217217
struct CaptureInfo {
218218
ln: LiveNode,

src/librustc/middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4943,7 +4943,7 @@ impl Resolver {
49434943
j -= 1;
49444944
for (&k, _) in this.value_ribs[j].bindings.iter() {
49454945
maybes.push(interner_get(k));
4946-
values.push(uint::max_value);
4946+
values.push(uint::MAX_VALUE);
49474947
}
49484948
}
49494949

@@ -4957,7 +4957,7 @@ impl Resolver {
49574957
}
49584958

49594959
if values.len() > 0 &&
4960-
values[smallest] != uint::max_value &&
4960+
values[smallest] != uint::MAX_VALUE &&
49614961
values[smallest] < name.len() + 2 &&
49624962
values[smallest] <= max_distance &&
49634963
name != maybes[smallest] {

src/librustc/middle/trans/datum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ impl Datum {
753753
// either we were asked to deref a specific number of times,
754754
// in which case we should have, or we asked to deref as many
755755
// times as we can
756-
assert!(derefs == max || max == uint::max_value);
756+
assert!(derefs == max || max == uint::MAX_VALUE);
757757
DatumBlock { bcx: bcx, datum: datum }
758758
}
759759

src/librustc/middle/typeck/infer/region_inference/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ impl RegionVarBindings {
976976
// idea is to report errors that derive from independent
977977
// regions of the graph, but not those that derive from
978978
// overlapping locations.
979-
let mut dup_vec = vec::from_elem(self.num_vars(), uint::max_value);
979+
let mut dup_vec = vec::from_elem(self.num_vars(), uint::MAX_VALUE);
980980

981981
let mut opt_graph = None;
982982

@@ -1196,7 +1196,7 @@ impl RegionVarBindings {
11961196
let classification = var_data[node_idx.to_uint()].classification;
11971197

11981198
// check whether we've visited this node on some previous walk
1199-
if dup_vec[node_idx.to_uint()] == uint::max_value {
1199+
if dup_vec[node_idx.to_uint()] == uint::MAX_VALUE {
12001200
dup_vec[node_idx.to_uint()] = orig_node_idx.to_uint();
12011201
} else if dup_vec[node_idx.to_uint()] != orig_node_idx.to_uint() {
12021202
state.dup_found = true;

src/librustdoc/passes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ pub fn unindent(s: &str) -> ~str {
268268
let lines = s.any_line_iter().collect::<~[&str]>();
269269
let mut saw_first_line = false;
270270
let mut saw_second_line = false;
271-
let min_indent = do lines.iter().fold(uint::max_value) |min_indent, line| {
271+
let min_indent = do lines.iter().fold(uint::MAX_VALUE) |min_indent, line| {
272272

273273
// After we see the first non-whitespace line, look at
274274
// the line we have. If it is not whitespace, and therefore
@@ -280,7 +280,7 @@ pub fn unindent(s: &str) -> ~str {
280280
!line.is_whitespace();
281281

282282
let min_indent = if ignore_previous_indents {
283-
uint::max_value
283+
uint::MAX_VALUE
284284
} else {
285285
min_indent
286286
};

src/librustpkg/sha1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ mod tests {
600600
#[test]
601601
#[should_fail]
602602
fn test_add_bytes_to_bits_overflow() {
603-
add_bytes_to_bits::<u64>(Bounded::max_value(), 1);
603+
add_bytes_to_bits::<u64>(Bounded::MAX_VALUE(), 1);
604604
}
605605
}
606606

0 commit comments

Comments
 (0)