diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-01-26 23:15:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-26 23:15:48 +0100 |
| commit | 092ea4ba1908ec79544e14b584bb6aa60247ac33 (patch) | |
| tree | 92189be9986a69d1a3f4c8bbf5618aa30d0a7bf1 /compiler/rustc_parse/src/parser | |
| parent | c9ab37bf4f7b61cc682082084dde364304cf3fd3 (diff) | |
| parent | 6bfad315265cc36d461dedf19f64e445c872da0c (diff) | |
| download | rust-092ea4ba1908ec79544e14b584bb6aa60247ac33.tar.gz rust-092ea4ba1908ec79544e14b584bb6aa60247ac33.zip | |
Rollup merge of #113489 - tguichaoua:cow_from_array, r=dtolnay
impl `From<&[T; N]>` for `Cow<[T]>`
Implement `From<&[T; N]>` for `Cow<[T]>` to simplify its usage in the following example.
```rust
fn foo(data: impl Into<Cow<'static, [&'static str]>>) { /* ... */ }
fn main() {
foo(vec!["hello", "world"]);
foo(&["hello", "world"]); // Error: the trait `From<&[&str; 2]>` is not implemented for `Cow<'static, [&'static str]>`
foo(&["hello", "world"] as &[_]); // Explicit convertion into a slice is required
}
```
Diffstat (limited to 'compiler/rustc_parse/src/parser')
0 files changed, 0 insertions, 0 deletions
