Comments (6)
I'd be happy to write this up but I'll probably need a little guidance because I only know how to do the second thing (find DefId
) at the moment.
from rustc-dev-guide.
I don't even know enough to know what is a common operation, but something like that would definitely be helpful. Something like a cookbook appendix...
from rustc-dev-guide.
To be honest, I was planning to use it as more of a "post questions here if Michael can't figure out how to do something seemingly simple" kind of thing.
For example, I know we do name resolution before rustc_driver
fires the after_analysis
callback, yet for the life of me I can't figure out how to get the fully qualified name for all a type. For context, I need to convert something like fn inc(a: c_int) -> c_int
into fn inc(a: ::std::os::raw::c_int) -> ::std::os::raw::c_int
.
from rustc-dev-guide.
How to get a string from a Span (e.g. for printing errors)... Use codemap.span_to_snippet(span)
from rustc-dev-guide.
How to get the parent of a defid (e.g. the module of an item): https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20get.20the.20module.20that.20an.20Item.20belongs.20to.3F
from rustc-dev-guide.
How to get an Item from a DefId: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20get.20an.20Item.20from.20a.20DefId.3F
Also, would be good to talk about def_kind
from rustc-dev-guide.
Related Issues (20)
- Instruction for creating stage0 toolchain doesn't work
- link to std-dev-guide from the landing page HOT 4
- `warning` attribute missing in diagnostics derive macro reference HOT 1
- Use ./x instead of ./x.py in documentation HOT 4
- Date Reference Triage for 2023-07 HOT 1
- Example of using rustc_interface to generate the HIR for a file referencing dependent crates?
- Some inconsistency in how-to-build-and-run.md
- Date Reference Triage for 2023-08 HOT 1
- Date Reference Triage for 2023-09 HOT 1
- Appendix B: Glossary, Update
- Link to Visitor example
- Date Reference Triage for 2023-10 HOT 1
- `shell.nix` fails to link `tests/ui/process/nofile-limit.rs` on NixOS HOT 1
- Date Reference Triage for 2023-11
- Dead links to docs (borrowcheck) HOT 2
- explain generalization when talking about type inference
- Mistake link in Overview section for MIR
- Date Reference Triage for 2023-12
- Example in "Getting diagnostic through `rustc_interface`" is outdated and meaningless
- Modifying AST
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rustc-dev-guide.