Allocator integration
Lets start getting some feedback on `trait Alloc`.
Here is:
* the `trait Alloc` itself,
* the `struct Layout` and `enum AllocErr` that its API relies on
* a `struct HeapAlloc` that exposes the system allocator as an instance of `Alloc`
* an integration of `Alloc` with `RawVec`
* ~~an integration of `Alloc` with `Vec`~~
TODO
* [x] split `fn realloc_in_place` into `grow` and `shrink` variants
* [x] add `# Unsafety` and `# Errors` sections to documentation for all relevant methods
* [x] remove `Vec` integration with `Allocator`
* [x] add `allocate_zeroed` impl to `HeapAllocator`
* [x] remove typedefs e.g. `type Size = usize;`
* [x] impl `trait Error` for all error types in PR
* [x] make `Layout::from_size_align` public
* [x] clarify docs of `fn padding_needed_for`.
* [x] revise `Layout` constructors to ensure that [size+align combination is valid](https://github.com/rust-lang/rust/pull/42313#issuecomment-306845446)
* [x] resolve mismatch re requirements of align on dealloc. See [comment](https://github.com/rust-lang/rust/pull/42313#issuecomment-306202489).
MIR EndRegion Statements (was MIR dataflow for Borrows)
This PR adds an `EndRegion` statement to MIR (where the `EndRegion` statement is what terminates a borrow).
An earlier version of the PR implemented a dataflow analysis on borrow expressions, but I am now factoring that into a follow-up PR so that reviewing this one is easier. (And also because there are some revisions I want to make to that dataflow code, but I want this PR to get out of WIP status...)
This is a baby step towards MIR borrowck. I just want to get the review process going while I independently work on the remaining steps.
rustc: Check if def_path_hash_to_def_id is populated before accessing.
Without this patch, there is an ICE when running rustc with
RUST_LOG=debug. This patch updates extract_def_id to check if the map
has been populated before accessing it. This fixes the problem, but
maybe we do not need to compute the incremental hashes maps in the first
place when we are not in incremental mode?
Remove SUMMARY.md of the unstable book as its autogenerated
Its being autogenerated now, as of PR #42612.
It seems I forgot to remove it.
Also, sort the entries of SUMMARY.md alphabetically.
Backport fixes to LLVM 4.0 ARM codegen bugs
So ARM had quite a few codegen bugs on LLVM 4.0 which are fixed on LLVM
trunk. This backports 5 of them:
r297871 - ARM: avoid clobbering register in v6 jump-table expansion.
- fixesrust-lang/rust#42248
r294949 - [Thumb-1] TBB generation: spot redefinitions of index
r295816 - [ARM] Fix constant islands pass.
r300870 - [Thumb-1] Fix corner cases for compressed jump tables
r302650 - [IfConversion] Add missing check in
IfConversion/canFallThroughTo
- unblocks rust-lang/rust#39409
r? @alexcrichton
beta-nominating because this fixes regressions introduced by LLVM 4.0.
So ARM had quite a few codegen bugs on LLVM 4.0 which are fixed on LLVM
trunk. This backports 5 of them:
r297871 - ARM: avoid clobbering register in v6 jump-table expansion.
- fixesrust-lang/rust#42248
r294949 - [Thumb-1] TBB generation: spot redefinitions of index
r295816 - [ARM] Fix constant islands pass.
r300870 - [Thumb-1] Fix corner cases for compressed jump tables
r302650 - [IfConversion] Add missing check in
IfConversion/canFallThroughTo
- unblocks rust-lang/rust#39409
Update cargo/rls submodules and dependencies
Brings in a few regression fixes on the Cargo side, updates the rls to work
with the newer Cargo, and also updates other crates.io dependencies to pull in
various bug fixes and such.
Use T as the subpattern type of Box<T>
The subpattern type of boxes being nil does not make sense because of box patterns. They should have their inner type as the subpattern type.
Fixes#42679, which describes ICE caused by the bug.
Add `_` to the list of keywords
also, make sure the keyword table is correctly spaced
note: the reference also needs to be updated. This is not the only way to do this in the grammar, but it's my preferred way.
Use custom cargo/rustc paths when parsing flags.
Fixes https://github.com/rust-lang/rust/issues/41779, probably also https://github.com/rust-lang/rust/issues/42543 (I think they're duplicates).
I'm not entirely happy with the implementation, since it means we parse the configuration twice, but it's the minimal solution. I think the other choice is to move both calls to Config::parse inside Flags::parse and merge them, but I don't know if that's a good idea.
r? @alexcrichton
Without this patch, there is an ICE when running rustc with
RUST_LOG=debug. This patch updates extract_def_id to check if the map
has been populated before accessing it. This fixes the problem, but
maybe we do not need to compute the incremental hashes maps in the first
place when we are not in incremental mode?
Implement lazy loading of external crates' sources. Fixes#38875Fixes#38875. This is a follow-up to #42507. When a (now correctly translated) span from an external crate is referenced in a error, warning or info message, we still don't have the source code being referenced.
Since stuffing the source in the serialized metadata of an rlib is extremely wasteful, the following scheme has been implemented:
* File maps now contain a source hash that gets serialized as well.
* When a span is rendered in a message, the source hash in the corresponding file map(s) is used to try and load the source from the corresponding file on disk. If the file is not found or the hashes don't match, the failed attempt is recorded (and not retried).
* The machinery fetching source lines from file maps is augmented to use the lazily loaded external source as a secondary fallback for file maps belonging to external crates.
This required a small change to the expected stderr of one UI test (it now renders a span, where previously was none).
Further work can be done based on this - some of the machinery previously used to hide external spans is possibly obsolete and the hashing code can be reused in different places as well.
r? @eddyb
Brings in a few regression fixes on the Cargo side, updates the rls to work
with the newer Cargo, and also updates other crates.io dependencies to pull in
various bug fixes and such.
Report error for assignment in `if` condition
For code like `if x = 3 {}`, output:
```
error[E0308]: mismatched types
--> $DIR/issue-17283.rs:25:8
|
25 | if x = x {
| ^^^^^
| |
| help: did you mean to compare equality? `x == x`
| expected bool, found ()
|
= note: expected type `bool`
found type `()`
```
Fix#40926.
Issue 42545 type inference regression
Fix an ICE that results from type inference obligations being dropped on the floor. Specifically, when computing the implied bounds, we would sometimes do normalizations that get stored in the cache, but we would *not* try to solve the resulting obligations. This can sometimes leave type variables uninferred. Occurs only rarely because implied bounds are processed in regionck which happens very late, so usually the cache is populated already from somewhere else.
I think that the *proper* fix here is probably lazy normalization. This fix is intentionally very narrow both because this code is on the chopping block and because this needs a beta backport.
r? @eddyb
cc @arielb1
Introduce tidy lint to check for inconsistent tracking issues
This PR
* Refactors the collect_lib_features function to work in a
non-checking mode (no bad pointer needed, and list of
lang features).
* Introduces checking whether unstable/stable tags for a
given feature have inconsistent tracking issues, as in,
multiple tracking issues per feature.
* Fixes such inconsistencies throughout the codebase.
save-analysis: remove a lot of stuff
This commits us to the JSON format and the more general def/ref style of output, rather than also supporting different data formats for different data structures. This does not affect the RLS at all, but will break any clients of the CSV form - AFAIK there are none (beyond a few of my own toy projects) - DXR stopped working long ago.
r? @eddyb
Fix condvar.wait(distant future) return immediately on OSX
Fixes issue #37440: `pthread_cond_timedwait` on macOS Sierra seems
to overflow `ts_sec` parameter and returns immediately. To work
around this problem patch rounds timeout down to year 3000.
Patch also fixes overflow when converting `u64` to `time_t`.
This commit
* Refactors the collect_lib_features function to work in a
non-checking mode (no bad pointer needed, and list of
lang features).
* Introduces checking whether unstable/stable tags for a
given feature have inconsistent tracking issues.
* Fixes such inconsistencies throughout the codebase.