dtolnay / quote

Rust quasi-quoting
Apache License 2.0
1.32k stars 90 forks source link

Fix no as_slice() on arrays on old toolchains #201

Closed dtolnay closed 2 years ago

dtolnay commented 2 years ago

Pre-1.57:

error[E0658]: use of unstable library feature 'array_methods'
   --> src/runtime.rs:320:33
    |
320 |     repr.starts_with(['t', 'f'].as_slice())
    |                                 ^^^^^^^^
    |
    = note: see issue #76118 <https://github.com/rust-lang/rust/issues/76118> for more information

Pre-1.48:

error[E0599]: no method named `as_slice` found for array `[char; 2]` in the current scope
   --> src/runtime.rs:320:33
    |
320 |     repr.starts_with(['t', 'f'].as_slice())
    |                                 ^^^^^^^^ method not found in `[char; 2]`
    |
    = help: items from traits can only be used if the trait is in scope
    = note: the following trait is implemented but not in scope; perhaps add a `use` for it:
            `use std::array::FixedSizeArray;`