Skip to content

LLVM assert (possibly class-related) #2718

Closed
@eholk

Description

@eholk

I'm trying to use classes in some code where I would normally use a resource, since resources are going away. I get the following LLVM assertion and backtrace.

Assertion failed: (Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"), function getTypeSizeInBits, file /Users/eholk/Documents/projects/mozilla/rust/src/llvm/lib/Target/TargetData.cpp, line 466.

Program received signal SIGABRT, Aborted.
[Switching to process 40424 thread 0x1e03]
0x00007fff8fda7ce2 in __pthread_kill ()
(gdb) bt
#0  0x00007fff8fda7ce2 in __pthread_kill ()
#1  0x00007fff962897d2 in pthread_kill ()
#2  0x0000000101f3eca6 in abort ()
#3  0x0000000101f3ecf8 in __assert_rtn ()
#4  0x0000000101d777d0 in llvm::TargetData::getTypeSizeInBits ()
#5  0x000000010128307a in LLVMSizeOfTypeInBits__c_stack_shim ()
#6  0x000000010163becc in __morestack () at rust_task.cpp:1327
#7  0x000000010162b7ce in rust_task::call_on_c_stack (this=0x10281e000, args=0x105026750, fn_ptr=0x105026750) at rust_task.h:392
#8  0x000000010162c357 in rust_task::record_stack_limit () at /Users/eholk/Documents/projects/mozilla/rust/src/rt/rust_task.h:58
#9  0x000000010162c357 in upcall_call_shim_on_c_stack (args=0x105026750, fn_ptr=0x101283040) at rust_upcall.cpp:64
#10 0x0000000100f1c556 in middle::trans::shape::static_size_of_enum::anon ()
#11 0x0000000100e3bc67 in middle::trans::shape::static_size_of_enum::_17b77bb34c1ffe7e::_02 ()
#12 0x0000000100e34b9e in middle::trans::type_of::type_of::_f3f689176c62646a::_02 ()
#13 0x0000000100e3528e in middle::trans::type_of::type_of::_f3f689176c62646a::_02 ()
#14 0x0000000100f1c52b in middle::trans::shape::static_size_of_enum::anon ()
#15 0x0000000100e3bc67 in middle::trans::shape::static_size_of_enum::_17b77bb34c1ffe7e::_02 ()
#16 0x0000000100e34b9e in middle::trans::type_of::type_of::_f3f689176c62646a::_02 ()
#17 0x0000000100e34f8e in middle::trans::type_of::type_of::_f3f689176c62646a::_02 ()
#18 0x0000000100e34e39 in middle::trans::type_of::type_of::_f3f689176c62646a::_02 ()
#19 0x0000000100e3528e in middle::trans::type_of::type_of::_f3f689176c62646a::_02 ()
#20 0x0000000101286d59 in __morestack ()
Previous frame inner to this frame (gdb could not unwind past this frame)

Here is a sampling of the code, some of which might be related.

    class send_packet<T: send> {
        let mut p: option<*packet<T>>;
        new(p: *packet<T>) { self.p = some(p); }
        drop {
            if self.p != none {
                let mut p = none;
                p <-> self.p;
                sender_terminate(option::unwrap(p))
            }
        }
        fn unwrap() -> *packet<T> {
            let mut p = none;
            p <-> self.p;
            option::unwrap(p)
        }
    }

    enum state {
        empty,
        full,
        blocked,
        terminated
    }

    type packet<T: send> = {
        mut state: state,
        mut blocked_task: option<task::task>,
        mut payload: option<T>
    };

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