Use expect for current_dir on librustc/session mod
Reference bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=871638
Like described on the reference bug report:
~~~
$ mkdir dir
$ cd dir
$ rm -rf ../dir
$ RUST_BACKTRACE=1 rustc -C target-cpu=help
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 2, message: "No such file or directory" } }', src/libcore/result.rs:837
stack backtrace:
1: 0x7f7d23970dda - <unknown>
2: 0x7f7d2398305f - <unknown>
3: 0x7f7d2397f8a5 - <unknown>
4: 0x7f7d2397ffc7 - std::panicking::rust_panic_with_hook::h109e116a3a861224
5: 0x7f7d2397fe54 - <unknown>
6: 0x7f7d2397fd79 - std::panicking::begin_panic_fmt::h26713cea9bce3ab0
7: 0x7f7d2397fd07 - rust_begin_unwind
8: 0x7f7d239cb41d - core::panicking::panic_fmt::hcfbb59eeb7f27f75
9: 0x7f7d20be63d3 - <unknown>
10: 0x7f7d20d6ebcc - rustc::session::build_session_::h7a3559f2373a5d05
11: 0x7f7d20d6dd7e - rustc::session::build_session_with_codemap::h68bc7bcd2f34eee4
12: 0x7f7d20d6d72c - rustc::session::build_session::h437fda3c327a8bde
13: 0x7f7d23d26030 - <rustc_driver::RustcDefaultCalls as rustc_driver::CompilerCalls<'a>>::no_input::h8047df7741757d1c
14: 0x7f7d23d21d27 - rustc_driver::run_compiler::hafe7bbfedf95a825
15: 0x7f7d23c57378 - <unknown>
16: 0x7f7d2398ae0a - __rust_maybe_catch_panic
17: 0x7f7d23c76fa8 - <unknown>
18: 0x7f7d2397eb74 - <unknown>
19: 0x7f7d1ed4f493 - start_thread
20: 0x7f7d23645afe - __clone
21: 0x0 - <unknown>
~~~
With this patch this will give instead:
~~~
error: Current directory is invalid: No such file or directory (os error 2)
~~~
Improve diagnostics when list of tokens has incorrect separators
Make `parse_seq_to_before_tokens` more resilient to error conditions. Where possible it is better if it can consume up to the final bracket before returning. This change improves the diagnostics in a couple of situations:
```
struct S(pub () ()); // omitted separator
use std::{foo. bar}; // used a similar but wrong separator
```
Fixes#44339
r? @petrochenkov
Bump to 1.23 and update bootstrap
This commit updates the bootstrap compiler, bumps the version to 1.23, updates
Cargo, updates books, and updates crates.io dependencies
Don't fail to build a manifest if a tarball is missing
This is guesswork because I can't test build_manifest nor do I know what is actually causing the error to begin with. My hypothesis is that when we try to find the version from the RLS tarball and the tarball is not there, then we panic. I attempt to fix this by making the version string optional, then not adding the RLS package, rename, and extension component if the version is missing.
In theory, this should fix the broken nightlies.
r? @alexcrichton
std: Optimize thread park/unpark implementation
This is an adaptation of alexcrichton/futures-rs#597 for the standard library.
The goal here is to avoid locking a mutex on the "fast path" for thread
park/unpark where you're waking up a thread that isn't sleeping or otherwise
trying to park a thread that's already been notified. Mutex performance varies
quite a bit across platforms so this should provide a nice consistent speed
boost for the fast path of these functions.
std: Disable usage of mmap allocator in libbacktrace
This is sort of a long overdue change from the investigation in #29293
and #37477. The released binaries of rustc don't have debug information and so
don't actively suffer this problem but this can hit local development of rustc
and also larger programs compiled against libstd generating backtraces.
The main purpose of the mmap allocator in libacktrace is to be usable from a
signal handler, but we don't do that, so the normal allocator using malloc/free
should work well for us.
Don't emit the same compiler diagnostic twice.
This PR makes the compiler filter out diagnostic messages that have already been emitted during the same compilation session.
Avoid unnecessary copies of arguments that are simple bindings
Initially MIR differentiated between arguments and locals, which
introduced a need to add extra copies assigning the argument to a
local, even for simple bindings. This differentiation no longer exists,
but we're still creating those copies, bloating the MIR and LLVM IR we
emit.
Additionally, the current approach means that we create debug info for
both the incoming argument (marking it as an argument), and then
immediately shadow it a local that goes by the same name. This can be
confusing when using e.g. "info args" in gdb, or when e.g. a debugger
with a GUI displays the function arguments separately from the local
variables, especially when the binding is mutable, because the argument
doesn't change, while the local variable does.
Initially MIR differentiated between arguments and locals, which
introduced a need to add extra copies assigning the argument to a
local, even for simple bindings. This differentiation no longer exists,
but we're still creating those copies, bloating the MIR and LLVM IR we
emit.
Additionally, the current approach means that we create debug info for
both the incoming argument (marking it as an argument), and then
immediately shadow it a local that goes by the same name. This can be
confusing when using e.g. "info args" in gdb, or when e.g. a debugger
with a GUI displays the function arguments separately from the local
variables, especially when the binding is mutable, because the argument
doesn't change, while the local variable does.
Update rls-data for save analysis
rls-data: 0.10 -> 0.11
This will allow for more fine-grained save analysis for enum variants (tuple and struct).
The first commit updates rls-data, and makes the changes to dump_visitor. The second commit updates the rls submodule, and removes "members" that were deleted from that update in src/Cargo.toml.
Note, that when building the project, rustfmt-nightly was updated in Cargo.lock. If these changes should be excluded, I can revert it.
cc/ @nrc
rustbuild: Fix `no output generated` error for next bootstrap cargo.
Due to rust-lang/cargo#4570, a `*.dll.lib` file is uplifted when building dynamic libraries on Windows. The current bootstrap code does not understand files with multiple extensions, and will instead assume `xxxx.dll` is the file name. This caused a `no output generated` error because it tries to search for `xxxx.dll-hash.lib` inside the `deps/` folder, while it should check for `xxxx-hash.dll.lib` instead.
This PR is blocking #45285, see https://github.com/rust-lang/rust/pull/45285#issuecomment-338454149 and the rest of the comments for detail.
Implement Hash for raw pointers to unsized types
This is useful for some niche cases, like a hash table of slices or trait objects where the key is the raw pointer. Example use case: https://docs.rs/by_address
Correct misspelling in error text: re-assignment => reassignment
[reassignment is the correct spelling](https://www.thefreedictionary.com/reassignment) rather than re-assignment; this error message looks silly in the book next to text trying to be grammatically correct :-/
Will this cause any stability/backcompat type issues?
This is an adaptation of alexcrichton/futures-rs#597 for the standard library.
The goal here is to avoid locking a mutex on the "fast path" for thread
park/unpark where you're waking up a thread that isn't sleeping or otherwise
trying to park a thread that's already been notified. Mutex performance varies
quite a bit across platforms so this should provide a nice consistent speed
boost for the fast path of these functions.
This is sort of a long overdue change from the investigation in #29293
and #37477. The released binaries of rustc don't have debug information and so
don't actively suffer this problem but this can hit local development of rustc
and also larger programs compiled against libstd generating backtraces.
The main purpose of the mmap allocator in libacktrace is to be usable from a
signal handler, but we don't do that, so the normal allocator using malloc/free
should work well for us.