Skip to content

refcell_try_map: add a separate error type#153093

Open
GrigorenkoPV wants to merge 1 commit intorust-lang:mainfrom
GrigorenkoPV:try_map/error
Open

refcell_try_map: add a separate error type#153093
GrigorenkoPV wants to merge 1 commit intorust-lang:mainfrom
GrigorenkoPV:try_map/error

Conversation

@GrigorenkoPV
Copy link
Contributor

@GrigorenkoPV GrigorenkoPV commented Feb 25, 2026

So that it works with ? (suggested in #143801 (comment)).

Questions:

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 25, 2026
@rust-log-analyzer

This comment has been minimized.

@GrigorenkoPV
Copy link
Contributor Author

A very strange failure

@GrigorenkoPV GrigorenkoPV marked this pull request as ready for review February 25, 2026 16:02
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 25, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 25, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 25, 2026

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, jhpratt, joboet, scottmcm

@jhpratt
Copy link
Member

jhpratt commented Mar 1, 2026

Currently failing CI.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 1, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 1, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot
Copy link
Collaborator

rustbot commented Mar 1, 2026

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.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-gcc failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
/dev/sda15      105M  6.2M   99M   6% /boot/efi
tmpfs           1.6G   12K  1.6G   1% /run/user/1001
================================================================================

Sufficient disk space available (94917548KB >= 52428800KB). Skipping cleanup.
##[group]Run echo "[CI_PR_NUMBER=$num]"
echo "[CI_PR_NUMBER=$num]"
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}

For more information how to resolve CI failures of this job, visit this link.

@GrigorenkoPV
Copy link
Contributor Author

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")?;
        }

@jhpratt
Copy link
Member

jhpratt commented Mar 1, 2026

Without looking into that beyond what you posted, that seems like the single-impl rule that has caused problems in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants