Skip to content

Update librustc README to include info on compiler process #31132

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

Merged
merged 2 commits into from
Jan 29, 2016

Conversation

gchp
Copy link
Contributor

@gchp gchp commented Jan 22, 2016

This adds the basic structure for the internals documentation, and also the initial version of the "Overview".

This first section gives and overview of the compilation process. It mentions the individual phases, and gives mention to their function & links to the relevant crates in the source tree.

This is a very general overview which is meant to lead in to the next section which will cover the driver. That section will give more in-depth information on each of the phases & cover things like sessions and the driver API. I wanted to give a more general introduction before getting into that detail.

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@gchp
Copy link
Contributor Author

gchp commented Jan 22, 2016

I expect there will be many iterations of this before it is merged, so do please let me know your comments.

Also, if you would prefer me to submit in larger chunks, rather than section by section, let me know too!

cc. @brson & @steveklabnik


Update: Rendered version of the overview

@brson brson assigned brson and unassigned alexcrichton Jan 22, 2016
@brson
Copy link
Contributor

brson commented Jan 22, 2016

Thanks @gchp. This is really cool.

This would be somewhere to direct new contributors to learn about the source code. It would need to replace.

Note that there are already files in the source tree that describe the source:

It's of varying quality, but some of the specifics are particularly good. So the compiler documentation needs to integrate all this existing material.

That's part of why I'll suggest that this particular book format is not the best format for source code documentation: it's nice to be able to browse the long-form documentation next to the source it refers to. This is especially true on github where each directory you open gives you a readme of what you are in for. Having the docs next to the source makes it easier for the devs, who need like it and maintain it, to keep it up to date, since it's part of the the corner of the product they care about and not an independent resource.

So as the format for this book I suggest we take advantage of GitHub's nice browability to unify all these internal documents into a complete experience: make them all follow consistent conventions, hyperlink them together, create entry page in src/, fill out missing information useful to newbies.

Organizationally, I suggest that this overview needs to replace librustc/README.md, while incorporating any useful information already there.

I suspect the @rust-lang/compiler team will have opinions about how the source is documented.


The Rust compiler is a complex project. Upon first inspection, it can be a
daunting task to attempt to understand all the various crates & modules, the
flow of data and the internal data structures.
Copy link
Contributor

Choose a reason for hiding this comment

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

missing an oxford comma here

@nrc
Copy link
Member

nrc commented Jan 22, 2016

I think @brson's organisational plan sounds good. I'm keen for src/librustc/README.md to be improved, in particular.

output of this phase is an abstract syntax tree (AST). The AST at this point
includes all macro uses & attributes. This means code which will be later
expanded and/or removed due to `cfg` attributes is still present in this
version of the AST. Parsing abstracts away details about individual fies which
Copy link
Contributor

Choose a reason for hiding this comment

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

s/fies/files

@steveklabnik
Copy link
Member

Before looking things over: thanks so much for spearheading this. I am pretty horrific at compiler internals because, well, I write docs all day :) This work is so, so appreciated.

@gchp
Copy link
Contributor Author

gchp commented Jan 23, 2016

@brson thanks for the feedback! I want this to be useful, so I'm happy to update this to whatever format the team feels would be best.

I'll take what I have here and integrate it with what is already in src/librustc/README.md. I'll work on adding all the other documentation into the relevant sub-folders down the line too. I imagine the whole thing will take some time, but I'll go incrementally, section by section.

Should get this PR updated shortly. I'll be sure to update with feedback from @jonas-schievink & @rphmeier too.

@gchp
Copy link
Contributor Author

gchp commented Jan 24, 2016

Ok, I've moved what I had into the README in src/librustc. Let me know your comments & I will update further.

Rendered version

@gchp gchp changed the title Scaffold internals docs & add initial overview Update librustc README to include info on compiler process Jan 24, 2016
@gchp
Copy link
Contributor Author

gchp commented Jan 27, 2016

Hey everyone, just wondering if there are any comments on this?

@steveklabnik
Copy link
Member

Mine is 👍

@gchp
Copy link
Contributor Author

gchp commented Jan 27, 2016

Thanks @steveklabnik! @brson - is this closer to what you were thinking?

@brson
Copy link
Contributor

brson commented Jan 29, 2016

@gchp Yes, this is a great start. Thank you.

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 29, 2016

📌 Commit 88d5bfd has been approved by brson

@bors
Copy link
Collaborator

bors commented Jan 29, 2016

⌛ Testing commit 88d5bfd with merge 33b73e9...

bors added a commit that referenced this pull request Jan 29, 2016
This adds the basic structure for the internals documentation, and also the initial version of the "Overview".

This first section gives and overview of the compilation process. It mentions the individual phases, and gives mention to their function & links to the relevant crates in the source tree.

This is a very general overview which is meant to lead in to the next section which will cover the `driver`. That section will give more in-depth information on each of the phases & cover things like sessions and the driver API. I wanted to give a more general introduction before getting into that detail.
@bors bors merged commit 88d5bfd into rust-lang:master Jan 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants