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

ICE using enum variant constructor in borrowed vector initializer #10228

Closed
jdm opened this issue Nov 1, 2013 · 2 comments · Fixed by #12738
Closed

ICE using enum variant constructor in borrowed vector initializer #10228

jdm opened this issue Nov 1, 2013 · 2 comments · Fixed by #12738
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@jdm
Copy link
Contributor

jdm commented Nov 1, 2013

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.
@cnd
Copy link
Contributor

cnd commented Nov 7, 2013

cc

@alexcrichton
Copy link
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)]
    };
}

bors added a commit that referenced this issue Mar 6, 2014
Closes #6738
Closes #7061
Closes #7899
Closes #9719
Closes #10028
Closes #10228
Closes #10401
Closes #11192
Closes #11508
Closes #11529
Closes #11873
Closes #11925
flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 25, 2024
[`unwrap_or_default`]: skip warning when calling inside of suggested method's implementation

fixes: rust-lang#10228

---

changelog: [`unwrap_or_default`]: skip warning when calling inside of suggested method's implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants