Closed
Description
The following successfully typechecks on rustc 1.12.0-nightly (b30eff7ba 2016-08-05)
, but generates an LLVM assertion failure:
struct Node<T: ?Sized + Send> {
next: Option<Box<Node<Send>>>,
value: T,
}
fn clear(head: &mut Option<Box<Node<Send>>>) {
while let Some(node) = head.take() {
*head = node.next;
}
}
fn main() {}
Error:
rustc: /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/Instructions.cpp:263: void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.
Note that replacing *head = node.next
with *head = node.next.take()
(and making node
mutable) allows compilation to succeed.
Metadata
Metadata
Assignees
Labels
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Type systemIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to beta.