fitzgen / bumpalo

A fast bump allocation arena for Rust
https://docs.rs/bumpalo
Apache License 2.0
1.39k stars 110 forks source link

bumpalo `vec!` doesn't accept trailing comma `,` #59

Closed derekdreery closed 4 years ago

derekdreery commented 4 years ago

Not really an issue, but I thought I'd report it all the same, for the sake of symmetry with std::vec!.

fitzgen commented 4 years ago

Happy to accept a pull request! Are you interested in writing one?

zhiburt commented 4 years ago

Hey, this issue probably a bit swamped to me, but it means that we should get something similar to bumpalo::vec![1, 2, 3, 4]?

As I can tell in this case, which seems quite good, it has to return a pair of Bump and the corresponding vector, since the memory must be allocated in the arena.

Is that the matter?

derekdreery commented 4 years ago

Hey, this issue probably a bit swamped to me, but it means that we should get something similar to bumpalo::vec![1, 2, 3, 4]?

As I can tell in this case, which seems quite good, it has to return a pair of Bump and the corresponding vector, since the memory must be allocated in the arena.

Is that the matter?

No, we always want to tell the bumpalo::vec! macro to allocate to an existing arena, otherwise there is no benefit over just allocating on the global heap. The problem is simply whether vec![1, 2,] is valid, in addition to vec![1, 2]