Add comments suggested by Niko

This commit is contained in:
Phil Dawes 2015-04-04 21:47:40 +01:00
parent b2bcb7229a
commit e3427c3c34
4 changed files with 9 additions and 27 deletions

View File

@ -68,9 +68,9 @@ pub trait Emitter {
sp: RenderSpan, msg: &str, lvl: Level);
}
/// This structure is used to signify that a task has panicked with a fatal error
/// from the diagnostics. You can use this with the `Any` trait to figure out
/// how a rustc task died (if so desired).
/// Used as a return value to signify a fatal error occurred. (It is also
/// used as the argument to panic at the moment, but that will eventually
/// not be true.)
#[derive(Copy, Clone)]
#[must_use]
pub struct FatalError;

View File

@ -23,17 +23,6 @@ use parse::token::InternedString;
use parse::token;
use ptr::P;
macro_rules! panictry {
($e:expr) => ({
use std::result::Result::{Ok, Err};
match $e {
Ok(e) => e,
Err(e) => panic!(e),
}
})
}
enum State {
Asm,
Outputs,

View File

@ -24,17 +24,6 @@ use ptr::P;
use std::collections::HashMap;
use std::iter::repeat;
macro_rules! panictry {
($e:expr) => ({
use std::result::Result::{Ok, Err};
match $e {
Ok(e) => e,
Err(e) => { panic!(e); }
}
})
}
#[derive(PartialEq)]
enum ArgumentType {
Known(String),

View File

@ -50,13 +50,17 @@ extern crate libc;
extern crate serialize as rustc_serialize; // used by deriving
// A variant of 'try!' that panics on Err(FatalError). This is used as a
// crutch on the way towards a non-panic!-prone parser. It should be used
// for fatal parsing errors; eventually we plan to convert all code using
// panictry to just use normal try
macro_rules! panictry {
($e:expr) => ({
use std::result::Result::{Ok, Err};
use diagnostic::FatalError;
match $e {
Ok(e) => e,
Err(e) => panic!(e)
Err(FatalError) => panic!(FatalError)
}
})
}