-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Description
I was trying to do something admittedly a little weird. 1) match foo.into() { } where foo is Into<String>. 2) Declare a const empty string to avoid creating a local temporary to match against (defined in a different module): pub const EMPTY_STRING: String = String::new();.
The offending code:
pub struct HexByteString(String);
impl HexByteString {
pub fn new<T: Into<String>>(init_value: T) -> Result<HexByteString> {
match init_value.into() {
consts::EMPTY_STRING => Err(Error::EmptyValue(msgs::ERR_EMPTY_VALUE.to_string())),
s @ _ => Ok(HexByteString(s)),
}
}
}
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️