-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 #103885 - fmease:rustdoc-various-cross-crate-reexport…
…-fixes, r=cjgillot,GuillaumeGomez rustdoc: various cross-crate reexport fixes Fixes for various smaller cross-crate reexport issues. The PR is split into several commits for easier review. Will be squashed after approval. Most notable changes: * We finally render late-bound lifetimes in the generic parameter list of cross-crate functions & methods. Previously, we would display the re-export of `pub fn f<'s>(x: &'s str) {}` as `pub fn f(x: &'s str)` * We now render unnamed parameters of cross-crate functions and function pointers as underscores since that's exactly what we do for local definitions, too. Mentioned as a bug in #44306. * From now on, the rendering of cross-crate trait-object types is more correct: * `for<>` parameter lists (for higher-ranked lifetimes) are now shown * the return type of `Fn{,Mut,Once}` trait bounds is now displayed Regarding the last list item, here is a diff for visualization (before vs. after): ```patch - dyn FnOnce(&'any str) + 'static + dyn for<'any> FnOnce(&'any str) -> bool + 'static ``` The redundant `+ 'static` will be removed in a follow-up PR that will hide trait-object lifetime-bounds if they coincide with [their default](https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes) (see [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/clean_middle_ty.3A.20I.20need.20to.20add.20a.20parameter/near/307143097)). `FIXME(fmease)`s were added. ``@rustbot`` label A-cross-crate-reexports r? ``@GuillaumeGomez``
- Loading branch information
Showing
14 changed files
with
148 additions
and
51 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
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
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
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 |
---|---|---|
|
@@ -42,5 +42,5 @@ pub trait Helper { | |
} | ||
|
||
pub trait Aid<'src> { | ||
type Result<'inter>; | ||
type Result<'inter: 'src>; | ||
} |
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; |
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