zoniony / zoniony.github.io

blog
1 stars 0 forks source link

rustc: Get start #15

Open zoniony opened 4 years ago

zoniony commented 4 years ago

自备笔记 长期更新

待在家里太无聊了, std 文档不够看了, 准备开始看 rust 编译器

环境准备

How to Build and Run the Compiler就行了

gdb

ctags

rls无法处理跳转,交叉引用又是个问题

官方推荐的是用 ctags 不过这玩意太古老不太喜欢用

但是实际rls在 vsc 多屏幕勉强够用=, =

One of the challenges with rustc is that the RLS can't handle it, since it's a bootstrapping compiler. This makes code navigation difficult. One solution is to use ctags.

ctags has a long history and several variants. Exuberant Ctags seems to be quite commonly distributed but it does not have out-of-box Rust support. Some distributions seem to use Universal Ctags, which is a maintained fork and does have built-in Rust support.

The following script can be used to set up Exuberant Ctags: https://github.com/nikomatsakis/rust-etags.

ctags integrates into emacs and vim quite easily. The following can then be used to build and generate tags:

$ rust-ctags src/lib* && ./x.py build <something>

This allows you to do "jump-to-def" with whatever functions were around when you last built, which is ridiculously useful.

ICE

glacier Rustlang 奇怪的repo

专门收集ICE的地方, 这样 POC容易找了

Contributing to Glacier is fairly easy

水 pr 也是很爽的

资料

MIR

https://blog.rust-lang.org/2016/04/19/MIR.html

https://rustc-dev-guide.rust-lang.org

最重要的是代码的注释 rfc 还有 pr 时候讨论

如果还不懂的话就去讨论区水喽, 虽然感觉没啥人, 可能时差问题回复很慢,但是人都很热情.而且都是大佬 Orz