Skip to content

Commit 112dff0

Browse files
Add test for trait object safety
1 parent 6f513ea commit 112dff0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/test/rustdoc/trait-object-safe.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#![crate_name = "foo"]
2+
3+
// @has 'foo/trait.Safe.html'
4+
// @has - '//*[@class="obj-info"]' 'This trait is object safe.'
5+
pub trait Safe {
6+
fn foo(&self);
7+
}
8+
9+
// @has 'foo/trait.Unsafe.html'
10+
// @has - '//*[@class="obj-info"]' 'This trait is not object safe.'
11+
pub trait Unsafe {
12+
fn foo() -> Self;
13+
}
14+
15+
// @has 'foo/trait.Unsafe2.html'
16+
// @has - '//*[@class="obj-info"]' 'This trait is not object safe.'
17+
pub trait Unsafe2<T> {
18+
fn foo(i: T);
19+
}
20+
21+
// @has 'foo/struct.Foo.html'
22+
// @!has - '//*[@class="obj-info"]'
23+
pub struct Foo;

0 commit comments

Comments
 (0)