Closed
Description
This program
pub struct Foo {
a: int,
}
struct Bar<'self> {
a: ~Option<int>,
b: &'self Foo,
}
fn check(a: @Foo) {
let mut _ic = Bar{ b: a, a: ~None };
}
fn main(){}
yields
$ rustc foo.rs
Assertion failed: ((i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"), function init, file /Users/alex/code/rust-src/src/llvm/lib/IR/Instructions.cpp, line 281.
This cropped up after the new self lifetimes as I tried to change field b
from @Foo
to &'self Foo
. If the owned pointer from Bar
is removed (even just the sigil), the assertion still trips.
One solution I found is:
fn check(b: @Foo) {
let a = ~None;
let mut _ic = Bar{ b: b, a: a };
}