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
|
/// Describes reason for target lookup failure
|
||||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
#[derive(Fail, PartialEq, Eq, Copy, Clone, Debug)]
|
||||||
pub enum LookupError {
|
pub enum LookupError {
|
||||||
/// Support for this target was disabled in the current build.
|
/// Support for this target was disabled in the current build.
|
||||||
|
#[fail(display = "Support for this target is disabled")]
|
||||||
SupportDisabled,
|
SupportDisabled,
|
||||||
|
|
||||||
/// Support for this target has not yet been implemented.
|
/// Support for this target has not yet been implemented.
|
||||||
|
#[fail(display = "Support for this target has not been implemented yet")]
|
||||||
Unsupported,
|
Unsupported,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,15 +147,18 @@ impl Configurable for Builder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An error produced when changing a setting.
|
/// An error produced when changing a setting.
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Fail, Debug, PartialEq, Eq)]
|
||||||
pub enum SetError {
|
pub enum SetError {
|
||||||
/// No setting by this name exists.
|
/// No setting by this name exists.
|
||||||
|
#[fail(display = "No existing setting with this name")]
|
||||||
BadName,
|
BadName,
|
||||||
|
|
||||||
/// Type mismatch for setting (e.g., setting an enum setting as a bool).
|
/// 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,
|
BadType,
|
||||||
|
|
||||||
/// This is not a valid value for this setting.
|
/// This is not a valid value for this setting.
|
||||||
|
#[fail(display = "Unexpected value for a setting")]
|
||||||
BadValue,
|
BadValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user