mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
rustc_metadata: Do not forget to encode inherent impls for foreign types
This commit is contained in:
parent
d92d28e523
commit
384eb2691f
@ -1753,6 +1753,7 @@ impl EncodeContext<'a, 'tcx> {
|
||||
self.encode_const_stability(def_id);
|
||||
self.encode_deprecation(def_id);
|
||||
self.encode_item_type(def_id);
|
||||
self.encode_inherent_implementations(def_id);
|
||||
if let hir::ForeignItemKind::Fn(..) = nitem.kind {
|
||||
record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id));
|
||||
self.encode_variances_of(def_id);
|
||||
|
9
src/test/ui/extern/auxiliary/extern-types-inherent-impl.rs
vendored
Normal file
9
src/test/ui/extern/auxiliary/extern-types-inherent-impl.rs
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
#![feature(extern_types)]
|
||||
|
||||
extern "C" {
|
||||
pub type CrossCrate;
|
||||
}
|
||||
|
||||
impl CrossCrate {
|
||||
pub fn foo(&self) {}
|
||||
}
|
23
src/test/ui/extern/extern-types-inherent-impl.rs
vendored
23
src/test/ui/extern/extern-types-inherent-impl.rs
vendored
@ -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() {}
|
||||
|
Loading…
Reference in New Issue
Block a user