That function also takes care of converting a Scalar to a Pointer, should that be needed. Not all accesses need that though: if the access has size 0, None is returned. Everyone accessing memory based on a Scalar should use this method to get the Pointer they need. All operations on the Allocation work on Pointer inputs and expect all the checks to have happened (and will ICE if the bounds are violated). The operations on Memory work on Scalar inputs and do the checks themselves. The only other public method to check pointers is memory.ptr_may_be_null, which is needed in a few places. With this, we can make all the other methods (tests for a pointer being in-bounds and checking alignment) private helper methods, used to implement the two public methods. That maks the public API surface much easier to use and harder to mis-use. While I am at it, this also removes the assumption that the vtable part of a `dyn Trait`-fat-pointer is a `Pointer` (as opposed to a pointer cast to an integer, stored as raw bits). |
||
|---|---|---|
| .. | ||
| bootstrap | ||
| build_helper | ||
| ci | ||
| doc | ||
| etc | ||
| grammar | ||
| liballoc | ||
| libarena | ||
| libcore | ||
| libfmt_macros | ||
| libgraphviz | ||
| libpanic_abort | ||
| libpanic_unwind | ||
| libproc_macro | ||
| libprofiler_builtins | ||
| librustc | ||
| librustc_allocator | ||
| librustc_apfloat | ||
| librustc_asan | ||
| librustc_borrowck | ||
| librustc_codegen_llvm | ||
| librustc_codegen_ssa | ||
| librustc_codegen_utils | ||
| librustc_cratesio_shim | ||
| librustc_data_structures | ||
| librustc_driver | ||
| librustc_errors | ||
| librustc_fs_util | ||
| librustc_incremental | ||
| librustc_interface | ||
| librustc_lint | ||
| librustc_llvm | ||
| librustc_lsan | ||
| librustc_macros | ||
| librustc_metadata | ||
| librustc_mir | ||
| librustc_msan | ||
| librustc_passes | ||
| librustc_plugin | ||
| librustc_privacy | ||
| librustc_resolve | ||
| librustc_save_analysis | ||
| librustc_target | ||
| librustc_traits | ||
| librustc_tsan | ||
| librustc_typeck | ||
| librustdoc | ||
| libserialize | ||
| libstd | ||
| libsyntax | ||
| libsyntax_ext | ||
| libsyntax_pos | ||
| libterm | ||
| libtest | ||
| libunwind | ||
| llvm-emscripten@7f23313edf | ||
| llvm-project@1bbe0b3e1d | ||
| rtstartup | ||
| rustc | ||
| rustllvm | ||
| stdsimd@4bf456c35e | ||
| test | ||
| tools | ||
| .gitignore | ||
| README.md | ||
| stage0.txt | ||
This directory contains the source code of the rust project, including:
rustcand its testslibstd- Various submodules for tools, like rustdoc, rls, etc.
For more information on how various parts of the compiler work, see the rustc guide.
There is also useful content in the following READMEs, which are gradually being moved over to the guide:
- https://github.com/rust-lang/rust/tree/master/src/librustc/ty/query
- https://github.com/rust-lang/rust/tree/master/src/librustc/dep_graph
- https://github.com/rust-lang/rust/tree/master/src/librustc/infer/higher_ranked
- https://github.com/rust-lang/rust/tree/master/src/librustc/infer/lexical_region_resolve