Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypedArena cannot handle zero-sized types. #18037

Closed
pythonesque opened this issue Oct 14, 2014 · 2 comments
Closed

TypedArena cannot handle zero-sized types. #18037

pythonesque opened this issue Oct 14, 2014 · 2 comments

Comments

@pythonesque
Copy link
Contributor

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

@steveklabnik
Copy link
Member

triage: just marking as libs, it's not clear when and if Arena is going to become stable.

@steveklabnik
Copy link
Member

Updated sample

#![feature(rustc_private)]

extern crate arena;

use arena::TypedArena;

fn main() {
    let arena = TypedArena::new();
    arena.alloc(());
}

pczarn added a commit to pczarn/rust that referenced this issue Jan 5, 2016
bors added a commit that referenced this issue Jan 11, 2016
Fixes #18037 "TypedArena cannot handle zero-sized types".
Closes #17931 "improve chunk allocation scheme used by Arena / TypedArena".
Closes #22847 "TypedArena should implement Send". - N.B. Arena cannot implement Send, since it may contain non-Send values.
Closes #18471 "`Arena::alloc_copy_inner` (at least) should be renamed and made public." - Added `Arena::alloc_bytes`.
Closes #18261 "support clearing TypedArena with the chunks preserved". - Only the largest chunk is preserved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants