Add lossless debug implementation for unix OsStrs
Fixes#22766
Invalid utf8 byte sequences are replaced with `\xFF` style escape codes, while valid utf8 goes through the normal `Debug` implementation.
This is necessarily different from the windows Debug implementation, which uses `\u{xxxx}` style escape sequences for unpaired surrogates, but both implementations are consistent in that they are both lossless, and display invalid sequences in the way most similar to existing language syntax.
r? @dtolnay
Add sync module to rustc_data_structures
This PR is split out from https://github.com/rust-lang/rust/pull/45912, since github apparently can't handle such large PRs.
r? @arielb1
This avoids a break in backward compatibility in the following case:
```
let ptr = std::ptr::null();
let _ = &data as *const *const ();
if data.null() {}
```
Improve error messages on LLVM bitcode parsing failure
The LLVM error causing the parse failure is now printed, in the style
of the other thin LTO error messages. This prevents a flood of
assertion failure messages if the bitcode can’t be parsed.
fix broken assertion in type_param
Nested generics (aka method generics) in trait methods don't have an
*additional* Self parameter in their own type parameter list (they have
a Self parameter in the parent generics), so don't try to check we're
correctly adjusting for it.
Fixes#46568.
r? @eddyb
This simple patch resolves#46756 (which was specifically about the case of
casts, but it would be poor form indeed to fix a reported issue without at
least a cursory attempt at answering the immortal question, "How does this bug
generalize?").
Point at var in short lived borrows instead of drop location
For RLS' sake, point at the borrow location as primary span for short lived borrows, instead of the borrow drop location.
Fix#39268.
After discussing [1] today with @pnkfelix and @Gankro,
we concluded that it’s ok for drop checking not to be much smarter
than the current `#[may_dangle]` design which requires an explicit
unsafe opt-in.
[1] https://github.com/rust-lang/rust/issues/27730#issuecomment-316432083
Loading the dependency graph in the background
Patch is a bit longer than I expected, due to the fact that most of this code relies upon a `Session` value, which is not `Sync`.
incr.comp.: Revert hashing optimization that caused regression.
This PR reverts part of #46562 which caused [a regression in the crossbeam rust-icci](https://travis-ci.org/rust-icci/crossbeam/builds/316574774) test. I don't know what the problem is exactly yet. Fortunately, the problematic part is also the less important one, so reverting should not have much impact on performance.
r? @eddyb