Added links back to nrc's stupid-stats

This commit is contained in:
Michael Bryan 2018-03-12 19:15:26 +08:00 committed by Who? Me?!
parent 856aa3adff
commit e19b1e23b5
2 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,10 @@
# Appendix A: A tutorial on creating a drop-in replacement for rustc
> **Note:** This is a copy of `@nrc`'s amazing [stupid-stats]. You should find
> a copy of the code on the GitHub repository although due to the compiler's
> constantly evolving nature, there is no guarantee it'll compile on the first
> go.
Many tools benefit from being a drop-in replacement for a compiler. By this, I
mean that any user of the tool can use `mytool` in all the ways they would
normally use `rustc` - whether manually compiling a single file or as part of a
@ -395,4 +400,6 @@ It'd be great to see Rustdoc converted to using these APIs, if that is possible
analysis, rather than doing its own analysis). Other parts of the compiler
(e.g., pretty printing, testing) could be refactored to use these APIs
internally (I already changed save-analysis to use `CompilerController`). I've
been experimenting with a prototype rustfmt which also uses these APIs.
been experimenting with a prototype rustfmt which also uses these APIs.
[stupid-stats]: https://github.com/nrc/stupid-stats

View File

@ -39,6 +39,9 @@ compilation process
The `CompileState`'s various `state_after_*()` constructors can be inspected to
determine what bits of information are available to which callback.
For a more detailed explanation on using `rustc_driver`, check out the
[stupid-stats] guide by `@nrc` (attached as [Appendix A]).
> **Warning:** By its very nature, the internal compiler APIs are always going
> to be unstable. That said, we do try not to break things unnecessarily.
@ -68,4 +71,6 @@ thread-locals, although you should rarely need to touch it.
[`CompileState`]: https://github.com/rust-lang/rust/blob/master/src/librustc_driver/driver.rs
[`Session`]: https://github.com/rust-lang/rust/blob/master/src/librustc/session/mod.rs
[`TyCtxt`]: https://github.com/rust-lang/rust/blob/master/src/librustc/ty/context.rs
[`CodeMap`]: https://github.com/rust-lang/rust/blob/master/src/libsyntax/codemap.rs
[`CodeMap`]: https://github.com/rust-lang/rust/blob/master/src/libsyntax/codemap.rs
[stupid-stats]: https://github.com/nrc/stupid-stats
[Appendix A]: appendix-stupid-stats.html