-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #77375 - petrochenkov:inherext, r=oli-obk
rustc_metadata: Do not forget to encode inherent impls for foreign types So I tried to move FFI interface for LLVM from `rustc_codegen_llvm` to `rustc_llvm` and immediately encountered this fascinating issue. Fixes #46665.
- Loading branch information
Showing
3 changed files
with
25 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![feature(extern_types)] | ||
|
||
extern "C" { | ||
pub type CrossCrate; | ||
} | ||
|
||
impl CrossCrate { | ||
pub fn foo(&self) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |