-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustdoc: various cross-crate reexport fixes #103885
Merged
bors
merged 7 commits into
rust-lang:master
from
fmease:rustdoc-various-cross-crate-reexport-fixes
Nov 7, 2022
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5965af7
rustdoc: render late-bound lifetimes in generic parameter list of cro…
fmease 9cdab67
rustdoc: render unnamed arguments as underscores in cross-crate funct…
fmease 2d9755f
rustdoc: move cross-crate lifetime/outlives bounds on GAT params from…
fmease 1ac7034
rustdoc: render `for<>` param lists of cross-crate trait-object types
fmease 71561f8
rustdoc: render the return type of cross-crate `Fn`-family trait boun…
fmease 7ec50b6
rustdoc: add test for cross-crate trait-object types
fmease 5ccaed2
rustdoc: create helper `GenericParamDef::lifetime`
fmease File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an object lifetime default query, so you can just test equality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I am aware of the existence of
tcx.object_lifetime_default
but it's not the whole solution to the problem, it's only part of it.The query doesn't take a
Region
, it takes theDefId
of a type parameter of an item, e.g. theT
ofBox
. Anyways, that's all fine and good and explained in the linked Zulip topic. I'd really prefer to implement that in a follow-up PR to avoid bitrotting, to make reviewing easier and since that logic will be a little bit more complicated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so regarding trait-object-type lifetime-bound defaults, my local work-in-progress patch is currently +168/-43 in size and it's not as straightforward as this PR meaning I won't add it to it.