about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-15 16:16:29 +1000
committerGitHub <noreply@github.com>2025-08-15 16:16:29 +1000
commit324bf2b9fd8bf9661e7045c8a93f5ff0ec1a8ca5 (patch)
tree8747cf5367ff40c47dafd5cc5f70c5c7b33ba610 /compiler/rustc_codegen_llvm/src
parent3507a749b365aae4eefa96ab700a9315d3280ee7 (diff)
parentf6bdffdcba7498fd3fe7b18bca966b23da6c463f (diff)
downloadrust-324bf2b9fd8bf9661e7045c8a93f5ff0ec1a8ca5.tar.gz
rust-324bf2b9fd8bf9661e7045c8a93f5ff0ec1a8ca5.zip
Rollup merge of #118087 - GrigorenkoPV:refcell_try_map, r=Mark-Simulacrum
Add Ref/RefMut try_map method

Tracking issue:  rust-lang/rust#143801

A more generalized version of [`filter_map`](https://doc.rust-lang.org/stable/core/cell/struct.Ref.html#method.filter_map), which allows to return some data on failure.

## Safety

As far as I can tell, `E` cannot contain any `'b` data, so it is impossible to duplicate the `&'b [mut]` reference into the `RefCell`'s  data.

Other than this `E`, everything is analogous to the already stable `filter_map`.

## `Try` / `Residual`

I have considered generalizing this to use the `Try` & `Residual` just like rust-lang/rust#79711 does for `array::try_map`, but it does not seem to be possible: we want to essentially `.map_err(|e| (orig, e))` but this does not seem to be supported with `Try`. (Plus I am not even sure if it is possible to express the fact that `&U` in `Try::Output` would have to have the same lifetime as the `&T` input of `F`.)

## ACP

~As far as I can tell, this [is not mandatory](https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html#suitability-for-the-standard-library), and the implementation is small enough to probably be smaller than the doc I would have to write.~

~https://github.com/rust-lang/libs-team/issues/341~

https://github.com/rust-lang/libs-team/issues/586
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions