blob: 07cb1efa8013039bd54eedc87686ade207e249a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
//@ run-pass
#![allow(dead_code)]
// Test that traits can be implemented for extern types.
#![feature(extern_types, sized_hierarchy)]
use std::marker::PointeeSized;
extern "C" {
type A;
}
trait Foo: PointeeSized {
fn foo(&self) {}
}
impl Foo for A {
fn foo(&self) {}
}
fn assert_foo<T: PointeeSized + Foo>() {}
fn use_foo<T: PointeeSized + Foo>(x: &dyn Foo) {
x.foo();
}
fn main() {
assert_foo::<A>();
}
|