forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustdoc: add test for cross-crate trait-object types
as well as some FIXMEs
- Loading branch information
Showing
4 changed files
with
52 additions
and
0 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
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,17 @@ | ||
pub type Ty0 = dyn for<'any> FnOnce(&'any str) -> bool; | ||
|
||
pub type Ty1<'obj> = dyn std::fmt::Display + 'obj; | ||
|
||
pub type Ty2 = dyn for<'a, 'r> Container<'r, Item<'a, 'static> = ()>; | ||
|
||
pub type Ty3<'s> = &'s dyn ToString; | ||
|
||
pub fn func0(_: &(dyn Fn() + '_)) {} | ||
|
||
pub fn func1<'func>(_: &(dyn Fn() + 'func)) {} | ||
|
||
pub trait Container<'r> { | ||
type Item<'a, 'ctx>; | ||
} | ||
|
||
pub trait Shape<'a> {} |
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,31 @@ | ||
#![crate_name = "user"] | ||
|
||
// aux-crate:dyn_trait=dyn_trait.rs | ||
// edition:2021 | ||
|
||
// @has user/type.Ty0.html | ||
// @has - '//*[@class="item-decl"]//code' "dyn for<'any> FnOnce(&'any str) -> bool + 'static" | ||
// FIXME(fmease): Hide default lifetime bound `'static` | ||
pub use dyn_trait::Ty0; | ||
|
||
// @has user/type.Ty1.html | ||
// @has - '//*[@class="item-decl"]//code' "dyn Display + 'obj" | ||
pub use dyn_trait::Ty1; | ||
|
||
// @has user/type.Ty2.html | ||
// @has - '//*[@class="item-decl"]//code' "dyn for<'a, 'r> Container<'r, Item<'a, 'static> = ()>" | ||
pub use dyn_trait::Ty2; | ||
|
||
// @has user/type.Ty3.html | ||
// @has - '//*[@class="item-decl"]//code' "&'s (dyn ToString + 's)" | ||
// FIXME(fmease): Hide default lifetime bound, render "&'s dyn ToString" | ||
pub use dyn_trait::Ty3; | ||
|
||
// @has user/fn.func0.html | ||
// @has - '//pre[@class="rust fn"]' "func0(_: &dyn Fn())" | ||
// FIXME(fmease): Show placeholder-lifetime bound, render "func0(_: &(dyn Fn() + '_))" | ||
pub use dyn_trait::func0; | ||
|
||
// @has user/fn.func1.html | ||
// @has - '//pre[@class="rust fn"]' "func1<'func>(_: &(dyn Fn() + 'func))" | ||
pub use dyn_trait::func1; |