You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tracking Issue for core::cell::{Ref,RefMut}::try_map #143801
This was extensively discussed in last week's @rust-lang/libs-api meeting. There were concerns around the fact that the return value doesn't work with ? due to it being a tuple. Instead, the following signature was proposed:
Also, another thing that was discussed in the meeting is that we would like this API to also be provided on MutexGuard, RwLockReadGuard, RwLockWriteGuard and ReentrantLockGuard. Generally these should mirror the API of RefCell guards, since they basically work the same way except for working across threads.
From #153093 (comment) It seems like adding impl From<TryMapError<E>> for E { ... } causes type inference failures in some cases due to the single-impl rule no longer applying, e.g.
use std::fmt;structFoo;impl fmt::DebugforFoo{fnfmt(&self,f:&mut fmt::Formatter<'_>) -> fmt::Result{letmut w = |name:&str| {// can fix by -> fmt::Result on closure
f.write_str(name)?;Ok(())// compiler can no longer infer that E = fmt::Error};w("hello")?;Ok(())}}fnmain(){dbg!(Foo);}
error[E0282]:type annotations needed
--> b.rs:7:13
|
7 | Ok(())// compiler can no longer infer that this is fmt::Result
| ^^ cannot infer type of the type parameter `E` declared on the enum `Result`
|
help: consider specifying the generic arguments
|
7 | Ok::<(),E>(())// compiler can no longer infer that this is fmt::Result
| +++++++++
error: aborting due to 1 previous error
Activity
Rollup merge of rust-lang#118087 - GrigorenkoPV:refcell_try_map, r=Ma…
Rollup merge of rust-lang#118087 - GrigorenkoPV:refcell_try_map, r=Ma…
Rollup merge of rust-lang#118087 - GrigorenkoPV:refcell_try_map, r=Ma…
Rollup merge of rust-lang#118087 - GrigorenkoPV:refcell_try_map, r=Ma…
Unrolled build for #118087
Rollup merge of #118087 - GrigorenkoPV:refcell_try_map, r=Mark-Simula…
Rollup merge of rust-lang#118087 - GrigorenkoPV:refcell_try_map, r=Ma…
karolzwolak commentedon Aug 24, 2025
Implementation PR is merged, so @rustbot label -S-tracking-unimplemented
Rollup merge of #118087 - GrigorenkoPV:refcell_try_map, r=Mark-Simula…
Mark-Simulacrum commentedon Feb 14, 2026
Nominating for libs-api to consider whether an FCP is warranted or we have questions before starting it.
Amanieu commentedon Feb 24, 2026
This was extensively discussed in last week's @rust-lang/libs-api meeting. There were concerns around the fact that the return value doesn't work with
?due to it being a tuple. Instead, the following signature was proposed:This would allow
?to work seamlessly since?calls.into()on the error type.Amanieu commentedon Feb 24, 2026
Also, another thing that was discussed in the meeting is that we would like this API to also be provided on
MutexGuard,RwLockReadGuard,RwLockWriteGuardandReentrantLockGuard. Generally these should mirror the API ofRefCellguards, since they basically work the same way except for working across threads.zachs18 commentedon Jun 12, 2026
From #153093 (comment) It seems like adding
impl From<TryMapError<E>> for E { ... }causes type inference failures in some cases due to the single-impl rule no longer applying, e.g.Should a crater run be done?