Fixes #504: Implement Display/Fail for SetError and LookupError;
This commit is contained in:
committed by
Dan Gohman
parent
0b3d3ac880
commit
8b296e4874
@@ -120,12 +120,14 @@ pub fn lookup(triple: Triple) -> Result<Builder, LookupError> {
|
||||
}
|
||||
|
||||
/// Describes reason for target lookup failure
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
#[derive(Fail, PartialEq, Eq, Copy, Clone, Debug)]
|
||||
pub enum LookupError {
|
||||
/// Support for this target was disabled in the current build.
|
||||
#[fail(display = "Support for this target is disabled")]
|
||||
SupportDisabled,
|
||||
|
||||
/// Support for this target has not yet been implemented.
|
||||
#[fail(display = "Support for this target has not been implemented yet")]
|
||||
Unsupported,
|
||||
}
|
||||
|
||||
|
||||
@@ -147,15 +147,18 @@ impl Configurable for Builder {
|
||||
}
|
||||
|
||||
/// An error produced when changing a setting.
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
#[derive(Fail, Debug, PartialEq, Eq)]
|
||||
pub enum SetError {
|
||||
/// No setting by this name exists.
|
||||
#[fail(display = "No existing setting with this name")]
|
||||
BadName,
|
||||
|
||||
/// Type mismatch for setting (e.g., setting an enum setting as a bool).
|
||||
#[fail(display = "Trying to set a setting with the wrong type")]
|
||||
BadType,
|
||||
|
||||
/// This is not a valid value for this setting.
|
||||
#[fail(display = "Unexpected value for a setting")]
|
||||
BadValue,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user