Skip to content

ICE using enum variant constructor in borrowed vector initializer #10228

Closed
@jdm

Description

@jdm
Contributor

The number of restrictions on this testcase are pretty bizarre:

enum StdioContainer {
    CreatePipe(bool)
}

struct Test<'self> {
    args: &'self [~str],
    io: &'self [StdioContainer]
}

fn main() {
    let test = Test {
        args: [],
        io: [CreatePipe(true)]
    };
}

This is as reduced as I could make it. There needs to be two borrowed vectors, and one of them needs to contain ~str elements (u8 didn't work). The other needs to contain an enum variant with a constructor that's called in the initializer. The end result is an LLVM assertion for the call:

rustc: /run/media/jdm/ssd/rust/src/llvm/lib/IR/Instructions.cpp:281: void llvm::CallInst::init(llvm::Value*, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.

Activity

cnd

cnd commented on Nov 7, 2013

@cnd
Contributor

cc

alexcrichton

alexcrichton commented on Mar 3, 2014

@alexcrichton
Member

This appears to work now, flagging as needstest

enum StdioContainer {
    CreatePipe(bool)
}

struct Test<'a> {
    args: &'a [~str],
    io: &'a [StdioContainer]
}

fn main() {
    let test = Test {
        args: &[],
        io: &[CreatePipe(true)]
    };
}
added a commit that references this issue on Mar 6, 2014
13e10f5
added a commit that references this issue on Mar 6, 2014

auto merge of #12738 : alexcrichton/rust/needstest, r=brson,just

0e95b08
added a commit that references this issue on Jul 25, 2024

Auto merge of rust-lang#13090 - J-ZhengLi:issue9790, r=blyxyas

0cbbee1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @jdm@alexcrichton@cnd

      Issue actions

        ICE using enum variant constructor in borrowed vector initializer · Issue #10228 · rust-lang/rust