rustc_metadata: Do not forget to encode inherent impls for foreign types

This commit is contained in:
Vadim Petrochenkov 2020-09-30 22:49:59 +03:00
parent d92d28e523
commit 384eb2691f
3 changed files with 25 additions and 8 deletions

View file

@ -0,0 +1,9 @@
#![feature(extern_types)]
extern "C" {
pub type CrossCrate;
}
impl CrossCrate {
pub fn foo(&self) {}
}

View file

@ -1,19 +1,26 @@
// run-pass
#![allow(dead_code)]
// Test that inherent impls can be defined for extern types.
// check-pass
// aux-build:extern-types-inherent-impl.rs
#![feature(extern_types)]
extern {
type A;
extern crate extern_types_inherent_impl;
use extern_types_inherent_impl::CrossCrate;
extern "C" {
type Local;
}
impl A {
fn foo(&self) { }
impl Local {
fn foo(&self) {}
}
fn use_foo(x: &A) {
fn use_foo(x: &Local, y: &CrossCrate) {
Local::foo(x);
x.foo();
CrossCrate::foo(y);
y.foo();
}
fn main() { }
fn main() {}