about summary refs log tree commit diff
path: root/src/libsyntax/diagnostic.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-21 09:13:51 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-21 09:13:51 -0800
commit0c981875e46763a9b3cd53443bf73dfd3e291d18 (patch)
treeb0d1f49551beab62865f5945d588a8a65931c9f5 /src/libsyntax/diagnostic.rs
parent5da25386b3e70a5a538f75fbd5b42a8db04dd93d (diff)
parent3c32cd1be27f321658382e39d34f5d993d99ae8b (diff)
downloadrust-0c981875e46763a9b3cd53443bf73dfd3e291d18.tar.gz
rust-0c981875e46763a9b3cd53443bf73dfd3e291d18.zip
rollup merge of #21340: pshc/libsyntax-no-more-ints
Collaboration with @rylev!

I didn't change `int` in the [quasi-quoter](https://github.com/pshc/rust/blob/99ae1a30f3ca28c0f7e431620560d30e44627124/src/libsyntax/ext/quote.rs#L328), because I'm not sure if there will be adverse effects.

Addresses #21095.
Diffstat (limited to 'src/libsyntax/diagnostic.rs')
-rw-r--r--src/libsyntax/diagnostic.rs40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index b26ec64c24b..c17ad058ada 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -26,7 +26,7 @@ use term::WriterWrapper;
 use term;
 
 /// maximum number of lines we will print for each error; arbitrary.
-static MAX_LINES: uint = 6u;
+static MAX_LINES: usize = 6us;
 
 #[derive(Clone, Copy)]
 pub enum RenderSpan {
@@ -141,7 +141,7 @@ impl SpanHandler {
 /// (fatal, bug, unimpl) may cause immediate exit,
 /// others log errors for later reporting.
 pub struct Handler {
-    err_count: Cell<uint>,
+    err_count: Cell<usize>,
     emit: RefCell<Box<Emitter + Send>>,
 }
 
@@ -155,20 +155,20 @@ impl Handler {
         self.bump_err_count();
     }
     pub fn bump_err_count(&self) {
-        self.err_count.set(self.err_count.get() + 1u);
+        self.err_count.set(self.err_count.get() + 1us);
     }
-    pub fn err_count(&self) -> uint {
+    pub fn err_count(&self) -> usize {
         self.err_count.get()
     }
     pub fn has_errors(&self) -> bool {
-        self.err_count.get()> 0u
+        self.err_count.get() > 0us
     }
     pub fn abort_if_errors(&self) {
         let s;
         match self.err_count.get() {
-          0u => return,
-          1u => s = "aborting due to previous error".to_string(),
-          _  => {
+          0us => return,
+          1us => s = "aborting due to previous error".to_string(),
+          _   => {
             s = format!("aborting due to {} previous errors",
                         self.err_count.get());
           }
@@ -452,7 +452,7 @@ fn highlight_lines(err: &mut EmitterWriter,
     let mut elided = false;
     let mut display_lines = &lines.lines[];
     if display_lines.len() > MAX_LINES {
-        display_lines = &display_lines[0u..MAX_LINES];
+        display_lines = &display_lines[0us..MAX_LINES];
         elided = true;
     }
     // Print the offending lines
@@ -463,32 +463,32 @@ fn highlight_lines(err: &mut EmitterWriter,
         }
     }
     if elided {
-        let last_line = display_lines[display_lines.len() - 1u];
-        let s = format!("{}:{} ", fm.name, last_line + 1u);
+        let last_line = display_lines[display_lines.len() - 1us];
+        let s = format!("{}:{} ", fm.name, last_line + 1us);
         try!(write!(&mut err.dst, "{0:1$}...\n", "", s.len()));
     }
 
     // FIXME (#3260)
     // If there's one line at fault we can easily point to the problem
-    if lines.lines.len() == 1u {
+    if lines.lines.len() == 1us {
         let lo = cm.lookup_char_pos(sp.lo);
-        let mut digits = 0u;
-        let mut num = (lines.lines[0] + 1u) / 10u;
+        let mut digits = 0us;
+        let mut num = (lines.lines[0] + 1us) / 10us;
 
         // how many digits must be indent past?
-        while num > 0u { num /= 10u; digits += 1u; }
+        while num > 0us { num /= 10us; digits += 1us; }
 
         // indent past |name:## | and the 0-offset column location
-        let left = fm.name.len() + digits + lo.col.to_uint() + 3u;
+        let left = fm.name.len() + digits + lo.col.to_usize() + 3us;
         let mut s = String::new();
         // Skip is the number of characters we need to skip because they are
         // part of the 'filename:line ' part of the previous line.
-        let skip = fm.name.len() + digits + 3u;
+        let skip = fm.name.len() + digits + 3us;
         for _ in range(0, skip) {
             s.push(' ');
         }
         if let Some(orig) = fm.get_line(lines.lines[0]) {
-            for pos in range(0u, left - skip) {
+            for pos in range(0us, left - skip) {
                 let cur_char = orig.as_bytes()[pos] as char;
                 // Whenever a tab occurs on the previous line, we insert one on
                 // the error-point-squiggly-line as well (instead of a space).
@@ -506,7 +506,7 @@ fn highlight_lines(err: &mut EmitterWriter,
         let hi = cm.lookup_char_pos(sp.hi);
         if hi.col != lo.col {
             // the ^ already takes up one space
-            let num_squigglies = hi.col.to_uint() - lo.col.to_uint() - 1u;
+            let num_squigglies = hi.col.to_usize() - lo.col.to_usize() - 1us;
             for _ in range(0, num_squigglies) {
                 s.push('~');
             }
@@ -555,7 +555,7 @@ fn custom_highlight_lines(w: &mut EmitterWriter,
     let last_line_start = format!("{}:{} ", fm.name, lines[lines.len()-1]+1);
     let hi = cm.lookup_char_pos(sp.hi);
     // Span seems to use half-opened interval, so subtract 1
-    let skip = last_line_start.len() + hi.col.to_uint() - 1;
+    let skip = last_line_start.len() + hi.col.to_usize() - 1;
     let mut s = String::new();
     for _ in range(0, skip) {
         s.push(' ');