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

Display elided lifetime for non-reference type in doc #75237

Merged
merged 3 commits into from
Aug 8, 2020

Conversation

nbdd0121
Copy link
Contributor

@nbdd0121 nbdd0121 commented Aug 6, 2020

In edition 2018 we encourage writing <'_> explicitly, so rustdoc should display like such as well.

Fixes #75225

Somehow when I run the compiled rustdoc using cargo +stage2 doc on other crates, it correctly produces <'_>, but I couldn't get the std doc to do the same with ./x.py doc --stage 2. Might this be related to the recent change to x.py about how the doc is built?

@rust-highfive
Copy link
Collaborator

r? @ollie27

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 6, 2020
@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Aug 7, 2020
@jyn514
Copy link
Member

jyn514 commented Aug 7, 2020

Might this be related to the recent change to x.py about how the doc is built?

#73964 only changed the defaults, so if you used --stage 1 or --stage 2 it should have picked up the changes. That's weird they're not showing up ... Did you try doc --stage 2 library/std? This might have gotten hit by #73265.

Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes themselves look great :)

@nbdd0121
Copy link
Contributor Author

nbdd0121 commented Aug 7, 2020

Did you try doc --stage 2 library/std?

That doesn't work either. I am totally confused now.

@nbdd0121
Copy link
Contributor Author

nbdd0121 commented Aug 7, 2020

Okay, it seems that I misunderstood the issue. It seems that the actual issue that imported docs still follow the old style, while items defined within the module follow the new style. So this PR works for core::cell::RefCell::borrow, alloc::vec::Vec::drain, std::sync::Mutex::lock, but not std::vec::Vec::drain or std::cell::RefCell::borrow. There must be something that I have missed.

@jyn514
Copy link
Member

jyn514 commented Aug 7, 2020

Try modifying this too:

GenericArgKind::Lifetime(lt) => lt.clean(cx).map(GenericArg::Lifetime),

@nbdd0121
Copy link
Contributor Author

nbdd0121 commented Aug 7, 2020

Try modifying this too:

GenericArgKind::Lifetime(lt) => lt.clean(cx).map(GenericArg::Lifetime),

Just discovered this myself 😂. Thanks anyway.

@jyn514
Copy link
Member

jyn514 commented Aug 7, 2020

Can you also add a test case for this on cross-crate item?

@nbdd0121
Copy link
Contributor Author

nbdd0121 commented Aug 7, 2020

Can you also add a test case for this on cross-crate item?

test5 and test6 are cross-crate.

@jyn514
Copy link
Member

jyn514 commented Aug 7, 2020

Oh I see, it doesn't have to do with re-exports, only with the original crate of the item.

@bors r+

@bors
Copy link
Contributor

bors commented Aug 7, 2020

📌 Commit 505d157 has been approved by jyn514

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 7, 2020
@nbdd0121
Copy link
Contributor Author

nbdd0121 commented Aug 7, 2020

Oh sorry, it seems that it doesn't catch the case. Let me add a proper test for the re-export scenario.

@jyn514
Copy link
Member

jyn514 commented Aug 7, 2020

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 7, 2020
@jyn514
Copy link
Member

jyn514 commented Aug 8, 2020

Yeah, that looks like about the test case I expected.

@bors r+

@bors
Copy link
Contributor

bors commented Aug 8, 2020

📌 Commit 541fbbb has been approved by jyn514

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 8, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 8, 2020
Rollup of 7 pull requests

Successful merges:

 - rust-lang#75224 (Don't call a function in function-arguments-naked.rs)
 - rust-lang#75237 (Display elided lifetime for non-reference type in doc)
 - rust-lang#75250 (make MaybeUninit::as_(mut_)ptr const)
 - rust-lang#75253 (clean up const-hacks in int endianess conversion functions)
 - rust-lang#75259 (Add missing backtick)
 - rust-lang#75267 (Small cleanup)
 - rust-lang#75270 (fix a couple of clippy findings)

Failed merges:

r? @ghost
@bors bors merged commit 255434d into rust-lang:master Aug 8, 2020
@nbdd0121 nbdd0121 deleted the rustdoc branch September 4, 2021 02:55
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustdoc doesn't show explicit elided lifetimes in function signatures
6 participants