error-chain
error-chain copied to clipboard
error: recursion limit reached while expanding the macro `quick_error` based on number of ErrorKinds
This is similar to #91, but more concrete. I'm using 1 foreign link and 8 errors, like so:
error_chain! {
types {
Error, ErrorKind, ResultExt, Result;
}
foreign_links {
Rusqlite(rusqlite::Error);
}
errors {
/// We're just not done yet. Message that the feature is recognized but not yet
/// implemented.
NotYetImplemented(t: String) {
description("not yet implemented")
display("not yet implemented: {}", t)
}
/// We've got corrupt EDN data in the datom store: a value and value_type don't line up.
BadEDNValuePair(value: edn::types::Value, value_type: ValueType) {
description("bad EDN (value_type, value) pair")
display("bad EDN (value_type, value) pair: ({:?}, {:?})", value_type, value)
}
/// We've got corrupt data in the SQL store: a value and value_type_tag don't line up.
BadSQLValuePair(value: rusqlite::types::Value, value_type_tag: i32) {
description("bad SQL (value_type_tag, value) pair")
display("bad SQL (value_type_tag, value) pair: ({}, {:?})", value_type_tag, value.data_type())
}
/// The SQLite store user_version isn't recognized. This could be an old version of Mentat
/// trying to open a newer version SQLite store; or it could be a corrupt file; or ...
BadSQLiteStoreVersion(version: i32) {
description("bad SQL store user_version")
display("bad SQL store user_version: {}", version)
}
/// A bootstrap definition couldn't be parsed or installed. This is a programmer error, not
/// a runtime error.
BadBootstrapDefinition(t: String) {
description("bad bootstrap definition")
display("bad bootstrap definition: '{}'", t)
}
/// A schema assertion couldn't be parsed.
BadSchemaAssertion(t: String) {
description("bad schema assertion")
display("bad schema assertion: '{}'", t)
}
/// An ident->entid mapping failed.
UnrecognizedIdent(ident: String) {
description("no entid found for ident")
display("no entid found for ident: '{}'", ident)
}
/// An entid->ident mapping failed.
UnrecognizedEntid(entid: Entid) {
description("no ident found for entid")
display("no ident found for entid: '{}'", entid)
}
}
}
If I add a single additional kind to errors
, I get the recursion limit. I've tried driving the recursion limit ridiculously high -- #![recursion_limit = "16384"]
in my errors.rs
-- and still hit the recursion limit. Is there some way to split the errors
block so the (disjoint!) errors don't trigger the recursion limit? Or do I need to just have one error type with an internal enum
to discriminate sub-errors?
I don't have trouble with https://play.rust-lang.org/?gist=3e6dcd1f2f360376cbb58af921338b0e&version=stable&backtrace=1. Would you provide me a link to you crate so that I can test? Also, try to remove some error
declarations and see the breaking point.
I don't have trouble with https://play.rust-lang.org/?gist=3e6dcd1f2f360376cbb58af921338b0e&version=stable&backtrace=1. Would you provide me a link to you crate so that I can test? Also, try to remove some error declarations and see the breaking point.
Thanks for the quick response! As I said, a single additional error triggers the recursion limit. Just duplicate and rename one of the existing definitions. I can post a link to failing code shortly if that doesn't trigger for you.
Hum, strange...
Same error with quick_error!
, you need to add four more variants.
I'm running into this issue as well; has there been any progress on this recently?
No... My guess is that it would require big changes in the macro for it not to use so much recursion.