rust/src
Zack M. Davis 1081bbbfc5 abolish ICE when pretty-printing async block
Joshua Netterfield reported an ICE when the unused-parentheses lint
triggered around an async block (#54752). In order to compose an
autofixable suggestion, the lint invokes the pretty-printer on the
unnecessarily-parenthesized expression. (One wonders why the lint
doesn't just use `SourceMap::span_to_snippet` instead, to preserve the
formatting of the original source?—but for that, you'd have to ask the
author of 5c9f806d.)

But then the pretty-printer panics when trying to call `<pprust::State
as PrintState>::end` when `State.boxes` is empty. Empirically, the
problem would seem to be solved if we start some "boxes" beforehand in
the `ast::ExprKind::Async` arm of the big match in
`print_expr_outer_attr_style`, exactly like we do in the
immediately-preceding match arm for `ast::ExprKind::Block`—it would
seem pretty ("pretty") reasonable for the pretty-printing of async
blocks to work a lot like the pretty-printing of ordinary non-async
blocks, right??

Of course, it would be shamefully cargo-culty to commit code on the
basis of this kind of mere reasoning-by-analogy (in contrast to
understanding the design of the pretty-printer in such detail that the
correctness of the patch is comprehended with all the lucid certainty
of mathematical proof, rather than being merely surmised by
intuition). But maybe we care more about fixing the bug with high
probability today, than with certainty in some indefinite hypothetical
future?  Maybe the effort is worth a fifth of a shirt??

Humbly resolves #54752.
2018-10-02 23:02:51 -07:00
..
bootstrap Rollup merge of #54708 - collin5:b49475, r=Mark-Simulacrum 2018-10-01 16:13:05 +08:00
build_helper Rename sanitizer runtime libraries on OSX 2018-09-29 14:29:05 -07:00
ci Update musl to 1.1.20. 2018-09-21 17:03:13 +03:00
dlmalloc@c99638dc2e
doc docs: this llvm feature only supports the ELF object format 2018-09-26 15:25:57 +02:00
etc Revert "Auto merge of #53508 - japaric:maybe-uninit, r=RalfJung" 2018-09-29 09:50:50 +02:00
grammar
jemalloc@1f5a28755e
liballoc Rollup merge of #54544 - frewsxcv:frewsxcv-deref, r=GuillaumeGomez 2018-10-01 16:12:58 +08:00
liballoc_jemalloc Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
liballoc_system Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
libarena Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
libbacktrace@f4d02bbdbf
libcompiler_builtins@0703bfa725 Revert "renamed emit_nil to emit_unit" 2018-09-11 22:20:22 +09:00
libcore Rollup merge of #54687 - scottmcm:more-elision, r=dtolnay 2018-10-02 22:54:33 +02:00
libfmt_macros Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
libgraphviz Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
liblibc@1844a772b6 Revert "renamed emit_nil to emit_unit" 2018-09-11 22:20:22 +09:00
libpanic_abort Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
libpanic_unwind Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
libproc_macro All proc_macro_span APIs tracked at #54725 now 2018-10-01 12:15:35 -07:00
libprofiler_builtins Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc Rollup merge of #54603 - davidtwco:issue-54559, r=nikomatsakis 2018-10-02 22:54:29 +02:00
librustc_allocator Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_apfloat Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_asan Rollup merge of #54681 - alexcrichton:san-names, r=kennytm 2018-10-01 16:13:04 +08:00
librustc_borrowck Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_codegen_llvm Auto merge of #54693 - RalfJung:ctfe-scalar-pair-undef, r=oli-obk 2018-10-01 22:32:26 +00:00
librustc_codegen_utils Attempt to resolve linking issues. 2018-10-02 01:16:08 +02:00
librustc_cratesio_shim Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_data_structures Rollup merge of #54656 - nieksand:workqueue_doc, r=varkor 2018-10-01 16:13:02 +08:00
librustc_driver Re-export getopts so custom drivers can reference it. 2018-09-30 10:48:00 -05:00
librustc_errors Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_fs_util Move path2cstr to rustc_fs_util 2018-08-09 10:00:25 -06:00
librustc_incremental Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_lint Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum 2018-09-30 01:45:50 +00:00
librustc_llvm Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_lsan Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_metadata Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum 2018-09-30 01:45:50 +00:00
librustc_metadata_utils
librustc_mir Auto merge of #54767 - pietroalbini:rollup, r=pietroalbini 2018-10-02 23:29:58 +00:00
librustc_msan Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_passes do not promote comparing function pointers 2018-09-30 19:48:54 +02:00
librustc_platform_intrinsics Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_plugin Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_privacy Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum 2018-09-30 01:45:50 +00:00
librustc_resolve Auto merge of #54694 - csmoe:self_this, r=estebank 2018-10-02 01:09:36 +00:00
librustc_save_analysis Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum 2018-09-30 01:45:50 +00:00
librustc_target panic when instantiating an uninhabited type via mem::{uninitialized,zeroed} 2018-09-30 17:26:15 +02:00
librustc_traits Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum 2018-09-30 01:45:50 +00:00
librustc_tsan Rollup merge of #54681 - alexcrichton:san-names, r=kennytm 2018-10-01 16:13:04 +08:00
librustc_typeck Add crate:: to trait suggestions in Rust 2018. 2018-10-02 01:16:05 +02:00
librustdoc Attempt to resolve linking issues. 2018-10-02 01:16:08 +02:00
libserialize Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
libstd make CStr::from_bytes_with_nul_unchecked() a const fn 2018-10-02 04:26:16 -07:00
libsyntax abolish ICE when pretty-printing async block 2018-10-02 23:02:51 -07:00
libsyntax_ext Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
libsyntax_pos Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum 2018-09-30 01:45:50 +00:00
libterm Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
libtest Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
libunwind Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
llvm@caddcd9b9d Update LLVM to fix "bool" arguments on PPC32 2018-09-16 04:33:58 +08:00
llvm-emscripten@2717444753
rtstartup
rustc Update libc and activate align feature 2018-08-08 10:52:10 +02:00
rustllvm Auto merge of #54568 - levex:issue-54130, r=nagisa 2018-09-28 09:17:28 +00:00
stdsimd@05c2f61c38 Revert "renamed emit_nil to emit_unit" 2018-09-11 22:20:22 +09:00
test abolish ICE when pretty-printing async block 2018-10-02 23:02:51 -07:00
tools Rollup merge of #54648 - alexcrichton:update-cargo, r=nikomatsakis 2018-10-02 22:54:30 +02:00
.gitignore move file-extension based .gitignore down to src/ 2018-08-28 20:04:52 +02:00
Cargo.lock Rollup merge of #54648 - alexcrichton:update-cargo, r=nikomatsakis 2018-10-02 22:54:30 +02:00
Cargo.toml Use rls-data 0.18.1 2018-09-28 01:54:01 +02:00
README.md
stage0.txt Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00

This directory contains the source code of the rust project, including:

  • rustc and its tests
  • libstd
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc guide.

Their is also useful content in the following READMEs, which are gradually being moved over to the guide: