about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/interface.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-05-22 01:56:50 +0000
committerbors <bors@rust-lang.org>2022-05-22 01:56:50 +0000
commit09ea21343a432a4c51b363d6f53bed694f81ea3a (patch)
tree877158deca07406bc2b9946addb462676346bec8 /compiler/rustc_interface/src/interface.rs
parente52e7115c7477bbc257c44447bb7eccbcfe9cfb2 (diff)
parentd917112606efb0d1056e91adada7ba3e63641f4f (diff)
downloadrust-09ea21343a432a4c51b363d6f53bed694f81ea3a.tar.gz
rust-09ea21343a432a4c51b363d6f53bed694f81ea3a.zip
Auto merge of #94119 - c410-f3r:array-again-and-again, r=scottmcm
Stabilize `array_from_fn`

## Overall

Stabilizes `core::array::from_fn` ~~and `core::array::try_from_fn`~~ to allow the creation of custom infallible ~~and fallible~~ arrays.

Signature proposed for stabilization here, tweaked as requested in the meeting:

```rust
// in core::array

pub fn from_fn<T, const N: usize, F>(_: F) -> [T; N];
```

Examples in https://doc.rust-lang.org/nightly/std/array/fn.from_fn.html

## History

* On 2020-08-17, implementation was [proposed](https://github.com/rust-lang/rust/pull/75644).
* On 2021-09-29, tracking issue was [created](https://github.com/rust-lang/rust/issues/89379).
* On 2021-10-09, the proposed implementation was [merged](https://github.com/rust-lang-ci/rust/commit/bc8ad24020a160e1acd7ac9f7671947dcc01264c).
* On 2021-12-03, the return type of `try_from_fn` was [changed](https://github.com/rust-lang/rust/pull/91286#issuecomment-985513407).

## Considerations

* It is being assumed that indices are useful and shouldn't be removed from the callbacks
* The fact that `try_from_fn` returns an unstable type `R: Try` does not prevent stabilization. Although I'm honestly not sure about it.
* The addition or not of repeat-like variants is orthogonal to this PR.

These considerations are not ways of saying what is better or what is worse. In reality, they are an attempt to move things forward, anything really.

cc https://github.com/rust-lang/rust/issues/89379
Diffstat (limited to 'compiler/rustc_interface/src/interface.rs')
0 files changed, 0 insertions, 0 deletions