syntex_syntax 0.9.0

Export of libsyntax for code generation
b0VIM 7.4��U�]~ericktErick-Tryzelaar-MBP.local~erickt/projects/rust/rust-syntex/syntex_syntax/src/diagnostic.rsutf-8
3210#"! Utp	d
Z|a�;H[�]
[j
V�SA�U�U�ad����]Z��R.-�
�
�
�
{
j
i
I
-


������i'����]�
�
�
m
l
(
�	�	c	E	D	��������pQ8�����������S����^�����W/)'&�����^&����\VTS/�����n_F,}    pub cm: codemap::CodeMap,    pub handler: Handler,pub struct SpanHandler {/// reporting./// accepts span information for source-location/// A span-handler is like a handler but also}    }        "The parser has encountered an internal bug"    fn description(&self) -> &str {impl error::Error for ExplicitBug {}    }        write!(f, "parser internal bug")    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {impl fmt::Display for ExplicitBug {pub struct ExplicitBug;#[derive(Copy, Clone, Debug)]/// or `.span_bug` rather than a failed assertion, etc./// Signifies that the compiler died with an explicit call to `.bug`}    }        "The parser has encountered a fatal error"    fn description(&self) -> &str {impl error::Error for FatalError {}    }        write!(f, "parser fatal error")    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {impl fmt::Display for FatalError {pub struct FatalError;#[must_use]#[derive(Copy, Clone, Debug)]/// not be true.)/// used as the argument to panic at the moment, but that will eventually/// Used as a return value to signify a fatal error occurred. (It is also}                   sp: RenderSpan, msg: &str, lvl: Level);    fn custom_emit(&mut self, cm: &codemap::CodeMap,            msg: &str, code: Option<&str>, lvl: Level);    fn emit(&mut self, cmsp: Option<(&codemap::CodeMap, Span)>,pub trait Emitter {}    Never    Always,    Auto,pub enum ColorConfig {#[derive(Clone, Copy)]}    }        }                s            FileLine(s) =>            EndSpan(s) |            Suggestion(s, _) |            FullSpan(s) |        match *self {    fn span(&self) -> Span {impl RenderSpan {}    FileLine(Span),    /// by file:linenum.    /// A FileLine renders with just a line for the message prefixed    Suggestion(Span, String),    /// into the lines in place of the code covered by the span.    /// of hypothetical source code, where the `String` is spliced    /// message, prefixed by file:linenum, followed by a summary    /// A suggestion renders with both with an initial line for the    EndSpan(Span),    /// of the span).    /// (since `end_highlight_lines` displays an arrow to the end    /// compiletest/runtest to look at the last line of the span    /// the span, instead of the start. Used, at least, for telling    /// Similar to a FullSpan, but the cited position is the end of    FullSpan(Span),    /// the source code covered by the span.    /// message, prefixed by file:linenum, followed by a summary of    /// A FullSpan renders with both with an initial line for thepub enum RenderSpan {#[derive(Clone)]const MAX_LINES: usize = 6;/// maximum number of lines we will print for euse term::{self, WriterWrapper};use term;use std::io;use std::io::prelude::*;use std::{cmp, error, fmt};use std::cell::{RefCell, Cell};use diagnostics;use codemap::{self, COMMAND_LINE_SP, COMMAND_LINE_EXPN, Pos, Span};use self::Destination::*;pub use self::ColorConfig::*;pub use self::RenderSpan::*;pub use self::Level::*;// except according to those terms.// option. This file may not be copied, modified, or distributed// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or//// http://rust-lang.org/COPYRIGHT.// file at the top-level directory of this distribution and at// Copyright 2012 The Rust Project Developers. See the COPYRIGHTad��A����rF@>=0%����ts
�
�
�
R


���:���������|i\K@�
�
�
�
b
?

�	�	�	l	M	"		��_#��������wqTF��i3��wC0��}    }                         dummy.txt:12         tolv\n}    }           }    }                         dummy.txt:12       }    }                         dummy.txt:12         tolv\n");         }    }                         dummy.txt:12       }    }                         dummy.txt:12         tolv\n");}    }                         dummy.txt:12         }    }                         dummy.txt:12 }    }                         dummy.txt:12         tolv}    }                         dummy.txt:12         tolv\n");              }    }                         dummy.}    }      }    }                     }    }    } }    }                         dummy.txt:12         tolv\n");           }}}    }}    }     }    }                         dummy.txt:12         tolv\n");                         dummy.txt:11         e-lä-vän\n\                         dummy.txt:10         line10\n\                         dummy.txt: 9         line9\n\        assert_eq!(str, "dummy.txt: 8         line8\n\        println!("{}", str);        let str = from_utf8(vec).unwrap();        let vec: &[u8] = &vec;        let vec = data.lock().unwrap().clone();        println!("done");        ew.highlight_lines(&cm, sp, lvl, lines).unwrap();        println!("highlight_lines");        let lines = cm.span_to_lines(sp);        println!("span_to_lines");        let lvl = Level::Error;        let sp = mk_sp(start, end);        let end = file.lines.borrow()[11];        let start = file.lines.borrow()[7];        let file = cm.new_filemap_and_lines("dummy.txt", content);        ";        dreizehn        tolv        e-lä-vän        line10        line9        line8        line7        line6        cinq        line4        line3        koksi        let content = "abcdefg        let cm = CodeMap::new();        let mut ew = EmitterWriter::new(Box::new(Sink(data.clone())), None);        let data = Arc::new(Mutex::new(Vec::new()));        }            fn flush(&mut self) -> io::Result<()> { Ok(()) }            }                Write::write(&mut *self.0.lock().unwrap(), data)            fn write(&mut self, data: &[u8]) -> io::Result<usize> {        impl Write for Sink {        struct Sink(Arc<Mutex<Vec<u8>>>);    fn test_hilight_suggestion_issue_11715() {    #[test]    // Diagnostic doesn't align properly in span where line number increases by one digit    use std::str::from_utf8;    use std::io::{self, Write};    use std::sync::{Arc, Mutex};    use codemap::{mk_sp, CodeMap, BytePos};    use super::{EmitterWriter, Level};mod test {#[cfg(test)]}    }        None => diag.handler().bug(&msg()),        Some(t) => t,    match opt {{    M: FnOnce() -> String,pub fn expect<T, M>(diag: &SpanHandler, opt: Option<T>, msg: M) -> T wheread��a���{E?������tO8�
�
�
w
k
a
E
?

���vpL
����Y$�
�
�
U


�	�	�	e	=	����A������wlaTJ@>=����rE��������v:������I��`���p3��            /            // sharing the terminal with any             // sharing the termin            // sharing the terminal with any other programs (            // sha            // sharing the termin            // sharing the termin            // sharing the terminal with any other programs (e.g. other rustc            // sharing the terminal with any other programs (e.g. other rustc             // sharing the terminal with any other programs (e.g. other rustc            // sharing the terminal with any other programs (e.g. other rust            // sharing the terminal with any other programs (e.g. other rustc             // sharing the terminal with any other programs (e.g. other rustc}    }        }            Help => term::color::BRIGHT_CYAN,            Note => term::color::BRIGHT_GREEN,            Warning => term::color::BRIGHT_YELLOW,            Bug | Fatal | Error => term::color::BRIGHT_RED,        match self {    fn color(self) -> term::color::Color {impl Level {}    }        }            Help => "help".fmt(f),            Note => "note".fmt(f),            Warning => "warning".fmt(f),            Fatal | Error => "error".fmt(f),            Bug => "error: internal compiler error".fmt(f),        match *self {        use std::fmt::Display;    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {impl fmt::Display for Level {}    Help,    Note,    Warning,    Error,    Fatal,    Bug,pub enum Level {#[derive(Copy, PartialEq, Clone, Debug)]}    }        self.emit.borrow_mut().custom_emit(cm, sp, msg, lvl);        if lvl == Warning && !self.can_emit_warnings { return }                       sp: RenderSpan, msg: &str, lvl: Level) {    pub fn custom_emit(&self, cm: &codemap::CodeMap,    }        self.emit.borrow_mut().emit(cmsp, msg, Some(code), lvl);        if lvl == Warning && !self.can_emit_warnings { return }                          lvl: Level) {                          code: &str,                          msg: &str,                          cmsp: Option<(&codemap::CodeMap, Span)>,    pub fn emit_with_code(&self,    }        self.emit.borrow_mut().emit(cmsp, msg, None, lvl);        if lvl == Warning && !self.can_emit_warnings { return }                lvl: Level) {                msg: &str,                cmsp: Option<(&codemap::CodeMap, Span)>,    pub fn emit(&self,    }        self.bug(&format!("unimplemented {}", msg));    pub fn unimpl(&self, msg: &str) -> ! {    }        panic!(ExplicitBug);        self.emit.borrow_mut().emit(None, msg, None, Bug);    pub fn bug(&self, msg: &str) -> ! {    }        self.emit.borrow_mut().emit(None, msg, None, Help);    pub fn help(&self, msg: &str) {    }        self.emit.borrow_mut().emit(None, msg, None, Note);    pub fn note(&self, msg: &str) {    }        self.emit.borrow_mut().emit(None, msg, None, Warning);    pub fn warn(&self, msg: &str) {    }        self.fatal(&s[..]);        }          }                        self.err_count.get());            s = format!("aborting due to {} previous errors",          _   => {          1 => s = "aborting due to previous error".to_string(),          0 => return,        match self.err_count.get() {        let s;    pub fn abort_if_errors(&self) {    }        self.err_count.get() > 0    pub fn has_errors(&self) -> bool {    }        self.err_count.get()    pub fn err_count(&self) -> usize {    }        self.err_count.set(self.err_count.get() + 1);    pub fn bump_err_count(&self) {    }        self.bump_err_count();        self.emit.borrow_mut().emit(None, msg, None, Error);ad^f;������Z><;���Q�
�
�
�
\
V
T
S
>

���hL/�����^O�
�
�
�
~
)
�	�	�	�	�	d			��f']R,&	�dL;:
��p1	��u/.,&�����p[1���5��N?�                                     // If `msg` ends in a newl                               // If `msg` ends in a newline, we need to reset the color be                // If `msg` ends in a newline, we need to reset the color be                // If `msg` ends in a newline, we need to reset the color befor                // If `msg` ends in a newline, we need to reset the color bef                // If `msg` ends in a n                // If `msg` ends in a                // If `msg` ends in a newline, we need to reset th                // If `msg` ends                 // If `msg` ends in a newl                // If                // If `msg` ends in a newline, we n                // If `msg` ends                               //                           // If `msg` ends in a newline, we need                          // If `msg` ends in a newline, we need to reset the co                // If `msg` ends in a newline, we need to reset the col                // If `msg`                // If `msg` ends in a newline, we                        // If `msg` ends                 // If `msg` ends in a newline, we need to reset                // If `msg` ends in a newline, we need to reset the colo                // If `msg` ends                 // If `msg` ends in a newline, we                // If `msg` ends in a newline, w                 /                // If `m                // If `msg` ends in a newline, we need to reset the color before                 // If `msg` ends in a newline, we need to reset the color before                            //                  // If `msg` ends in a newline, we need to                      // If `msg` ends in a newline, we need to reset the color before                try!(t.attr(color));            Terminal(ref mut t) => {        match self.dst {                          print_newline_at_end: bool) -> io::Result<()> {                          color: term::Attr,                          args: fmt::Arguments,    fn print_maybe_styled(&mut self,    }        EmitterWriter { dst: Raw(dst), registry: registry }               registry: Option<diagnostics::registry::Registry>) -> EmitterWriter {    pub fn new(dst: Box<Write + Send>,    }        }            EmitterWriter { dst: Raw(Box::new(stderr)), registry: registry }        } else {            EmitterWriter { dst: dst, registry: registry }            };                None    => Raw(Box::new(stderr)),                Some(t) => Terminal(t),            let dst = match term::stderr() {        if use_color {        };            Auto   => stderr_isatty(),            Never  => false,            Always => true,        let use_color = match color_config {        let stderr = io::stderr();                  registry: Option<diagnostics::registry::Registry>) -> EmitterWriter {    pub fn stderr(color_config: ColorConfig,impl EmitterWriter {}    }        $writer.print_maybe_styled(format_args!($($arg)*), $style, true)    ($writer: expr, $style: expr, $($arg: tt)*) => {macro_rules! println_maybe_styled {}    }        $writer.print_maybe_styled(format_args!($($arg)*), $style, false)    ($writer: expr, $style: expr, $($arg: tt)*) => {macro_rules! print_maybe_styled {/// `EmitterWriter::print_maybe_styled` for details./// Do not use this for messages that end in `\n` – use `println_maybe_styled` instead. See}    Raw(Box<Write + Send>),    Terminal(Box<term::StderrTerminal>),enum Destination {}    registry: Option<diagnostics::registry::Registry>    dst: Destination,pub struct EmitterWriter {ad1�[�[�f8%�
�
2
���lB����~T-�
�
�
�
�
�
�
A
"
�	�	�	�	S	
		���6(�����:��\,��|ZON���UG+���a����xnmX>���                    Some(_) => {                match self.registry.as_ref().and_then(|registry| registry.find_description(code)) {            Some(code) =>        match code {        }            }                // no source text in this case!            FileLine(..) => {            }                try!(self.print_macro_backtrace(cm, sp));                try!(self.highlight_suggestion(cm, sp, suggestion));            Suggestion(_, ref suggestion) => {            }                try!(self.print_macro_backtrace(cm, sp));                try!(self.end_highlight_lines(cm, sp, lvl, cm.span_to_lines(sp)));            EndSpan(_) => {            }                try!(self.print_macro_backtrace(cm, sp));                try!(self.highlight_lines(cm, sp, lvl, cm.span_to_lines(sp)));            FullSpan(_) => {        match rsp {        try!(self.print_diagnostic(&ss[..], lvl, msg, code));        };            cm.span_to_string(sp)        } else {            cm.span_to_string(span_end)            let span_end = Span { lo: sp.hi, hi: sp.hi, expn_id: sp.expn_id};        } else if let EndSpan(_) = rsp {            "<command line option>".to_string()        let ss = if sp.expn_id == COMMAND_LINE_EXPN {        // since PartialEq is manually implemented to ignore the ExpnId        // We cannot check equality directly with COMMAND_LINE_SP        let sp = rsp.span();             msg: &str, code: Option<&str>, lvl: Level) -> io::Result<()> {    fn emit_(&mut self, cm: &codemap::CodeMap, rsp: RenderSpan,    }        Ok(())        try!(write!(&mut self.dst, "\n"));        }            None => ()            }                try!(print_maybe_styled!(self, style, " [{}]", code.clone()));                let style = term::Attr::ForegroundColor(term::color::BRIGHT_MAGENTA);            Some(code) => {        match code {        try!(print_maybe_styled!(self, term::Attr::Bold, "{}", msg));                                 "{}: ", lvl.to_string()));        try!(print_maybe_styled!(self, term::Attr::ForegroundColor(lvl.color()),        }            try!(write!(&mut self.dst, "{} ", topic));        if !topic.is_empty() {                        msg: &str, code: Option<&str>) -> io::Result<()> {    fn print_diagnostic(&mut self, topic: &str, lvl: Level,    }        }            }                }                    Ok(())                } else {                    w.write_all(b"\n")                if print_newline_at_end {                try!(w.write_fmt(args));            Raw(ref mut w) => {            }                }                    Ok(())                } else {                    t.write_all(b"\n")                if print_newline_at_end {                try!(t.reset());                try!(t.write_fmt(args));                // have to worry about it.                // to be miscolored. We assume this is rare enough that we don't                // once, which still leaves the opportunity for interleaved output                // result in the `LineBufferedWriter` flushing twice instead of                // Note that if `msg` contains any internal newlines, this will                //                // instances via `make -jN`).                // sharing the terminal with any other programs (e.g. other rustc                // another line or exit. Buffering the reset is a problem if we're                // after the newline ends up buffering the reset until we print                // to a `LineBufferedWriter`, which means that emitting the reset                // the newline. We're making the assumption that we end up writingad	�g�u]���b,"�
�
�
�
�
�
E
(
��9'�������uS)�
�
�
�
�
]

�	�	�	�	V		����]:9���wA&�i3�����H�������dG(�����&������[<;���        Some(line_strings) => line_strings        None => { return Ok(()); }    let line_strings = match line_strings {                   .collect();                   .map(|info| fm.get_line(info.line_index))        lines.lines.iter()    let line_strings: Option<Vec<&str>> =    let fm = &*lines.file;    };        }            return Ok(());            try!(write!(&mut err.dst, "(internal compiler error: unprintable span)\n"));        Err(_) => {        Ok(lines) => lines,    let lines = match lines {{                   -> io::Result<()>                   lines: codemap::FileLinesResult)                   lvl: Level,                   sp: Span,                   cm: &codemap::CodeMap,fn highlight_lines(err: &mut EmitterWriter,}    Ok(())    }                    "", fm.name.len(), elided_line_num.len()));        try!(write!(&mut err.dst, "{0:1$} {0:2$} ...\n",        let elided_line_num = format!("{}", first_line.line_index + MAX_LINES + 1);    if lines.next().is_some() {    // if we elided some lines, add an ellipsis    }                    fm.name, "", elided_line_num.len(), line));        try!(write!(&mut err.dst, "{0}:{1:2$} {3}\n",        let elided_line_num = format!("{}", line_index+1);    for (line, line_index) in lines.by_ref().take(MAX_LINES).zip(first_line.line_index..) {    let mut lines = complete.lines();    let fm = &*lines.file;    // snippets from the actual error being reported.    // space for them. This helps with lining up with previous    // print the suggestion without any line numbers, but leave    let complete = format!("{}{}{}", prefix, suggestion, suffix);                   .unwrap_or("");                   .map(|l| &l[last_line.end_col.0..])    let suffix = fm.get_line(last_line.line_index)    let last_line = lines.lines.last().unwrap();                   .unwrap_or("");                   .map(|l| &l[..first_line.start_col.0])    let prefix = fm.get_line(first_line.line_index)    let first_line = &lines.lines[0];    let fm = &lines.file;    // then append the snippet from the last line that trails the span.    // line that precedes the span, prepend that with the suggestion, and    // To build up the result, we want to take the snippet from the first    assert!(!lines.lines.is_empty());    let lines = cm.span_to_lines(sp).unwrap();{                        -> io::Result<()>                        suggestion: &str)                        sp: Span,                        cm: &codemap::CodeMap,fn highlight_suggestion(err: &mut EmitterWriter,}    Ok(())    }        None => (),            },                None => ()                }                                                   explanation", code), None));                                          &format!("run `rustc --explain {}` to see a detailed \                    try!(print_diagnostic(dst, &ss[..], Help,                Some(_) => {            match dst.registry.as_ref().and_then(|registry| registry.find_description(code)) {        Some(code) =>    match code {    }        }            // no source text in this case!        FileLine(..) => {        }            try!(print_macro_backtrace(dst, cm, sp));            try!(highlight_suggestion(dst, cm, sp, suggestion));        Suggestion(_, ref suggestion) => {        }            try!(print_macro_backtrace(dst, cm, sp));            try!(end_highlight_lines(dst, cm, sp, lvl, cm.span_to_lines(sp)));        EndSpan(_) => {        }            try!(print_macro_backtrace(dst, cm, sp));            try!(highlight_lines(dst, cm, sp, lvl, cm.span_to_lines(sp)));ad
�b����j.����$�
�
�
�
�
�
C

����|{K(��ZTS>�
�
�
�
S
R
"
�	�	�		<		����`?
���:��}bD����{dRDC��pM5&���}U����k'���                // One extra squiggly is replaced by a "^"            if s.len() > 1 {            }                }                    s.extend(::std::iter::repeat('~').take(count));                    col += count;                    };                        _ => 1,                        '\t' => 8 - col%8,                    let count = match ch {                    if pos >= hi.col.to_usize() { break; }                for (pos, ch) in iter {            if hi.col != lo.col {            let hi = cm.lookup_char_pos(sp.hi);            s.extend(::std::iter::repeat('~').take(count));            col += count;            };                _ => 1,                '\t' => 8 - col%8,                // Most terminals have a tab stop every eight columns by default            let count = match lastc {            let mut s = String::from("^");            try!(write!(&mut err.dst, "{}", s));            }                }                    },                        s.push(' ');                        col += 1;                    _ => {                    },                        s.push('\t');                        col += 8 - col%8;                    '\t' => {                match ch {                // position.                // That way the squiggly line will usually appear in the correct                // the error-point-squiggly-line as well (instead of a space).                // Whenever a tab occurs on the previous line, we insert one on                if pos >= lo.col.to_usize() { break; }                lastc = ch;            for (pos, ch) in iter.by_ref() {            let mut iter = orig.chars().enumerate();            let mut lastc = ' ';            let mut col = skip;        if let Some(orig) = fm.get_line(lines.lines[0].line_index) {        }            s.push(' ');        for _ in 0..skip {        let skip = fm.name.chars().count() + digits + 3;        // part of the 'filename:line ' part of the previous line.        // Skip is the number of characters we need to skip because they are        let mut s = String::new();        while num > 0 { num /= 10; digits += 1; }        // how many digits must be indent past?        let mut num = (lines.lines[0].line_index + 1) / 10;        let mut digits = 0;        let lo = cm.lookup_char_pos(sp.lo);    if lines.lines.len() == 1 {    // If there's one line at fault we can easily point to the problem    // FIXME (#3260)    }        try!(write!(&mut err.dst, "{0:1$}...\n", "", s.len()));        let s = format!("{}:{} ", fm.name, last_line_index + 1);        let last_line_index = display_line_infos.last().unwrap().line_index;    if display_lines < all_lines {    // If we elided something, put an ellipsis.    }                    width=digits));                    line,                    line_info.line_index + 1,                    fm.name,        try!(write!(&mut err.dst, "{}:{:>width$} {}\n",    for (line_info, line) in display_line_infos.iter().zip(display_line_strings) {    // Print the offending lines    }        digits += 1;        max_line_num /= 10;    while max_line_num > 0 {    let mut digits = 0;    let mut max_line_num = display_line_infos[display_line_infos.len() - 1].line_index + 1;    assert!(display_line_infos.len() > 0);    // Calculate the widest number to format evenly and fix #11715    let display_line_strings = &line_strings[..display_lines];    let display_line_infos = &lines.lines[..display_lines];    let display_lines = cmp::min(all_lines, MAX_LINES);    let all_lines = lines.lines.len();    // Display only the first MAX_LINES lines.    };adbd������l*����`�
�
�
p
o
+
��fHG�������sT; �
�
�
�
�
�
�
�
�
�
�
V

�	�	�	�	a			�����Z2,*)�����a)����_YWV2�����qbI/}    pub cm: codemap::CodeMap,    pub handler: Handler,pub struct SpanHandler {/// reporting./// accepts span information for source-location/// A span-handler is like a handler but also}    }        "The parser has encountered an internal bug"    fn description(&self) -> &str {impl error::Error for ExplicitBug {}    }        write!(f, "parser internal bug")    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {impl fmt::Display for ExplicitBug {pub struct ExplicitBug;#[derive(Copy, Clone, Debug)]/// or `.span_bug` rather than a failed assertion, etc./// Signifies that the compiler died with an explicit call to `.bug`}    }        "The parser has encountered a fatal error"    fn description(&self) -> &str {impl error::Error for FatalError {}    }        write!(f, "parser fatal error")    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {impl fmt::Display for FatalError {pub struct FatalError;#[must_use]#[derive(Copy, Clone, Debug)]/// not be true.)/// used as the argument to panic at the moment, but that will eventually/// Used as a return value to signify a fatal error occurred. (It is also}                   sp: RenderSpan, msg: &str, lvl: Level);    fn custom_emit(&mut self, cm: &codemap::CodeMap,            msg: &str, code: Option<&str>, lvl: Level);    fn emit(&mut self, cmsp: Option<(&codemap::CodeMap, Span)>,pub trait Emitter {}    Never    Always,    Auto,pub enum ColorConfig {#[derive(Clone, Copy)]}    }        }                s            FileLine(s) =>            EndSpan(s) |            Suggestion(s, _) |            FullSpan(s) |        match *self {    fn span(&self) -> Span {impl RenderSpan {}    FileLine(Span),    /// by file:linenum.    /// A FileLine renders with just a line for the message prefixed    Suggestion(Span, String),    /// into the lines in place of the code covered by the span.    /// of hypothetical source code, where the `String` is spliced    /// message, prefixed by file:linenum, followed by a summary    /// A suggestion renders with both with an initial line for the    EndSpan(Span),    /// of the span).    /// (since `end_highlight_lines` displays an arrow to the end    /// compiletest/runtest to look at the last line of the span    /// the span, instead of the start. Used, at least, for telling    /// Similar to a FullSpan, but the cited position is the end of    FullSpan(Span),    /// the source code covered by the span.    /// message, prefixed by file:linenum, followed by a summary of    /// A FullSpan renders with both with an initial line for thepub enum RenderSpan {#[derive(Clone)]const MAX_LINES: usize = 6;/// maximum number of lines we will print for each error; arbitrary.use libc;ad�Z���q]SM���U�
�
�
x
Q
K

���V�ys@�
�
�
}
J


�	�	y	,	���WQ���]@:���tnlk;����dbaR(��b("���rA71����X���     pub fn err(&self, msg: &str) {    }        panic!(FatalError);         pub fn err(&self, msg: &str) {    }        panic!(FatalEr    pub fn err(&self, msg: &str) {    }        pub fn err(&self, msg: &str) {    }        panic!(FatalError);        self.emit.borrow_mut().emit(None, msg, None, Fatal);    pub fn fatal(&self, msg: &str) -> ! {    }        }            can_emit_warnings: can_emit_warnings            emit: RefCell::new(e),            err_count: Cell::new(0),        Handler {    pub fn with_emitter(can_emit_warnings: bool, e: Box<Emitter + Send>) -> Handler {    }        Handler::with_emitter(can_emit_warnings, emitter)        let emitter = Box::new(EmitterWriter::stderr(color_config, registry));               can_emit_warnings: bool) -> Handler {               registry: Option<diagnostics::registry::Registry>,    pub fn new(color_config: ColorConfig,impl Handler {}    pub can_emit_warnings: bool    emit: RefCell<Box<Emitter + Send>>,    err_count: Cell<usize>,pub struct Handler {/// others log errors for later reporting./// (fatal, bug, unimpl) may cause immediate exit,/// A handler deals with errors; certain errors}    }        &self.handler    pub fn handler<'a>(&'a self) -> &'a Handler {    }        self.span_bug(sp, &format!("unimplemented {}", msg));    pub fn span_unimpl(&self, sp: Span, msg: &str) -> ! {    }        panic!(ExplicitBug);        self.handler.emit(Some((&self.cm, sp)), msg, Bug);    pub fn span_bug(&self, sp: Span, msg: &str) -> ! {    }        self.handler.custom_emit(&self.cm, FileLine(sp), msg, Help);    pub fn fileline_help(&self, sp: Span, msg: &str) {    }        self.handler.custom_emit(&self.cm, FileLine(sp), msg, Note);    pub fn fileline_note(&self, sp: Span, msg: &str) {    }        self.handler.custom_emit(&self.cm, Suggestion(sp, suggestion), msg, Help);    pub fn span_suggestion(&self, sp: Span, msg: &str, suggestion: String) {    /// See `diagnostic::RenderSpan::Suggestion` for more information.    ///    /// Prints out a message with a suggested edit of the code.    }        self.handler.emit(Some((&self.cm, sp)), msg, Help);    pub fn span_help(&self, sp: Span, msg: &str) {    }        self.handler.custom_emit(&self.cm, EndSpan(sp), msg, Note);    pub fn span_end_note(&self, sp: Span, msg: &str) {    }        self.handler.emit(Some((&self.cm, sp)), msg, Note);    pub fn span_note(&self, sp: Span, msg: &str) {    }        self.handler.emit_with_code(Some((&self.cm, sp)), msg, code, Warning);    pub fn span_warn_with_code(&self, sp: Span, msg: &str, code: &str) {    }        self.handler.emit(Some((&self.cm, sp)), msg, Warning);    pub fn span_warn(&self, sp: Span, msg: &str) {    }        self.handler.bump_err_count();        self.handler.emit_with_code(Some((&self.cm, sp)), msg, code, Error);    pub fn span_err_with_code(&self, sp: Span, msg: &str, code: &str) {    }        self.handler.bump_err_count();        self.handler.emit(Some((&self.cm, sp)), msg, Error);    pub fn span_err(&self, sp: Span, msg: &str) {    }        return FatalError;        self.handler.emit_with_code(Some((&self.cm, sp)), msg, code, Fatal);    pub fn span_fatal_with_code(&self, sp: Span, msg: &str, code: &str) -> FatalError {    }        return FatalError;        self.handler.emit(Some((&self.cm, sp)), msg, Fatal);    pub fn span_fatal(&self, sp: Span, msg: &str) -> FatalError {    }        }            cm: cm,            handler: handler,        SpanHandler {    pub fn new(handler: Handler, cm: codemap::CodeMap) -> SpanHandler {impl SpanHandler {ad[�]�]�������{zS �
�
�
�
e
;
:
��R43	��lk6�
�
�
�
V
U

�	�	u	K	��q-#"��r4�������^;����z�������v5����L!��ba��        assert!(display_line_infos.len() > 0);        // Calculate the widest number to format evenly and fix #11715        let display_line_strings = &line_strings[..display_lines];        let display_line_infos = &lines.lines[..display_lines];        let display_lines = cmp::min(all_lines, MAX_LINES);        let all_lines = lines.lines.len();        // Display only the first MAX_LINES lines.        };            Some(line_strings) => line_strings            None => { return Ok(()); }        let line_strings = match line_strings {                       .collect();                       .map(|info| fm.get_line(info.line_index))            lines.lines.iter()        let line_strings: Option<Vec<&str>> =        let fm = &*lines.file;        };            }                return Ok(());                try!(write!(&mut self.dst, "(internal compiler error: unprintable span)\n"));            Err(_) => {            Ok(lines) => lines,        let lines = match lines {    {                       -> io::Result<()>                       lines: codemap::FileLinesResult)                       lvl: Level,                       sp: Span,                       cm: &codemap::CodeMap,    fn highlight_lines(&mut self,    }        Ok(())        }                        "", fm.name.len(), elided_line_num.len()));            try!(write!(&mut self.dst, "{0:1$} {0:2$} ...\n",            let elided_line_num = format!("{}", first_line.line_index + MAX_LINES + 1);        if lines.next().is_some() {        // if we elided some lines, add an ellipsis        }                        fm.name, "", elided_line_num.len(), line));            try!(write!(&mut self.dst, "{0}:{1:2$} {3}\n",            let elided_line_num = format!("{}", line_index+1);        for (line, line_index) in lines.by_ref().take(MAX_LINES).zip(first_line.line_index..) {        let mut lines = complete.lines();        let fm = &*lines.file;        // snippets from the actual error being reported.        // space for them. This helps with lining up with previous        // print the suggestion without any line numbers, but leave        let complete = format!("{}{}{}", prefix, suggestion, suffix);                       .unwrap_or("");                       .map(|l| &l[last_line.end_col.0..])        let suffix = fm.get_line(last_line.line_index)        let last_line = lines.lines.last().unwrap();                       .unwrap_or("");                       .map(|l| &l[..first_line.start_col.0])        let prefix = fm.get_line(first_line.line_index)        let first_line = &lines.lines[0];        let fm = &lines.file;        // then append the snippet from the last line that trails the span.        // line that precedes the span, prepend that with the suggestion, and        // To build up the result, we want to take the snippet from the first        assert!(!lines.lines.is_empty());        let lines = cm.span_to_lines(sp).unwrap();    {                            -> io::Result<()>                            suggestion: &str)                            sp: Span,                            cm: &codemap::CodeMap,    fn highlight_suggestion(&mut self,    }        Ok(())        }            None => (),                },                    None => ()                    }                                                             detailed explanation", code), None));                                                   &format!("run `rustc --explain {}` to see a \                        try!(self.print_diagnostic(&ss[..], Help,ad3�[��cC* ��fE�
�
�
�
�
g

����h���ih4�
�
�
�
>

�	�	�	n	J	%	���`�dC$���pJ!����xN�����ED��P!���t^LK*�����                }                    s.pop();                    // One extra squiggly is replaced by a "^"                if s.len() > 1 {                }                    }                        s.extend(::std::iter::repeat('~').take(count));                        col += count;                        };                            _ => 1,                            '\t' => 8 - col%8,                        let count = match ch {                        if pos >= hi.col.to_usize() { break; }                    for (pos, ch) in iter {                if hi.col != lo.col {                let hi = cm.lookup_char_pos(sp.hi);                s.extend(::std::iter::repeat('~').take(count));                col += count;                };                    _ => 1,                    '\t' => 8 - col%8,                    // Most terminals have a tab stop every eight columns by default                let count = match lastc {                let mut s = String::from("^");                try!(write!(&mut self.dst, "{}", s));                }                    }                        },                            s.push(' ');                            col += 1;                        _ => {                        },                            s.push('\t');                            col += 8 - col%8;                        '\t' => {                    match ch {                    // position.                    // That way the squiggly line will usually appear in the correct                    // the error-point-squiggly-line as well (instead of a space).                    // Whenever a tab occurs on the previous line, we insert one on                    if pos >= lo.col.to_usize() { break; }                    lastc = ch;                for (pos, ch) in iter.by_ref() {                let mut iter = orig.chars().enumerate();                let mut lastc = ' ';                let mut col = skip;            if let Some(orig) = fm.get_line(lines.lines[0].line_index) {            }                s.push(' ');            for _ in 0..skip {            let skip = fm.name.chars().count() + digits + 3;            // part of the 'filename:line ' part of the previous line.            // Skip is the number of characters we need to skip because they are            let mut s = String::new();            while num > 0 { num /= 10; digits += 1; }            // how many digits must be indent past?            let mut num = (lines.lines[0].line_index + 1) / 10;            let mut digits = 0;            let lo = cm.lookup_char_pos(sp.lo);        if lines.lines.len() == 1 {        // If there's one line at fault we can easily point to the problem        // FIXME (#3260)        }            try!(write!(&mut self.dst, "{0:1$}...\n", "", s.len()));            let s = format!("{}:{} ", fm.name, last_line_index + 1);            let last_line_index = display_line_infos.last().unwrap().line_index;        if display_lines < all_lines {        // If we elided something, put an ellipsis.        }                        width=digits));                        line,                        line_info.line_index + 1,                        fm.name,            try!(write!(&mut self.dst, "{}:{:>width$} {}\n",        for (line_info, line) in display_line_infos.iter().zip(display_line_strings) {        // Print the offending lines        }            digits += 1;            max_line_num /= 10;        while max_line_num > 0 {        let mut digits = 0;        let mut max_line_num = display_line_infos[display_line_infos.len() - 1].line_index + 1;ad!�V�oaWHBA��U�
�
�
f
4

��~\<$�����nmG"�
�
`
R
 
�	�	U				���E���zN����zI%��Q��yO)	���uonF��gI+���                                                   |span| cm.span_to_string(span));                    let ss = ei.callee.span.map_or(String::new(),                Some(ei) => {            match expn_info {        let cs = try!(cm.with_expn_info(sp.expn_id, |expn_info| -> io::Result<_> {                             -> io::Result<()> {                             sp: Span)                             cm: &codemap::CodeMap,    fn print_macro_backtrace(&mut self,    }                              "{}", s)        println_maybe_styled!(self, term::Attr::ForegroundColor(lvl.color()),        s.push('^');        }            }                }                    _ => s.push(' '),                    '\t' => s.push('\t'),                match ch {                // position.                // That way the squiggly line will usually appear in the correct                // the error-point-squiggly-line as well (instead of a space).                // Whenever a tab occurs on the previous line, we insert one on                if pos >= hi.col.to_usize() - 1 { break; }                // Span seems to use half-opened interval, so subtract 1            for (pos, ch) in iter {            let iter = orig.chars().enumerate();        if let Some(orig) = fm.get_line(lines[0].line_index) {        }            s.push(' ');        for _ in 0..skip {        let mut s = String::new();        let skip = last_line_start.chars().count();        let hi = cm.lookup_char_pos(sp.hi);        let last_line_start = format!("{}:{} ", fm.name, lines[lines.len()-1].line_index + 1);        }            }                }                                line_info.line_index + 1, line));                    try!(write!(&mut self.dst, "{}:{} {}\n", fm.name,                if let Some(line) = fm.get_line(line_info.line_index) {            for line_info in lines {        } else {            }                            last_line_index + 1, last_line));                try!(write!(&mut self.dst, "{}:{} {}\n", fm.name,            if let Some(last_line) = fm.get_line(last_line_index) {            let last_line_index = lines[lines.len() - 1].line_index;            try!(write!(&mut self.dst, "...\n"));            }                            lines[0].line_index + 1, line));                try!(write!(&mut self.dst, "{}:{} {}\n", fm.name,            if let Some(line) = fm.get_line(lines[0].line_index) {        if lines.len() > MAX_LINES {        let lines = &lines.lines[..];        let fm = &*lines.file;        };            }                return Ok(());                try!(write!(&mut self.dst, "(internal compiler error: unprintable span)\n"));            Err(_) => {            Ok(lines) => lines,        let lines = match lines {                          -> io::Result<()> {                           lines: codemap::FileLinesResult)                           lvl: Level,                           sp: Span,                           cm: &codemap::CodeMap,    fn end_highlight_lines(&mut self,    #[allow(deprecated)]    /// six lines.    /// dot dot dot, then last line, whereas `highlight_lines` prints the first    /// than 6 lines), `end_highlight_lines` will print the first line, then    /// span (instead of the first byte). Also, when the span is too long (more    /// `end_highlight_lines` will always put arrow on the last byte of the    /// Here are the differences between this and the normal `highlight_lines`:    }        Ok(())        }            }                                           "{}", s));                try!(println_maybe_styled!(self, term::Attr::ForegroundColor(lvl.color()),ad!�S��H��e(�
�
j
,
���zpc
	�����z9#�
�
n
h
[
&

�	�	�	�	�	|	f	3		�����\RLJI(���H��p1&%�����j.�������p`_%$����_3�~e���        FullS        FullSpan(_) => {    match rsp {    try!(print_diagnostic(dst,         FullSpan(_) => {    match rsp {    try!(print_diagnostic(dst        FullSpan(_) => {         FullSpan(_) => {    match rsp {    try!(print_diagn        FullSpan(_) => {    match rsp {    try!(print_diagnostic(        FullSpan(_) => {    match rsp {    try!        FullSpan(_) => {    match rsp {          FullSpan(_) => {    match rs        FullSpan(_) => {    match rsp {    try!(print_diagnostic(dst, &        FullSpan(_) => {    match r        FullS        FullSpan(_) => {    m                FullSpan(_) => {    match rsp {    try!(print_d         FullSpan        FullSpan(_) => {}    }        }            Err(e) => panic!("failed to print diagnostics: {:?}", e),            Ok(()) => {}        match self.emit_(cm, sp, msg, None, lvl) {                   sp: RenderSpan, msg: &str, lvl: Level) {    fn custom_emit(&mut self, cm: &codemap::CodeMap,    }        }            Err(e) => panic!("failed to print diagnostics: {:?}", e),            Ok(()) => {}        match error {        };            None => self.print_diagnostic("", lvl, msg, code),            Some((cm, sp)) => self.emit_(cm, FullSpan(sp), msg, code, lvl),                                                msg, code, lvl),                                                FileLine(COMMAND_LINE_SP),            Some((cm, COMMAND_LINE_SP)) => self.emit_(cm,        let error = match cmsp {            msg: &str, code: Option<&str>, lvl: Level) {            cmsp: Option<(&codemap::CodeMap, Span)>,    fn emit(&mut self,impl Emitter for EmitterWriter {}    }        }            Raw(ref mut w) => w.flush(),            Terminal(ref mut t) => t.flush(),        match *self {    fn flush(&mut self) -> io::Result<()> {    }        }            Raw(ref mut w) => w.write(bytes),            Terminal(ref mut t) => t.write(bytes),        match *self {    fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {impl Write for Destination {}    }        GetConsoleMode(handle, &mut out) != 0        let mut out = 0;        let handle = GetStdHandle(STD_ERROR_HANDLE);    unsafe {    }                          lpMode: libc::LPDWORD) -> libc::BOOL;        fn GetConsoleMode(hConsoleHandle: libc::HANDLE,        fn GetStdHandle(which: libc::DWORD) -> libc::HANDLE;    extern "system" {    const STD_ERROR_HANDLE: libc::DWORD = -12i32 as libc::DWORD;fn stderr_isatty() -> bool {#[cfg(windows)]}    unsafe { libc::isatty(libc::STDERR_FILENO) != 0 }fn stderr_isatty() -> bool {#[cfg(unix)]}    }        cs.map_or(Ok(()), |call_site| self.print_macro_backtrace(cm, call_site))        }));        }                None => Ok(None)                }                    Ok(Some(ei.call_site))                    try!(self.print_diagnostic(&ss, Note, "expansion site", None));                    let ss = cm.span_to_string(ei.call_site);                                               None));                                                        post),                                                        ei.callee.name,                                                        pre,                                               &format!("in expansion of {}{}{}",                    try!(self.print_diagnostic(&ss, Note,                    };                        codemap::CompilerExpansion => ("", ""),                        codemap::MacroBang => ("", "!"),                        codemap::MacroAttribute => ("#[", "]"),                    let (pre, post) = match ei.callee.format {