Josh Stone

Results 817 comments of Josh Stone

I'm less sure about your new addition of `try_map_both!` because it's limited to `Result` instead of generic `Try`, whereas you can probably just use `map_both!` with an `?` operator inside...

> I'm not sure how to implement it properly given that https://doc.rust-lang.org/beta/std/ops/trait.Try.html is unstable. Right, you can't, which gives the advantage to the `?` operator.

Hidden closures in the macro also have costs, since that prevents control flow and some borrowck patterns that would otherwise be allowed in local code. Have you considered `map_both!(...).factor_err()` for...

> > Hidden closures in the macro also have costs, since that prevents control flow and some borrowck patterns that would otherwise be allowed in local code. > > Where...

FWIW, I do have a [private `Try` in `rayon`](https://github.com/rayon-rs/rayon/blob/97c1133c2366a301a2d4ab35cf686bca7f74830f/src/iter/mod.rs#L3513) too, but I think that has a much stronger justification for enabling parallel `try_fold` and such, which would be very difficult...

I don't think we need anything added to `Sign`, just: ``` impl BigInt { fn bikeshed_abs_in_place(&mut self) { if self.sign == Sign::Minus { self.sign = Sign::Plus; } } } ```...

There is already an `abs(&self)` through the `Signed` trait: https://docs.rs/num-bigint/latest/num_bigint/struct.BigInt.html#method.abs

Yeah, `make_abs` sounds ok. There's some precedent in std with `make_ascii_upper`/`lower_case`, `make_contiguous`, and `make_mut`.

Other examples where `Clone` may not be wanted or intended: * `vec![Vec::with_capacity(cap); n]` * `vec![Arc::new(Mutex::new(x)); n]`

We should also be careful about how this interacts with `expr`/`expr_2021` changes: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/macro-fragment-specifiers.html ... but maybe that just means we would have to manually match the `const` before the more...