refcell_try_map: add a separate error type#153093
refcell_try_map: add a separate error type#153093GrigorenkoPV wants to merge 1 commit intorust-lang:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
|
A very strange failure |
|
r? @jhpratt rustbot has assigned @jhpratt. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Currently failing CI. @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
128a2bf to
66efaaf
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
The job Click to see the possible cause of the failure (guessed by this bot)For more information how to resolve CI failures of this job, visit this link. |
|
For some reason #[unstable(feature = "refcell_try_map", issue = "143801")]
#[derive(Debug, Clone)]
pub struct TryMapError<T, E> {
pub original: T,
pub error: E,
}
#[unstable(feature = "refcell_try_map", issue = "143801")]
impl<T, E: crate::error::Error> From<TryMapError<T, E>> for E {
fn from(TryMapError { original: _, error }: TryMapError<T, E>) -> Self {
error
}
}breaks type inference in impl fmt::Debug for Kind {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("Kind(")?;
let mut has_bits = false;
let mut write_bit = |name: &str| {
if has_bits {
f.write_str(" | ")?;
}
f.write_str(name)?;
has_bits = true;
Ok(())
};
if self.is_event() {
write_bit("EVENT")?;
} |
|
Without looking into that beyond what you posted, that seems like the single-impl rule that has caused problems in the past. |
So that it works with
?(suggested in #143801 (comment)).core::cell::{Ref,RefMut}::try_map#143801Questions:
#[non_exhaustive]?impls should be added?