Skip to content
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

Rollup of 8 pull requests #109303

Merged
merged 22 commits into from
Mar 18, 2023
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
75563cd
Error code E0794 for late-bound lifetime parameter error.
czzrr Jan 27, 2023
27b430b
Tweak implementation of overflow checking assertions
tmiasko Mar 16, 2023
c7cc1c7
Fix generics mismatch errors for RPITITs on -Zlower-impl-trait-in-tra…
spastorino Mar 16, 2023
ae7fa1d
Add generic parameters mismatch test for async in traits
spastorino Mar 16, 2023
e0302bb
Add revisions for -Zlower-impl-trait-in-trait-to-assoc-ty fixed tests
spastorino Mar 16, 2023
8628e27
rustdoc: reduce allocations in `visibility_to_src_with_space`
notriddle Mar 17, 2023
3508879
Use `size_of_val` instead of manual calculation
scottmcm Mar 18, 2023
a3f3db8
Stabilise `unix_socket_abstract`
jmillikin Mar 18, 2023
c76e260
Use named threads in tidy
jyn514 Mar 5, 2023
9b606a3
Speed up file walking in tidy
jyn514 Mar 5, 2023
d26a155
Make `ui_tests` non-quadratic
jyn514 Mar 5, 2023
19b272a
Use a single WalkBuilder for multiple paths
jyn514 Mar 5, 2023
3a58b2b
Let tidy use more threads
jyn514 Mar 5, 2023
675c4aa
address review comments
jyn514 Mar 18, 2023
9599f3c
Rollup merge of #107416 - czzrr:issue-80618, r=GuillaumeGomez
matthiaskrgr Mar 18, 2023
7ebf2cd
Rollup merge of #108772 - jyn514:faster-tidy, r=the8472
matthiaskrgr Mar 18, 2023
a79925d
Rollup merge of #109193 - spastorino:new-rpitit-11, r=compiler-errors
matthiaskrgr Mar 18, 2023
a48d83d
Rollup merge of #109234 - tmiasko:overflow-checks, r=cjgillot
matthiaskrgr Mar 18, 2023
8417c93
Rollup merge of #109238 - spastorino:new-rpitit-12, r=compiler-errors
matthiaskrgr Mar 18, 2023
e81a072
Rollup merge of #109283 - notriddle:notriddle/visibility-to-src-with-…
matthiaskrgr Mar 18, 2023
0aa0043
Rollup merge of #109287 - scottmcm:hash-slice-size-of-val, r=oli-obk
matthiaskrgr Mar 18, 2023
49a1528
Rollup merge of #109288 - jmillikin:linux-abstract-socket-addr, r=jos…
matthiaskrgr Mar 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rustdoc: reduce allocations in visibility_to_src_with_space
  • Loading branch information
notriddle committed Mar 17, 2023
commit 8628e27da34f8b64ce4a02a6f2e74a6c4016612f
14 changes: 7 additions & 7 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1502,27 +1502,27 @@ pub(crate) fn visibility_to_src_with_space<'a, 'tcx: 'a>(
tcx: TyCtxt<'tcx>,
item_did: DefId,
) -> impl fmt::Display + 'a + Captures<'tcx> {
let to_print = match visibility {
None => String::new(),
Some(ty::Visibility::Public) => "pub ".to_owned(),
let to_print: Cow<'static, str> = match visibility {
None => "".into(),
Some(ty::Visibility::Public) => "pub ".into(),
Some(ty::Visibility::Restricted(vis_did)) => {
// FIXME(camelid): This may not work correctly if `item_did` is a module.
// However, rustdoc currently never displays a module's
// visibility, so it shouldn't matter.
let parent_module = find_nearest_parent_module(tcx, item_did);

if vis_did.is_crate_root() {
"pub(crate) ".to_owned()
"pub(crate) ".into()
} else if parent_module == Some(vis_did) {
// `pub(in foo)` where `foo` is the parent module
// is the same as no visibility modifier
String::new()
"".into()
} else if parent_module.and_then(|parent| find_nearest_parent_module(tcx, parent))
== Some(vis_did)
{
"pub(super) ".to_owned()
"pub(super) ".into()
} else {
format!("pub(in {}) ", tcx.def_path_str(vis_did))
format!("pub(in {}) ", tcx.def_path_str(vis_did)).into()
}
}
};
Expand Down