Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSend and Sync errors guideline should call attention to trait objects #80
Comments
This comment has been minimized.
This comment has been minimized.
Kixunil
commented
May 31, 2017
|
Why should errors be |
This comment has been minimized.
This comment has been minimized.
|
It is explained in the guideline. https://github.com/brson/rust-api-guidelines#c-send-sync-err |
This comment has been minimized.
This comment has been minimized.
|
They also can't be put into an |
This comment has been minimized.
This comment has been minimized.
|
I filed #87 to include |
This comment has been minimized.
This comment has been minimized.
Kixunil
commented
May 31, 2017
|
@dtolnay That justification would be applicable to all types. "All types should be TBH I hate There is another thing I dislike about this guidance. Consider this example: impl Config {
fn load(file_name: &str) -> Result<Self, ConfigError> {
// ...
}
// ...
}This is how it'd look like with this guideline However I believe Allocating new |
This comment has been minimized.
This comment has been minimized.
|
Non-'static errors are incredibly painful to work with. 99% of the time you're going to be passing the error up to the calling function somehow. Having to do |
This comment has been minimized.
This comment has been minimized.
Kixunil
commented
May 31, 2017
|
Well, extension trait for It may not be hot path in case of |
dtolnay commentedMay 29, 2017
reqwest::Error::get_refreturnsOption<&(Error + 'static)>which is an error that is not Send and Sync. This is easy to miss and should be noted in C-SEND-SYNC-ERR.