GHA: enable running multiple try builds at the same time
While for auto, try and PR builds we only want the latest commit to be tested, that's not true for try builds: each commit pushed to the branch is a different PR being tested, and we want multiple PRs to be tested in parallel if there is enough demand.
Fixes#70569
Overhaul of the `AllocRef` trait to match allocator-wg's latest consens; Take 2
GitHub won't let me reopen#69889 so I make a new PR.
In addition to #69889 this fixes the unsoundness of `RawVec::into_box` when using allocators supporting overallocating. Also it uses `MemoryBlock` in `AllocRef` to unify `_in_place` methods by passing `&mut MemoryBlock`. Additionally, `RawVec` now checks for `size_of::<T>()` again and ignore every ZST. The internal capacity of `RawVec` isn't used by ZSTs anymore, as `into_box` now requires a length to be specified.
r? @Amanieu
fixesrust-lang/wg-allocators#38fixesrust-lang/wg-allocators#41fixesrust-lang/wg-allocators#44fixesrust-lang/wg-allocators#51
The modified code to handle parsing raw strings didn't properly account for the case where there was no "#" on either end and erroneously reported this strings as complete. This lead to a panic trying to read off the end of the file.
compiletest: don't use `std::io::stdout()`, as it bypasses `set_print`.
This PR undoes a change made during #69916, which became unnecessary during review but was left in by accident, and which isn't correct due to `libtest` using `std::io::set_print`, which overwrites the `println!` behavior but *not* `writeln!(std::io::stdout(), ...)`.
The effect of using `writeln!(std::io::stdout(), ...)` was that the diff output would show *while* running the tests, instead of at the end, when failing tests are listed.
r? @Mark-Simulacrum cc @oli-obk
cargotest: remove webrender
The current webrender commit occasionally fails without a reason, and the latest webrender commit is missing a dependency on our Windows builders. It's not worth installing an extra dependency for cargotest, and the spurious failure makes keeping this test not worth it.
r? @Mark-Simulacrum
Miri: make backtrace function names and spans match up
Currently, Miri backtraces are a bit confusing:
```
error: Undefined Behavior: entering unreachable code
--> tests/compile-fail/never_transmute_void.rs:10:11
|
10 | match v {} //~ ERROR entering unreachable code
| ^ entering unreachable code
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
note: inside call to `f` at tests/compile-fail/never_transmute_void.rs:17:5
--> tests/compile-fail/never_transmute_void.rs:17:5
|
17 | f(v); //~ inside call to `f`
| ^^^^
= note: inside call to `main` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34
= note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73
= note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5
```
When reading this like a normal backtrace, one would expect that e.g. the backrace involves the "main" function at "libstd/rt.rs:67:34". But that is not actually where we are in the main function, that is *where the main function is called*.
This is not how backtraces are usually rendered (including e.g. with `RUST_BACKTRACE=1`). Usually we print next to each function name where inside that function the frame is currently executing, not where the *parent* frame is executing. With this PR and the Miri side at https://github.com/rust-lang/miri/pull/1283, the backtrace now looks as follows:
```
error: Undefined Behavior: entering unreachable code
--> tests/compile-fail/never_transmute_void.rs:10:11
|
10 | match v {} //~ ERROR entering unreachable code
| ^ entering unreachable code
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: inside `f` at tests/compile-fail/never_transmute_void.rs:10:11
note: inside `main` at tests/compile-fail/never_transmute_void.rs:17:5
--> tests/compile-fail/never_transmute_void.rs:17:5
|
17 | f(v); //~ inside `main`
| ^^^^
= note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:67:34
= note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:52:73
= note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6034 ~ std[87db]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc/src/libstd/sys_common/backtrace.rs:130:5
```
Now function name and printed line numbers match up in the notes.
This code is partially shared with const-eval, so the change also affects const-eval: instead of printing what is being called at some span, we print which function/constant this span is inside.
With this, we can also remove the `span` field from Miri's stack frames (which used to track the *caller span* of that frame, quite confusing), and then get of a whole lot of `span` arguments that ultimately just served to fill that field (and as a fallback for `caller_location`, which however was never actually used).
r? @oli-obk
Ensure LLVM is in the link path for "fulldeps" tests
This is a follow-up to #70123, which added `llvm-config --libdir` to the
`LIBRARY_PATH` for rustc tools. We need the same for "run-make-fulldeps"
and "ui-fulldeps" tests which depend on compiler libraries, implicitly
needing to link to `-lLLVM` as well.
Improve error messages for raw strings (#60762)
This diff improves error messages around raw strings in a few ways:
- Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test)
- Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings
- Detect potentially intended terminators (longest sequence of "#*" is suggested)
Fixes#60762
cc @estebank who reviewed the original (abandoned) PR for the same ticket.
r? @Centril
Add `-Z dump-mir-dataflow` flag for dumping dataflow results visualization
Previously, to visualize the results of a MIR dataflow pass, one had to add a `#[rustc_mir(borrowck_graphviz_postflow)]` attribute to functions of interest. However, there is no way to specify this attribute on closures and generators, so it was impossible to view results for these MIR bodies.
This PR adds a flag, `-Z dump-mir-dataflow`, which will output the dataflow results for any functions specified in `-Z dump-mir` to the output directory specified by `-Z dump-mir-dir`. This behavior is modeled on the `-Z dump-mir-graphviz` flag.
Upgrade GCC to 8.3.0, glibc to 2.17.0 and crosstool-ng to 1.24.0 for dist-arm-linux and dist-armhf-linux
Attempt to fix#69420 in the same manner as #65302 did for armv7l. I have tested that this eliminates the segfault while building a `hello_world` package on `arm-unknown-linux-gnueabihf`.
I have not been able to test whether the bug exists for `arm-unknown-linux-gnueabi` as well, but I suspect it does, so I upgraded the toolchain for that platform as well.
expand vec![] to Vec::new()
The current expansion of `vec![]` calls `into_vec` on a boxed slice, which results in longer IR, and even after optimization, some unwinding artifacts are still present in the IR. This PR uses `Vec::new()` for `vec![]`.
This also allows `vec![]` to be used in const expressions.
add `unused_braces` lint
Add the lint `unused_braces` which is warn by default.
`unused_parens` is also extended and now checks anon consts.
closes#68387
r? @varkor
BTreeMap/BTreeSet: implement drain_filter
Provide an implementation of drain_filter for BTreeMap and BTreeSet. Should be optimal when the predicate picks only elements in leaf nodes with at least MIN_LEN remaining elements, which is a common case, at least when draining only a fraction of the map/set, and also when the predicate picks elements stored in internal nodes where the right subtree can easily let go of a replacement element.
The first commit adds benchmarks with an external, naive implementation. to compare how much this claimed optimality-in-some-cases is actually worth.
While for auto, try and PR builds we only want the latest commit to be
tested, that's not true for try builds: each commit pushed to the branch
is a different PR being tested, and we want multiple PRs to be tested in
parallel if there is enough demand.
Fixes#70569
Ensure there are versions of test code for aarch64 windows
Remove the `cfg` flags that were preventing some tests from running on `aarch64-pc-windows-msvc`.
All the existing `target_os = windows` targets had the same `align()` and `size()` values, so this change just removes the `target_arch` flags.
r? @alexcrichton
improve folder name for persistent doc tests
This fixes#69411, by using the entire path as folder name and storing already visited paths in a HashMap + appending a number to the file name for duplicates.
The current webrender commit occasionally fails without a reason, and
the latest webrender commit is missing a dependency on our Windows
builders. It's not worth installing an extra dependency for cargotest,
and the spurious failure makes keeping this test not worth it.
Before this commit `-C codegen-units` would just get silently be
ignored if `-C incremental` was specified too. After this commit
one can control the number of codegen units generated during
incremental compilation. The default is rather high at 256, so most
crates won't see a difference unless explicitly opting into a lower
count.
more clippy fixes
* use is_empty() instead of len comparison (clippy::len_zero)
* use if let instead of while let loop that never loops (clippy::never_loop)
* remove redundant returns (clippy::needless_return)
* remove redundant closures (clippy::redundant_closure)
* use if let instead of match and wildcard pattern (clippy::single_match)
* don't repeat field names redundantly (clippy::redundant_field_names)
r? @Centril
Fix incorrect documentation for `str::{split_at, split_at_mut}`
The documentation for each method currently states:
> Panics if `mid` is not on a UTF-8 code point boundary, or if it is beyond the last code point of the string slice.
However, this is not consistent with the real behavior, or that of the corresponding methods for `[T]` slices. A comment inside each of the `str` methods states:
> is_char_boundary checks that the index is in [0, .len()]
That is what I would expect the behavior to be, and in fact this seems to be the real behavior. For example ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8e03dcc209d4dd176df2297523f9fee1)):
```rust
fn main() {
// Prints ("abc", "") and doesn't panic
println!("{:?}", "abc".split_at(3));
}
```
In this case, I would interpret "the last code point of the string slice" to mean the byte at index 2 in UTF-8. However, it is possible to pass an index of 3, which is definitely "beyond the last code point of the string slice".
I think that this is much clearer, but feel free to bikeshed.
std: Fix over-aligned allocations on wasm32-wasi
The wasm32-wasi target delegates its malloc implementation to the
functions in wasi-libc, but the invocation of `aligned_alloc` was
incorrect by passing the number of bytes requested first rather than the
alignment. This commit swaps the order of these two arguments to ensure
that we allocate over-aligned memory correctly.
infer array len from pattern
closes#70529
This still errors in the following case
```rust
#![feature(const_generics)]
fn arr<const N: usize>() -> [u8; N] {
todo!()
}
fn main() {
match arr() {
[5, ..] => (),
//~^ ERROR cannot pattern-match on an array without a fixed length
[_, _] => (),
}
}
```
Considering that this should be rare and is harder to implement I would merge this PR without *fixing* the above.
Add long error code for error E0226
Added a long description message for error E0226, which previously did not exist.
As requested in issue #61137
r? @GuillaumeGomez
Optimize strip_prefix and strip_suffix with str patterns
As mentioned in https://github.com/rust-lang/rust/issues/67302#issuecomment-585639226.
I'm not sure whether adding these methods to `Pattern` is desirable—but they have default implementations so the change is backwards compatible. Plus it seems like they're slated for wholesale replacement soon anyway? #56345
----
Constructing a Searcher in strip_prefix and strip_suffix is
unnecessarily slow when the pattern is a fixed-length string. Add
strip_prefix and strip_suffix methods to the Pattern trait, and add
optimized implementations of these methods in the str implementation.
The old implementation is retained as the default for these methods.
use is_empty() instead of len comparison (clippy::len_zero)
use if let instead of while let loop that never loops (clippy::never_loop)
remove redundant returns (clippy::needless_return)
remove redundant closures (clippy::redundant_closure)
use if let instead of match and wildcard pattern (clippy::single_match)
don't repeat field names redundantly (clippy::redundant_field_names)
This is a follow-up to #70123, which added `llvm-config --libdir` to the
`LIBRARY_PATH` for rustc tools. We need the same for "run-make-fulldeps"
and "ui-fulldeps" tests which depend on compiler libraries, implicitly
needing to link to `-lLLVM` as well.
The wasm32-wasi target delegates its malloc implementation to the
functions in wasi-libc, but the invocation of `aligned_alloc` was
incorrect by passing the number of bytes requested first rather than the
alignment. This commit swaps the order of these two arguments to ensure
that we allocate over-aligned memory correctly.
Constructing a Searcher in strip_prefix and strip_suffix is
unnecessarily slow when the pattern is a fixed-length string. Add
strip_prefix and strip_suffix methods to the Pattern trait, and add
optimized implementations of these methods in the str implementation.
The old implementation is retained as the default for these methods.
Polonius: update to 0.12.1, fix more move errors false positives, update test expectations
This PR:
- updates `polonius-engine` to version 0.12.1 to fix some move errors false positives
- fixes a fact generation mistake creating the other move errors false positives
- updates the test expectations for the polonius compare-mode so that all (minus the 2 OOMs) ui tests pass again (matching the [analysis doc](https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?view) starting at case 34)
In my opinion, this is safe to rollup.
r? @nikomatsakis
avoid creating unnecessary reference in Windows Env iterator
Discovered in https://github.com/rust-lang/miri/pull/1225: the Windows `Env` iterator violates Stacked Borrows by creating an `&u16`, turning it into a raw pointer, and then accessing memory outside the range of that type.
There is no need to create a reference here in the first place, so the fix is trivial.
Cc @JOE1994
Cc https://github.com/rust-lang/unsafe-code-guidelines/issues/134
Make `Visitor::visit_body` take a plain `&Body`
`ReadOnlyBodyAndCache` has replaced `&Body` in many parts of the code base that don't care about basic block predecessors. This includes the MIR `Visitor` trait, which I suspect resulted in many unnecessary changes in #64736. This reverts part of that PR to reduce the number of places where we need to pass a `ReadOnlyBodyAndCache`.
In the long term, we should either give `ReadOnlyBodyAndCache` more ergonomic name and replace all uses of `&mir::Body` with it at the cost of carrying an extra pointer everywhere, or use it only in places that actually need access to the predecessor cache. Perhaps there is an even nicer alternative.
r? @Nashenas88
This will fix the other move errors false positives:
emitting the fact at the start point caused accesses to be at the
same point as an initialization fact of the return place of a call
on the following block, which emitted an error.
Tweak `suggest_constraining_type_param`
Some of the bound restriction structured suggestions were incorrect while others had subpar output.
The only issue left is a suggestion for an already present bound when dealing with `const`s that should be handled independently.
Fix#69983.
#[link]: mention wasm_import_module instead of cfg
`#[link(cfg)]` is perma-unstable and is not documented anywhere else. It makes more sense to mention `wasm_import_module` here since it's stable.
This makes it harder to hit https://github.com/rust-lang/rust/issues/70538 (if it weren't for this text, I wouldn't even know this feature existed).
add test for 62220
Closes#62220
Adds a test for https://github.com/rust-lang/rust/issues/62220.
Im not sure whether `check-pass` is sufficient here. I didn't put `run-pass` in, as I'm afraid that'll fail due to the `unimplemented!()` return in the code.
Add Result<Result<T, E>, E>::flatten -> Result<T, E>
This PR makes this possible (modulo type inference):
```rust
assert_eq!(Ok(6), Ok(Ok(6)).flatten());
```
Tracking issue: #70142
<sub>largely cribbed directly from <https://github.com/rust-lang/rust/pull/60256></sub>
This renames and stabilizes unsafe floating point to integer casts, which are
intended to be the substitute for the currently unsound `as` behavior, once that
changes to safe-but-slower saturating casts.
BTreeMap testing: introduce symbolic constants and use height consistently
Doesn't change what or how much is tested, except for some exact integer types, just for convenience and because `node::CAPACITY` is a usize.
r? @RalfJung
This diff improves error messages around raw strings in a few ways:
- Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test)
- Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings
- Detect potentially intended terminators (longest sequence of "#*" is suggested)
rename Scalar::{ptr_null -> null_ptr} and add "machine_" prefix like elsewhere
"NULL pointer" is just much more common terminology than "pointer-null".
Also I forgot two methods when renaming all the `Scalar` things to `(to|from)_machine_(u|i)size`.
ASCII methods on OsStr
Would close#69566
I don't know enough about encodings to know if this is a valid change, however the comment on the issue suggests it could be.
This does two things:
1. Makes ASCII methods available on OsStr
2. Makes it possible to obtain a `&mut OsStr`. This is necessary to actually use `OsStr::make_ascii_*case` methods since they modify the underlying value. As far as I can tell, the only way to modify a `&mut OsStr` is via the methods I just added.
My original hope was to have these methods on `OsStrExt` for Windows, since the standard library already assumes `make_ascii_uppercase` is valid in Windows (see the change I made to windows/process.rs). If it is found these are not valid changes on non-Windows platforms, I can move the methods to the ext trait instead.
Replace last mention of IRC with Discord
Mozilla's IRC service was shut down in March 2020. The official instant messaging variant has been Discord for a while, and most of the links were already replaced by #61524.
This was the last line that came up with `irc.mozilla.org` or any combination of "irc.*#[a-z]+" in a `git grep`:
git grep -i -E "irc.*#[a-z]+"
As there is only one other link directly to Rust's discord, I used the same Markdown link `[rust-discord]` as in `bootstrap/README.md` to stay consistent. This might come in handy if the chat platform changes at a later point again.
Shrink Unicode tables (even more)
This shrinks the Unicode tables further, building upon the wins in #68232 (the previous counts differ due to an interim Unicode version update, see #69929.
The new data structure is slower by around 3x, on the benchmark of looking up every Unicode scalar value in each data set sequentially in every data set included. Note that for ASCII, the exposed functions on `char` optimize with direct branches, so ASCII will retain the same performance regardless of internal optimizations (or the reverse). Also, note that the size reduction due to the skip list (from where the performance losses come) is around 40%, and, as a result, I believe the performance loss is acceptable, as the routines are still quite fast. Anywhere where this is hot, should probably be using a custom data structure anyway (e.g., a raw bitset) or something optimized for frequently seen values, etc.
This PR updates both the bitset data structure, and introduces a new data structure similar to a skip list. For more details, see the [main.rs] of the table generator, which describes both. The commits mostly work individually and document size wins.
As before, this is tested on all valid chars to have the same results as nightly (and the canonical Unicode data sets), happily, no bugs were found.
[main.rs]: https://github.com/rust-lang/rust/blob/fb4a715e18b/src/tools/unicode-table-generator/src/main.rs
Set | Previous | New | % of old | Codepoints | Ranges |
----------------|---------:|------:|-----------:|-----------:|-------:|
Alphabetic | 3055 | 1599 | 52% | 132875 | 695 |
Case Ignorable | 2136 | 949 | 44% | 2413 | 410 |
Cased | 934 | 359 | 38% | 4286 | 141 |
Cc | 43 | 9 | 20% | 65 | 2 |
Grapheme Extend | 1774 | 813 | 46% | 1979 | 344 |
Lowercase | 985 | 867 | 88% | 2344 | 652 |
N | 1266 | 419 | 33% | 1781 | 133 |
Uppercase | 934 | 777 | 83% | 1911 | 643 |
White_Space | 140 | 37 | 26% | 25 | 10 |
----------------|----------|-------|------------|------------|--------|
Total | 11267 | 5829 | 51% | - | - |
Create output dir in rustdoc markdown render
`rustdoc` command on a standalone markdown document fails because the output directory (which default to `doc/`) is not created, even when specified with the `--output` argument.
This PR adds the creation of the output directory before the file creation to avoid an unexpected error which is unclear.
I am not sure about the returned error code. I did not find a table explaining them. So I simply put the same error code that is returned when `File::create` fails because they are both related to file-system errors.
Resolve#70431
submodules: update clippy from 1ff81c1b to 70b93aab
Changes:
````
remove redundant import
rustup https://github.com/rust-lang/rust/pull/68404
rustup https://github.com/rust-lang/rust/pull/69644
rustup https://github.com/rust-lang/rust/pull/70344
Move verbose_file_reads to restriction
move redundant_pub_crate to nursery
readme: explain how to run only a single lint on a codebase
Remove dependency on `matches` crate
Move useless_transmute to nursery
nursery group -> style
Update for PR feedback
Auto merge of #5314 - ehuss:remove-git2, r=flip1995
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them
````
Fixes#70456
Mozilla's IRC service was shut down in March 2020. The official
instant messaging variant has been Discord for a while, and most of
the links were already replaced by #61524.
This was the last line that came up with `irc.mozilla.org` or any
combination of "irc.*#[a-z]+" in a `git grep`:
git grep -i -E "irc.*#[a-z]+"
As there is only one other link directly to Rust's discord, I used the
same Markdown link `[rust-discord]` as in `bootstrap/README.md` to
stay consistent. This might come in handy if the chat platform changes
at a later point again.
As an aside: for those interested in the use of IRC, Mozilla's [wiki]
still offers a lot of in-depth knowledge.
[wiki]: https://wiki.mozilla.org/IRC
Move arg/constraint partition check to validation & improve recovery
- In the first commit, we move the check rejecting e.g., `<'a, Item = u8, String>` from the parser into AST validation.
- We then use this to improve the code for parsing generic arguments.
- And we add recovery for e.g., `<Item = >` (missing), `<Item = 42>` (constant), and `<Item = 'a>` (lifetime).
This is also preparatory work for supporting https://github.com/rust-lang/rust/issues/70256.
r? @varkor
Implement -Zlink-native-libraries
This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then
native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged
behaviour).
If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link
line. The assumption is that the outer build system driving the build already knows about the native
libraries and will specify them to the linker directly (for example via `-Clink-arg=`).
Addresses issue #70093
In practice, for the two data sets that still use the bitset encoding (uppercase
and lowercase) this is not a significant win, so just drop it entirely. It costs
us about 5 bytes, and the complexity is nontrivial.
This arranges for the sparser sets (everything except lower and uppercase) to be
encoded in a significantly smaller context. However, it is also a performance
trade-off (roughly 3x slower than the bitset encoding). The 40% size reduction
is deemed to be sufficiently important to merit this performance loss,
particularly as it is unlikely that this code is hot anywhere (and if it is,
paying the memory cost for a bitset that directly represents the data seems
worthwhile).
Alphabetic : 1599 bytes (- 937 bytes)
Case_Ignorable : 949 bytes (- 822 bytes)
Cased : 359 bytes (- 429 bytes)
Cc : 9 bytes (- 15 bytes)
Grapheme_Extend: 813 bytes (- 675 bytes)
Lowercase : 863 bytes
N : 419 bytes (- 619 bytes)
Uppercase : 776 bytes
White_Space : 37 bytes (- 46 bytes)
Total table sizes: 5824 bytes (-3543 bytes)
Changes:
````
remove redundant import
rustup https://github.com/rust-lang/rust/pull/68404
rustup https://github.com/rust-lang/rust/pull/69644
rustup https://github.com/rust-lang/rust/pull/70344
Move verbose_file_reads to restriction
move redundant_pub_crate to nursery
readme: explain how to run only a single lint on a codebase
Remove dependency on `matches` crate
Move useless_transmute to nursery
nursery group -> style
Update for PR feedback
Auto merge of #5314 - ehuss:remove-git2, r=flip1995
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them
````
Fixes#70456
non-exhastive diagnostic: add note re. scrutinee type
This fixes https://github.com/rust-lang/rust/issues/67259 by adding a note:
```
= note: the matched value is of type &[i32]
```
to non-exhaustive pattern matching errors.
r? @varkor @estebank
Remove `no_integrated_as` mode.
Specifically, remove both `-Z no_integrated_as` and
`TargetOptions::no_integrated_as`. The latter was only used for the
`msp430_none_elf` platform, for which it's no longer required.
r? @alexcrichton
Move the query system to a dedicated crate
The query system `rustc::ty::query` is split out into the `rustc_query_system` crate.
Some commits are unformatted, to ease rebasing.
Based on #67761 and #69910.
r? @Zoxc
This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then
native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged
behaviour).
If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link
line. The assumption is that the outer build system driving the build already knows about the native
libraries and will specify them to the linker directly (for example via `-Clink-arg=`).
Addresses issue #70093