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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to internal rustdocs #100

Closed
4 tasks done
Michael-F-Bryan opened this issue Mar 25, 2018 · 49 comments
Closed
4 tasks done

Link to internal rustdocs #100

Michael-F-Bryan opened this issue Mar 25, 2018 · 49 comments
Labels
Easy Might be a good place for a beginner

Comments

@Michael-F-Bryan
Copy link
Contributor

Michael-F-Bryan commented Mar 25, 2018

When rust-lang/rust-central-station#40 lands we'll have a stable location which contains internal API documentation (i.e. the equivalent of ./x.py doc with crate-docs = true) 馃帀

This means when referring to a particular struct or function we'll be able too link to its API docs instead of linking to the original source file and hoping for the best.

Once that PR is merged we'll need to:

  • Update the code index to point at the API docs instead of source code
  • Emphasise linking to API docs where possible when people are contributing new content
  • Update the "contributing" section of the README appropriately (Update a few parts of the readme聽#208)
  • Update the "How to build the compiler and run what you built" to mention building docs and where they can be found online?
@mark-i-m mark-i-m added help wanted Extra attention is needed Easy Might be a good place for a beginner labels Mar 27, 2018
@rajcspsg
Copy link
Contributor

@Michael-F-Bryan - I'm new to rust. Since I see this is Easy tagged issue shall I take this issue?

@Michael-F-Bryan
Copy link
Contributor Author

Michael-F-Bryan commented Mar 30, 2018

@rajcspsg if you'd like to give it a go that's fine with me, I'm also happy to mentor or answer any questions you encounter while trying to tick this issue off 馃榿

We'll need to wait for rust-lang/rust-central-station#40 to be fully merged, but after that it should be relatively straightforward. If you subscribe to that issue, GitHub should send you notifications when it is resolved and you can get started.

@rajcspsg
Copy link
Contributor

@Michael-F-Bryan _ Thanks for mentoring me and I'm happy to take your guidance as I'm new to rust.
While we are waiting for related PR to be merged, could you please provide the file which needs to be updated with details.

@Michael-F-Bryan
Copy link
Contributor Author

Michael-F-Bryan commented Mar 31, 2018

It should mainly be a case of looking for all links to source files in the rust-lang/rust repo and replacing them with links to the corresponding API docs.

The easiest way would be to use a tool like grep or ripgrep and search for anything with https:// and .rs in it.

$ rg -e "https?://[^\s]+\.rs"

src/rustc-driver.md
70:[`rustc_driver`]: https://github.com/rust-lang/rust/tree/master/src/librustc_driver
71:[`CompileState`]: https://github.com/rust-lang/rust/blob/master/src/librustc_driver/driver.rs

...

You can see that CompileState is a reference to some struct and the link goes to src/librustc_driver/driver.rs in the rust repo. I believe the internal crate docs will be at https://doc.rust-lang.org/nightly-rustc/, so you'd go there and look for the rustc_driver::CompileState docs, then update the link appropriately.

@mark-i-m
Copy link
Member

To clarify, you are looking for links in this repo to the other repo :)

@rajcspsg
Copy link
Contributor

rajcspsg commented Apr 1, 2018

Thanks for the suggestion @mark-i-m @Michael-F-Bryan.

When I searched for here for rustc_driver::CompileState, I end up at stable page documentation of rustc_driver version 1.1.0.

I should have get the nightly documentation link instead of 1.1.0 documentation, correct?

@Michael-F-Bryan
Copy link
Contributor Author

Michael-F-Bryan commented Apr 2, 2018

@rajcspsg yes. That version of the docs looks quite outdated (TyCtxt is still called ctxt for example). I assume they manually uploaded internal docs early on and those old 1.1.0 docs are still on the Rust S3 bucket.

Now we've released 1.25 they'll be able to make progress on merging the rust-lang/rust-central-station#40 PR. We may have to wait a couple more days before the new docs are uploaded and we can link to them though.

EDIT: Looks like the PR was merged 馃帀

@mark-i-m
Copy link
Member

mark-i-m commented Apr 2, 2018

@rajcspsg IIUC, the new docs should be available tomorrow after the next nightly is released.

@mark-i-m mark-i-m removed the help wanted Extra attention is needed label Apr 2, 2018
@rajcspsg
Copy link
Contributor

rajcspsg commented Apr 2, 2018

Thanks @Michael-F-Bryan @mark-i-m.
I've 2 questions on searching the documentation.

  1. I searched for DocContext mentioned in this link using keyword rustdoc::core in DuckDuckGo and get this result. But when I searched for hir::Crate, rustc::hir, rustc::hir::mod etc I didn't get any rust documentation. Are those going to updated with tomorrow documentation release?

  2. All the links to chapter return 404 error. For example , the parser in page appendix-code-index.md returns url error. Is it need to be fixed?

@mark-i-m
Copy link
Member

mark-i-m commented Apr 2, 2018

I searched for DocContext mentioned in this link using keyword rustdoc::core in DuckDuckGo and get this result. But when I searched for hir::Crate, rustc::hir, rustc::hir::mod etc I didn't get any rust documentation. Are those going to updated with tomorrow documentation release?

Hmm... that link looks pretty outdated too. rust 1.1 was a long time ago. Tomorrow all of the docs should be up (or so I am told). They should look like normal rustdocs and should be hosted at doc.rust-lang.org/nightly/nightly-rustc

So tomorrow (hopefully) you should be able to go to doc.rust-lang.org/nightly/nightly-rustc and just use the normal rustdoc search box to find everything (hopefully).

All the links to chapter return 404 error. For example , the parser in page appendix-code-index.md returns url error. Is it need to be fixed?

Ah, they're all relative links. If you use the hosted version here the links should work. Thanks for pointing this out though.

The intent is for people to view the guide as a book (via that host version). Do you think we should fix the links so that they work on github too? It would be a bit of a tedious piece of work, but it's possible...

@rajcspsg
Copy link
Contributor

rajcspsg commented Apr 2, 2018

@mark-i-m - Sure. I will try to fix 404 errors in github as well. I will wait for a day till document release and will let you know if I need any help.

@mark-i-m
Copy link
Member

mark-i-m commented Apr 3, 2018

@rajcspsg It looks like there was a bug, which should (hopefully) be fixed for tomorrow.

@Michael-F-Bryan
Copy link
Contributor Author

@rajcspsg the documentation is now live 馃帀

@rajcspsg
Copy link
Contributor

rajcspsg commented Apr 4, 2018

Thanks @Michael-F-Bryan @mark-i-m I will work on this and submit PR.

@rajcspsg
Copy link
Contributor

rajcspsg commented Apr 4, 2018

@Michael-F-Bryan @mark-i-m

I've created PR for this documentation link. But I couldn't find link for below items.
Could you please help me.

s# FileName github Link line#
1 const-eval.md https://github.com/rust-lang/rust/blob/master/src/librustc_mir/interpret/const_eval.rs 38
2 compiletest.md https://github.com/rust-lang/rust/tree/master/src/tools/compiletest/src/runtest.rs 186
3 compiletest.md https://github.com/rust-lang/rust/tree/master/src/tools/compiletest/src/header.rs 234
4 compiletest.md https://github.com/rust-lang/rust/tree/master/src/tools/compiletest/src/common.rs 235
5 intro.md https://github.com/rust-lang/rust/tree/master/src/bootstrap/test.rs 169
6 miri.md https://github.com/rust-lang/rust/blob/master/src/librustc_mir/interpret/const_eval.rs 115
7 miri.md https://github.com/rust-lang/rust/blob/master/src/librustc_mir/interpret/step.rs 138
8 appendix-stupid-stats.md https://github.com/rust-lang/rust/tree/master/src/librustc_driver/lib.rs 114
9 traits-lowering-module.md https://github.com/rust-lang/rust/tree/master/src/test/ui/chalkify/lower_impl.rs 64
10 adding.md https://github.com/rust-lang/rust/tree/master/src/tools/compiletest/src/header.rs 166
11 adding.md https://github.com/rust-lang/rust/blob/master/src/test/ui/hello_world/main.rs 248
12 adding.md https://github.com/rust-lang/rust/blob/master/src/test/ui/transmute/main.rs 312
13 type-checking.md https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/collect.rs 42
14 method-lookup.md https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/check/method/probe.rs 41
15 method-lookup.md https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/check/method/confirm.rs 42

Also, for the missing link as we disccussed here, do I need to update github link or documenation link?

@mark-i-m
Copy link
Member

mark-i-m commented Apr 4, 2018

Thanks! Nice job :)

I've created PR for this documentation link. But I couldn't find link for below items.

Hmm... I can't find those either. I asked a followup on rust-lang/rust-central-station#40

Also, for the missing link as we disccussed here, do I need to update github link or documenation link?

Do you mean with respect to these links that you mentioned before?

All the links to chapter return 404 error. For example , the parser in page appendix-code-index.md returns url error. Is it need to be fixed?

These should be links to hosted version of the rustc guide itself. I don't think we were expecting anyone to use the github interface to view the book. I'm not sure if we want to make these links absolute or leave them relative as they are... I opened #109 to deal with that; for now, let's leave them as-is.

@mark-i-m
Copy link
Member

mark-i-m commented Apr 4, 2018

Also, I will try to look at the PR soon

@mark-i-m
Copy link
Member

mark-i-m commented Apr 4, 2018

Ok, that was fast.

The reason those items you listed are not in the hosted docs is that they are private, whereas rustdoc generates documentation for only public items by default. There is active discussion on generating docs for these private items in rust-lang/rust#29893.

@rajcspsg
Copy link
Contributor

rajcspsg commented Apr 4, 2018

sure Thanks @mark-i-m !!!

@mark-i-m
Copy link
Member

mark-i-m commented Apr 6, 2018

@rajcspsg I merged your PR :)

It appears that private modules are now documented, so I think you should be able to find the remaining items. Are you still interested in working on this?

@rajcspsg
Copy link
Contributor

rajcspsg commented Apr 6, 2018

@mark-i-m
Thanks for accepting my PR :)
sure I will work on the pending items tonight and submit PR.
I will should be able to find remaining items in same nightly documentation search as others, correct?

@mark-i-m
Copy link
Member

mark-i-m commented Apr 6, 2018

I will should be able to find remaining items in same nightly documentation search as others, correct?

That's right

@mark-i-m
Copy link
Member

mark-i-m commented Apr 7, 2018

Thanks :)

I think anything in src/tools is not part of the compiler proper, so it will not be documented. Likewise, anything in src/test is a test, rather than part of the compiler itself, so those will not be documented either. I think we can leave these links for now.

For (5), I think we can use the following link: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/index.html

@rajcspsg
Copy link
Contributor

rajcspsg commented Apr 7, 2018

@mark-i-m - I've updated the documentation link for https://github.com/rust-lang/rust/tree/master/src/librustc_driver/lib.rs in the PR.

@rajcspsg
Copy link
Contributor

@mark-i-m @Michael-F-Bryan I think still 2 below items are yet to completed in this issue, correct?
Update the "contributing" section of the README appropriately
Update the "How to build the compiler and run what you built" to mention building docs and where they can be found online?

@mark-i-m
Copy link
Member

@rajcspsg Yes, that's correct

@rajcspsg
Copy link
Contributor

@mark-i-m i may need some pointers to start with. What should be updated in contributing section?

@mark-i-m
Copy link
Member

Perhaps we can start a "Contributor Tips" section at the end? The first tip can be something like "Whenever referring to a part of the rustc source code, please add a link to the rustc rustdocs. Since these links are checked, it will help us discover when something in the compiler changes and the guide needs to be updated."

@mark-i-m
Copy link
Member

@Michael-F-Bryan did you have something specific in mind?

@mark-i-m
Copy link
Member

mark-i-m commented May 8, 2018

Ping @Michael-F-Bryan ^^^

@Michael-F-Bryan
Copy link
Contributor Author

Oops, looks like I missed this somehow!

@Michael-F-Bryan did you have something specific in mind?

I was just thinking we should mention in the contributor guide that the internal API docs are available online and to link to them where possible. The comment you made sounds pretty good.

Whenever referring to a part of the rustc source code, please add a link to the rustc rustdocs. Since these links are checked, it will help us discover when something in the compiler changes and the guide needs to be updated.

@mark-i-m
Copy link
Member

mark-i-m commented Jun 4, 2018

Ping @rajcspsg Are you still interested in working on this?

@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 4, 2018

I actually have had a lot of trouble looking for the API docs of rustc (are they linked from anywhere? I couldn't easily find it), they should at least be linked in the readme, or have a section somewhere with a link to the docs. FWIW, this is the link: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/

@mark-i-m
Copy link
Member

mark-i-m commented Jul 4, 2018

I agree. The docs are surprisingly hard to Google.

@nikomatsakis
Copy link
Contributor

Wow, there are a lot of comments here. I recently opened up #189, which added links to the rustdoc for the HIR section. I was thinking we should open a fresh issue (this one is perhaps too cluttered) and make it into a "quest issue". Basically, make a checklist of modules that need work, and issue out a call to try to get people involved. Seems like a nice "starter point". But maybe that's not necessary, even?

@rajcspsg
Copy link
Contributor

@nikomatsakis @mark-i-m Hello guys. I'm really sorry that I'm out for a while due to few personal commitments. I think it would be good to open new issue for pending things for this PR.

@mark-i-m
Copy link
Member

I'll try to curate such a list and open a new issue sometime soon. I'm not sure if I will have time today, though. I will post back here soon.

@rajcspsg
Copy link
Contributor

rajcspsg commented Oct 5, 2018

@mark-i-m does this PR #195 covers point 4 this is issue?

@mark-i-m
Copy link
Member

mark-i-m commented Oct 5, 2018

Hmm... do we ever mention where they can be found? (https://doc.rust-lang.org/nightly/nightly-rustc/rustc/)

Sorry for the delay on this. I have been pretty swamped for the past few weeks (and will probably continue to be swamped until at least Oct 12)... I appreciate your patience!

@mark-i-m
Copy link
Member

Ok, so I opened #209 to track the links @rajcspsg mentioned in #100 (comment). I'm not really sure how to make progress there TBH, but I don't want to lose the list of links.

I also opened #208 to update the readme, as per the checklist in the OP. @Michael-F-Bryan @rajcspsg let me know what you think.

@rajcspsg I think the only thing left here is to update the intro section of the guide itself with a note and link to the compiler rustdocs.

@rajcspsg
Copy link
Contributor

@mark-i-m shall we mark How to build the compiler and run what you built section done.

@mark-i-m
Copy link
Member

Hmm... do we ever mention where they can be found? (https://doc.rust-lang.org/nightly/nightly-rustc/rustc/)

@rajcspsg
Copy link
Contributor

@mark-i-m I will update and send PR for that. I have a question.
Which file I have to update compiler-documenting.md or how-to-build-and-run.md.
Looks to me compiler documenting is correct place?

@mark-i-m
Copy link
Member

Perhaps both? compiler-documenting seems like a logical place, but I would also like the link to be highly-visible, since they are really useful.

@mark-i-m
Copy link
Member

Hooray! 馃帀 This is done 馃槃

Nice job @rajcspsg! This is a major improvement to the guide!

@rajcspsg
Copy link
Contributor

Thanks @mark-i-m for accepting my PR :)

@lf-
Copy link
Contributor

lf- commented Aug 3, 2021

This issue is high in the Google results for "rustc internal rustdoc" and the link above doesn't work. This one does though: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/

@jyn514
Copy link
Member

jyn514 commented Aug 3, 2021

https://doc.rust-lang.org/nightly/nightly-rustc/ is the URL that will continue to work even if crates are renamed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy Might be a good place for a beginner
Projects
None yet
Development

No branches or pull requests

7 participants