rust/src
Pietro Albini f13d16621e
Rollup merge of #55962 - QuietMisdreavus:tricky-spans, r=GuillaumeGomez
rustdoc: properly calculate spans for intra-doc link resolution errors

Fixes https://github.com/rust-lang/rust/issues/55723

When rustdoc is reporting a resolution error for intra-doc links, it needs to convert a span from one relative to the *markdown* (as the links are only found on the final markdown text) to one relative to the *source code* (as the error reporting is meant to show where the line is in the source, so the user can fix it). However, a calculation for how much "offset" to apply had a subtle error: it trimmed the whole line when attempting to account for leading indentation. This caused it to add in *trailing* whitespace into this calculation, which created an incorrect span.

In a lot of situations, this isn't a problem - the span will be shifted in the code slightly, but the warning will still be displayed and mostly legible. However, there is one important situation where this can cause an ICE: multi-byte codepoints. If a shifted span now has a starting point in the middle of a multi-byte codepoint, libsyntax will panic when trying to track what source item it corresponds to. This flew under our radar because trailing whitespace and multi-byte codepoints are both situations that we don't run into in the compiler repo.

(There is one more situation where this can error, that will be much harder to fix: block-style doc comments. Lines in a block-style doc comment have a zero-or-more (usually one) character offset per line, causing this calculation to be way off. I'm punting that to another issue, though...)
2018-11-19 22:06:22 +08:00
..
bootstrap Rollup merge of #55867 - RalfJung:dont-panic, r=Mark-Simulacrum 2018-11-18 23:24:38 +01:00
build_helper Prefer unwrap_or_else to unwrap_or in case of function calls/allocations 2018-10-19 09:45:45 +02:00
ci Update CI-clang to 7.0.0 for Linux dists. 2018-11-14 17:42:06 +01:00
dlmalloc@c99638dc2e
doc don't inline pub use some_crate unless directly asked to 2018-11-09 09:07:57 -06:00
etc Fix typos. 2018-11-11 20:52:36 +07:00
grammar
liballoc Rollup merge of #55901 - euclio:speling, r=petrochenkov 2018-11-15 11:04:42 +01:00
libarena Update TypedArena tests 2018-10-19 14:34:44 +02:00
libbacktrace@f4d02bbdbf
libcompiler_builtins@939cbca6e9 Update compiler-builtins submodule 2018-10-30 10:51:55 -07:00
libcore Rollup merge of #55919 - Turbo87:num-tests, r=dtolnay 2018-11-18 23:24:42 +01:00
libfmt_macros remove padding from multiline format string label 2018-10-03 14:29:39 -04:00
libgraphviz Remove graphviz::IntoCow 2018-10-05 14:16:10 +02:00
liblibc@c75ca6465a Revert liblibc submodule url 2018-10-18 16:54:43 +02:00
libpanic_abort wasm32-unknown-emscripten expects the rust_eh_personality symbol 2018-11-08 03:27:45 +01:00
libpanic_unwind refactor: use shorthand fields 2018-11-06 15:05:44 -05:00
libproc_macro fix various typos in doc comments 2018-11-13 14:45:31 -05: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 #55953 - blitzerr:master, r=nikomatsakis 2018-11-19 22:06:20 +08:00
librustc_allocator Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
librustc_apfloat Fix typos. 2018-11-11 20:52:36 +07:00
librustc_asan std: Delete the alloc_system crate 2018-11-11 09:22:28 -08:00
librustc_borrowck capture_disjoint_fields(rust-lang#53488) 2018-11-14 21:18:48 -08:00
librustc_codegen_llvm [eddyb] rustc_codegen_llvm: remove unused parametrization of CodegenCx and Builder over Values. 2018-11-16 15:08:18 +02:00
librustc_codegen_ssa [eddyb] rustc_codegen_llvm: remove unused parametrization of CodegenCx and Builder over Values. 2018-11-16 15:08:18 +02:00
librustc_codegen_utils [eddyb] rustc_codegen_utils: remove extraneous #![allow(dead_code)]. 2018-11-16 15:08:18 +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 remove unused dependency 2018-11-16 08:46:15 +01:00
librustc_driver Rollup merge of #55901 - euclio:speling, r=petrochenkov 2018-11-15 11:04:42 +01:00
librustc_errors rustc: Request ansi colors if stderr isn't a tty 2018-11-08 07:53:03 -08:00
librustc_fs_util
librustc_incremental Rollup merge of #55901 - euclio:speling, r=petrochenkov 2018-11-15 11:04:42 +01:00
librustc_lint Rollup merge of #55901 - euclio:speling, r=petrochenkov 2018-11-15 11:04:42 +01:00
librustc_llvm Revert "rustc: Fix (again) simd vectors by-val in ABI" 2018-10-23 00:59:14 -07:00
librustc_lsan std: Delete the alloc_system crate 2018-11-11 09:22:28 -08:00
librustc_metadata Rollup merge of #55778 - nnethercote:LrcPreds, r=eddyb 2018-11-15 11:04:36 +01:00
librustc_mir Rollup merge of #55953 - blitzerr:master, r=nikomatsakis 2018-11-19 22:06:20 +08:00
librustc_msan std: Delete the alloc_system crate 2018-11-11 09:22:28 -08:00
librustc_passes Rollup merge of #55901 - euclio:speling, r=petrochenkov 2018-11-15 11:04:42 +01: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 Deprecate the FxHashMap() and FxHashSet() constructor function hack 2018-10-19 14:34:44 +02:00
librustc_resolve Make NodeId a newtype_index to enable niche optimizations 2018-11-12 10:29:53 +01:00
librustc_save_analysis Auto merge of #55936 - nrc:save-rename, r=eddyb 2018-11-16 21:11:24 +00:00
librustc_target Add powerpc64-unknown-linux-musl target 2018-11-15 13:43:31 +00:00
librustc_traits Rollup merge of #55778 - nnethercote:LrcPreds, r=eddyb 2018-11-15 11:04:36 +01:00
librustc_tsan std: Delete the alloc_system crate 2018-11-11 09:22:28 -08:00
librustc_typeck Rollup merge of #55953 - blitzerr:master, r=nikomatsakis 2018-11-19 22:06:20 +08:00
librustdoc Rollup merge of #55962 - QuietMisdreavus:tricky-spans, r=GuillaumeGomez 2018-11-19 22:06:22 +08:00
libserialize A few tweaks to iterations/collecting 2018-11-13 08:42:48 +01:00
libstd std: Add debugging for a failing test on appveyor 2018-11-17 19:38:53 -08:00
libsyntax Rollup merge of #55901 - euclio:speling, r=petrochenkov 2018-11-15 11:04:42 +01:00
libsyntax_ext Rollup merge of #55923 - Zeegomo:master, r=estebank 2018-11-18 23:24:43 +01:00
libsyntax_pos Rename other occs of (Code/File)Map to Source(Map/File) #51574 2018-10-29 21:26:13 +01:00
libterm Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
libtest add option to libtest to run all tests 2018-10-14 00:58:17 +02:00
libunwind Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
llvm@7051ead40a Fix DWARF generation for enums 2018-10-30 12:06:07 -06:00
llvm-emscripten@7f23313edf Pull in fix for dist-i686-linux build 2018-11-09 16:59:45 +01:00
rtstartup
rustc Use jemalloc-sys on Linux and OSX compilers 2018-11-02 06:52:56 -07:00
rustllvm Auto merge of #55698 - nikic:remove-llvm-4-support, r=alexcrichton 2018-11-11 22:38:54 +00:00
stdsimd@0309be1ade Update stdsimd 2018-11-02 14:58:53 +01:00
test Rollup merge of #55962 - QuietMisdreavus:tricky-spans, r=GuillaumeGomez 2018-11-19 22:06:22 +08:00
tools Update Cargo submodule 2018-11-17 00:53:31 -08:00
.gitignore
Cargo.lock Rollup merge of #55857 - andjo403:rmdep, r=Mark-Simulacrum 2018-11-18 23:24:36 +01:00
Cargo.toml Use rls-data 0.18.1 2018-09-28 01:54:01 +02:00
README.md Fix their/there grammar nit 2018-11-12 18:21:52 -08:00
stage0.txt Bump nightly to 1.32.0 2018-10-31 11:53:50 -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.

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