Emit better debugging information for a trait object pointer. In
particular, now:
* The fields are explicitly represented in the DWARF;
* DWARF for the vtable itself is emitted; and
* The DWARF for the vtable's type has a DW_AT_containing_type which
points to the concrete type for which the vtable was emitted. This is
a small DWARF extension, that allows debuggers to determine the real
type of the object to which a trait object points.
I'll submit the gdb patch to take advantage of this new debuginfo once
this lands.
The vtable type is not currently complete -- it doesn't include members
for the pointers it contains. This information was not needed for this
feature.
This addresses part 1 of #1563.
This adds a "min-system-llvm-version" directive, so that a test can
indicate that it will either work with rust-llvm or with some minimal
system LLVM. This makes it simpler to write a test that requires an
LLVM patch that landed upstream and was then backported to rust-llvm.
rustc_driver: expose a way to override query providers in CompileController.
This API has been a long-time coming and will probably become the main method for custom drivers (that is, binaries other than `rustc` itself that use `librustc_driver`) to adapt the compiler's behavior.
rust.css has to be next to the font files so we shouldn't copy it for
only the book redirect pages, instead just use the version that is
already there.
This also removes the duplicate code creating version_info.html.
always add an unreachable branch on matches to give more info to llvm
As part of https://github.com/djzin/rustc-optimization I discovered that some simple enum optimizations (src/unary/three_valued_enum.rs and src/unary/four_valued_enum.rs in the repo) are not applied - and the reason for this is that we erase the info that the discriminant of an enum is one of the options by putting the last one in an "otherwise" branch. This patch adds an extra branch so that LLVM can know what the possibilities are for the discriminant, which fixes the three- and four- valued cases.
Note that for whatever reason, this doesn't fix the case of 2 variants (most notably `Option` and `Result` have 2 variants) - a pass re-ordering might fix this or we may wish to add "assume" annotations on discriminants to force it to optimize.
MIR-borrowck: don't ICE for cannot move from array error
Closes#45694
compile-fail test E0508 now gives
```text
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array (Ast)
--> .\src\test\compile-fail\E0508.rs:18:18
|
18 | let _value = array[0]; //[ast]~ ERROR E0508
| ^^^^^^^^
| |
| cannot move out of here
| help: consider using a reference instead: `&array[0]`
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array (Mir)
--> .\src\test\compile-fail\E0508.rs:18:18
|
18 | let _value = array[0]; //[ast]~ ERROR E0508
| ^^^^^^^^ cannot move out of here
error: aborting due to 2 previous errors
```
Use #!/usr/bin/env as shebang for Bash scripts
On some systems, the bash command could be available in another
directory than /bin. As such, to offer an env shebang is more
convenient.
This make sense even for docker scripts, as you can use Docker
on FreeBSD or SmartOS for example.
update match-expressions.rs with DepNode labels
As a part of #44924, I have updated the match-expressions.rs. The PR has tests verified for the following dependency nodes for let-expressions
- MirValidated
- MirOptimized
- TypeCheckTables
- TypeOfItem
- GenericsOfItem
- PredicatesOfItem
- FnSignature
cc @michaelwoerister
r? @nikomatsakis
Use getrandom syscall for all Linux and Android targets.
I suppose we can use it in all Linux and Android targets. In function `is_getrandom_available` is checked if the syscall is available (getrandom syscall was add in version 3.17 of Linux kernel), if the syscall is not available `fill_bytes` fallback to reading from `/dev/urandom`.
Update libc to include getrandom related constants.