Hans Kratz [Mon, 13 Dec 2021 20:31:48 +0000 (21:31 +0100)]
Revert "Set MACOSX_DEPLOYMENT_TARGET env var to default for linking if not set."
This reverts commit b376f5621b801460b911a75048a70698021bbc69, which is
the main part of #90499, because it turns out that this causes a good
amount of breakage in crates relying on the old behavior.
bors [Mon, 13 Dec 2021 20:12:35 +0000 (20:12 +0000)]
Auto merge of #91865 - matthiaskrgr:rollup-rai9ecq, r=matthiaskrgr
Rollup of 5 pull requests
Successful merges:
- #91699 (Add `-webkit-appearance: none` to search input)
- #91846 (rustdoc: Reduce number of arguments for `run_test` a bit)
- #91847 (Fix FIXME for `generic_arg_infer` in `create_substs_for_ast_path`)
- #91849 (GATs outlives lint: Try to prove bounds)
- #91855 (Stabilize const_cstr_unchecked)
Matthias Krüger [Mon, 13 Dec 2021 17:15:16 +0000 (18:15 +0100)]
Rollup merge of #91849 - jackh726:gats-outlives-lint-part2, r=nikomatsakis
GATs outlives lint: Try to prove bounds
Fixes #91036
Fixes #90888
Fixes #91348 (better error + documentation to be added to linked issue)
Instead of checking for bounds directly, try to prove them in the associated type environment.
Also, add a bit of extra information to the error, including a link to the relevant discussion issue (#87479). That should be edited to include a brief summary of the current state of the outlives lint, including a brief background. It also might or might not be worth it to bump this to a full error code at some point.
Matthias Krüger [Mon, 13 Dec 2021 17:15:15 +0000 (18:15 +0100)]
Rollup merge of #91847 - BoxyUwU:generic_arg_infer_fixme, r=lcnr
Fix FIXME for `generic_arg_infer` in `create_substs_for_ast_path`
Fixes a FIXME, does some general refactoring of this fn, and also fixes a bug where we would use a const params defaults instead of an inference var ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=19456f65ea5dc3fcaa9b696f842ab380))
(lot of stuff in one PR but it was all so close together...)
Matthias Krüger [Mon, 13 Dec 2021 17:15:14 +0000 (18:15 +0100)]
Rollup merge of #91846 - camelid:doctest-cleanup, r=GuillaumeGomez
rustdoc: Reduce number of arguments for `run_test` a bit
- rustdoc: Coalesce some `run_test` args as one `LangString` arg
- Rename `TestOptions` to `GlobalTestOptions`
- doctest: Rename `options` to `rustdoc_options`
bors [Mon, 13 Dec 2021 10:35:28 +0000 (10:35 +0000)]
Auto merge of #91654 - nikic:llvmbc-section-flags, r=nagisa
Use module inline assembly to embed bitcode
In LLVM 14, our current method of setting section flags to avoid
embedding the `.llvmbc` section into final compilation artifacts
will no longer work, see issue #90326. The upstream recommendation
is to instead embed the entire bitcode using module-level inline
assembly, which is what this change does.
I've kept the existing code for platforms where we do not need to
set section flags, but possibly we should always be using the
inline asm approach (which would have to look a bit different for MachO).
bors [Mon, 13 Dec 2021 04:29:20 +0000 (04:29 +0000)]
Auto merge of #91569 - erikdesjardins:vt-align, r=nikic
Attach range metadata to alignment loads from vtables
...because alignment is always nonzero[0].
This helps eliminate redundant runtime alignment checks, when a DST
is a field of a struct whose remaining fields have alignment 1.
Fixes #91438.
---
[0]:
The [reference](https://doc.rust-lang.org/reference/type-layout.html) says that alignment must be at least 1.
And in practice, the alignment field for all vtables is generated here: https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_middle/src/ty/vtable.rs#L68-L90 and is nonzero because [`Align::bytes()`](https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_target/src/abi/mod.rs#L547-L549) is always nonzero.
Tomasz Miąsko [Mon, 13 Dec 2021 00:00:00 +0000 (00:00 +0000)]
Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`
The resulting profile will include the crate name and will be stored in
the `--out-dir` directory.
This implementation makes it convenient to use LLVM time trace together
with cargo, in the contrast to the previous implementation which would
overwrite profiles or store them in `.cargo/registry/..`.
Matthias Krüger [Sun, 12 Dec 2021 23:20:08 +0000 (00:20 +0100)]
Rollup merge of #91749 - ssomers:btree_comments, r=Mark-Simulacrum
BTree: improve public descriptions and comments
BTreeSet has always used the term "value" next to and meaning the same thing as "elements" (in the mathematical sense but also used for key-value pairs in BTreeMap), while in the BTreeMap sense these "values" are known as "keys" and definitely not "values". Today I had enough of that.
bors [Sun, 12 Dec 2021 17:28:52 +0000 (17:28 +0000)]
Auto merge of #90716 - euclio:libloading, r=cjgillot
replace dynamic library module with libloading
This PR deletes the `rustc_metadata::dynamic_lib` module in favor of the popular and better tested [`libloading` crate](https://github.com/nagisa/rust_libloading/).
We don't benefit from `libloading`'s symbol lifetimes since we end up leaking the loaded library in all cases, but the call-sites look much nicer by improving error handling and abstracting away some transmutes. We also can remove `rustc_metadata`'s direct dependencies on `libc` and `winapi`.
This PR also adds an exception for `libloading` (and its license) to tidy, so this will need sign-off from the compiler team.
bors [Sun, 12 Dec 2021 06:54:28 +0000 (06:54 +0000)]
Auto merge of #91825 - matthiaskrgr:rollup-e4s8lwp, r=matthiaskrgr
Rollup of 6 pull requests
Successful merges:
- #91746 (Btree: assert more API compatibility)
- #91748 (rustdoc: Add regression test for Iterator as notable trait on &mut T)
- #91811 (bootstrap: Change unwrap() to expect() for WIX path)
- #91814 (doc: fix typo in comments)
- #91815 (better span for unexpected normalization failure in CTFE engine)
- #91817 (rustbot: Add autolabeling for `T-rustdoc`)
Matthias Krüger [Sun, 12 Dec 2021 06:45:29 +0000 (07:45 +0100)]
Rollup merge of #91811 - itzurabhi:boostrap-dist-wix-unwrap-issue, r=Mark-Simulacrum
bootstrap: Change unwrap() to expect() for WIX path
On Windows, `x.py dist` command panics without proper error message if `WIX` environment variable is not set. This patch changes `Option::unwrap()` to `Option::expect()`.
Matthias Krüger [Sun, 12 Dec 2021 06:45:28 +0000 (07:45 +0100)]
Rollup merge of #91746 - ssomers:btree_tests, r=Mark-Simulacrum
Btree: assert more API compatibility
Introducing a member such as `BTreeSet::min()` would silently break compatibility if no code calls the existing `BTreeSet::min(set)`. `BTreeSet` is the only btree class silently bringing in stable members, apart from many occurrences of `#[derive(Debug)]` on iterators.
bors [Sun, 12 Dec 2021 03:50:30 +0000 (03:50 +0000)]
Auto merge of #89404 - Kobzol:hash-stable-sort, r=Mark-Simulacrum
Slightly optimize hash map stable hashing
I was profiling some of the `rustc-perf` benchmarks locally and noticed that quite some time is spent inside the stable hash of hashmaps. I tried to use a `SmallVec` instead of a `Vec` there, which helped very slightly.
Then I tried to remove the sorting, which was a bottleneck, and replaced it with insertion into a binary heap. Locally, it yielded nice improvements in instruction counts and RSS in several benchmarks for incremental builds. The implementation could probably be much nicer and possibly extended to other stable hashes, but first I wanted to test the perf impact properly.
bors [Sun, 12 Dec 2021 00:58:30 +0000 (00:58 +0000)]
Auto merge of #91813 - matthiaskrgr:rollup-nryyeyj, r=matthiaskrgr
Rollup of 8 pull requests
Successful merges:
- #90081 (Make `intrinsics::write_bytes` const)
- #91643 (asm: Allow using r9 (ARM) and x18 (AArch64) if they are not reserved by the current target)
- #91737 (Make certain panicky stdlib functions behave better under panic_immediate_abort)
- #91750 (rustdoc: Add regression test for Iterator as notable trait on &T)
- #91764 (Do not ICE when suggesting elided lifetimes on non-existent spans.)
- #91780 (Remove hir::Node::hir_id.)
- #91797 (Fix zero-sized reference to deallocated memory)
- #91806 (Make `Unique`s methods `const`)
Matthias Krüger [Sat, 11 Dec 2021 22:31:51 +0000 (23:31 +0100)]
Rollup merge of #91750 - notriddle:notriddle/doc-notable_trait-mut_t_is_not_ref_t, r=Mark-Simulacrum
rustdoc: Add regression test for Iterator as notable trait on &T
Closes #78160
This regression test is different from the one in #91748, because while neither of these function should have Iterator marked as a notable trait, the reasons are different.
* In this PR, it returns `&T where T: Iterator`. The `mut` is what's missing.
* In #91748, it returns `&mut T`. The trait bounds are what's missing.
Matthias Krüger [Sat, 11 Dec 2021 22:31:50 +0000 (23:31 +0100)]
Rollup merge of #91737 - Manishearth:panic-immediate-stdlib, r=joshtriplett
Make certain panicky stdlib functions behave better under panic_immediate_abort
The stdlib has a `panic_immediate_abort` feature that turns panics into immediate aborts, without any formatting/display logic. This feature was [introduced](https://github.com/rust-lang/rust/pull/55011) primarily for codesize-constrained situations.
Unfortunately, this win doesn't quite propagate to `Result::expect()` and `Result::unwrap()`, while the formatting machinery is reduced, `expect()` and `unwrap()` both call `unwrap_failed("msg", &err)` which has a signature of `fn unwrap_failed(msg: &str, error: &dyn fmt::Debug)` and is `#[inline(never)]`. This means that `unwrap_failed` will unconditionally construct a `dyn Debug` trait object even though the object is never used in the function.
Constructing a trait object (even if you never call a method on it!) forces rust to include the vtable and any dependencies. This means that in `panic_immediate_abort` mode, calling expect/unwrap on a Result will pull in a whole bunch of formatting code for the error type even if it's completely unused.
This PR swaps out the function with one that won't require a trait object such that it won't force the inclusion of vtables in the code. It also gates off `#[inline(never)]` in a bunch of other places where allowing the inlining of an abort may be useful (this kind of thing is already done elsewhere in the stdlib).
I don't know how to write a test for this; we don't really seem to have any tests for `panic_immediate_abort` anyway so perhaps it's fine as is.
bootstrap: Change `unwrap()` to `expect()` for `WIX` path
On Windows, `x.py dist` command panics without proper error message if 'WIX' environment variable is not set. This patch changes `Option::unwrap()` to `Option::expect()`.
bors [Sat, 11 Dec 2021 21:57:19 +0000 (21:57 +0000)]
Auto merge of #91769 - estebank:type-trait-bound-span-2, r=oli-obk
Tweak assoc type obligation spans
* Point at RHS of associated type in obligation span
* Point at `impl` assoc type on projection error
* Reduce verbosity of recursive obligations
* Point at source of binding lifetime obligation
* Tweak "required bound" note
* Tweak "expected... found opaque (return) type" labels
* Point at set type in impl assoc type WF errors