]> git.lizzy.rs Git - rust.git/blob - tests/ui/extern/extern-types-trait-impl.rs
Auto merge of #106646 - Amanieu:ilp32-object, r=Mark-Simulacrum
[rust.git] / tests / ui / extern / extern-types-trait-impl.rs
1 // run-pass
2 #![allow(dead_code)]
3 // Test that traits can be implemented for extern types.
4 #![feature(extern_types)]
5
6 extern "C" {
7     type A;
8 }
9
10 trait Foo {
11     fn foo(&self) {}
12 }
13
14 impl Foo for A {
15     fn foo(&self) {}
16 }
17
18 fn assert_foo<T: ?Sized + Foo>() {}
19
20 fn use_foo<T: ?Sized + Foo>(x: &dyn Foo) {
21     x.foo();
22 }
23
24 fn main() {
25     assert_foo::<A>();
26 }