Skip to content

TypedArena cannot handle zero-sized types. #18037

Closed
@pythonesque

Description

@pythonesque

Seems like it just needs to be special-cased like Vec.

extern crate arena;

use arena::TypedArena;

fn main() {
    let arena = TypedArena::new();
    arena.alloc(());
}
$ RUST_BACKTRACE=1 ./foo 
task '<main>' failed at 'attempted to divide by zero', foo.rs:1
stack backtrace:
   1:        0x10347b579 - rt::backtrace::imp::write::hd2d3b636c19898a59Kq
   2:        0x10347e865 - failure::on_fail::h81686b612f31dab9N1q
   3:        0x1034836d5 - unwind::begin_unwind_inner::h4e3cb6f9f8acbab0Lud
   4:        0x10348339c - unwind::begin_unwind_fmt::ha20b8fb9f077636fdsd
   5:        0x1034830e2 - rust_begin_unwind
   6:        0x1034a5a2c - failure::fail_fmt::h32e427d57cdcefeciqk
   7:        0x1034a580f - failure::fail::hac1e247287dc75eemnk
   8:        0x10343f2e0 - TypedArena<T>.Drop::drop::h13055954499163682376
   9:        0x10343f136 - arena..TypedArena<(*>::glue_drop.1368::h49b1e082f58ae0e7
  10:        0x10343d9e5 - main::h801d3cab495245c7gaa
  11:        0x10347481a - start::closure.8539
  12:        0x10348429c - rust_try_inner
  13:        0x103484286 - rust_try
  14:        0x103481997 - unwind::try::h02eaf02110b5e7b2tjd
  15:        0x10348185c - task::Task::run::ha0919a84fddfd7a3Ezc
  16:        0x10347466e - start::h20a18ea3fde0c3a48je
  17:        0x1034744bb - lang_start::h8e27d580b5f6a9d7rje
  18:        0x10343da5f - main

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions