Skip to content

Commit f5f3179

Browse files
committed
---
yaml --- r: 59769 b: refs/heads/snap-stage3 c: aa179cb h: refs/heads/master i: 59767: 8179590 v: v3
1 parent 1d38e4f commit f5f3179

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 290a2ebab61282d89b211192679e84d22a01fd14
4+
refs/heads/snap-stage3: aa179cb0f1bfd56da67604b31ce3f72d0baff8b8
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/lint.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,11 @@ fn lint_type_limits(cx: @mut Context) -> visit::vt<()> {
551551
}
552552
}
553553

554+
// for int & uint, be conservative with the warnings, so that the
555+
// warnings are consistent between 32- and 64-bit platforms
554556
fn int_ty_range(int_ty: ast::int_ty) -> (i64, i64) {
555557
match int_ty {
556-
ast::ty_i => (int::min_value as i64, int::max_value as i64),
558+
ast::ty_i => (i64::min_value, i64::max_value),
557559
ast::ty_char => (u32::min_value as i64, u32::max_value as i64),
558560
ast::ty_i8 => (i8::min_value as i64, i8::max_value as i64),
559561
ast::ty_i16 => (i16::min_value as i64, i16::max_value as i64),
@@ -564,7 +566,7 @@ fn lint_type_limits(cx: @mut Context) -> visit::vt<()> {
564566

565567
fn uint_ty_range(uint_ty: ast::uint_ty) -> (u64, u64) {
566568
match uint_ty {
567-
ast::ty_u => (uint::min_value as u64, uint::max_value as u64),
569+
ast::ty_u => (u64::min_value, u64::max_value),
568570
ast::ty_u8 => (u8::min_value as u64, u8::max_value as u64),
569571
ast::ty_u16 => (u16::min_value as u64, u16::max_value as u64),
570572
ast::ty_u32 => (u32::min_value as u64, u32::max_value as u64),

branches/snap-stage3/src/libstd/ebml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ pub mod writer {
779779
priv impl Encoder {
780780
// used internally to emit things like the vector length and so on
781781
fn _emit_tagged_uint(&mut self, t: EbmlEncoderTag, v: uint) {
782-
assert!(v <= 0xFFFF_FFFF_u); // FIXME(#6130) assert warns on 32-bit
782+
assert!(v <= 0xFFFF_FFFF_u);
783783
self.wr_tagged_u32(t as uint, v as u32);
784784
}
785785

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[deny(type_limits)];
12+
13+
fn main() {
14+
let i: uint = 0;
15+
assert!(i <= 0xFFFF_FFFF_u);
16+
17+
let i: int = 0;
18+
assert!(i >= -0x8000_0000_i);
19+
assert!(i <= 0x7FFF_FFFF_i);
20+
}

0 commit comments

Comments
 (0)