Closed
Description
// cross_crate_self.rs
pub struct Foo<'self, A>(&'self A);
impl<'self, A> Foo<'self, A> {
pub fn new(a: &'self A) -> Foo<'self, A> {
Foo(a)
}
}
#[test]
fn test_foo() {
let _ = Foo::new(&1i);
}
// other.rs
extern mod cross_crate_self;
#[test]
fn test_foo() {
let _ = cross_crate_self::Foo::new(&1i);
}
$ rustc --test cross_crate_self.rs
$ ./cross_crate_self
running 1 test
test test_foo ... ok
result: ok. 1 passed; 0 failed; 0 ignored
$ rustc --lib cross_crate_self.rs
warning: missing crate link meta `name`, using `cross_crate_self` as default
warning: missing crate link meta `vers`, using `0.0` as default
$ rustc --test -L . other.rs
error: internal compiler error: ty::Region#subst(): Reference to self region when given substs with no self region: substs(self_r=None, self_ty=None, tps=[<V1>])
Having a generic A
seems to be necessary to exhibit the bug. (Caused #7177.)