Joshua Nelson [Wed, 14 Sep 2022 23:09:33 +0000 (18:09 -0500)]
Don't hardcode the path to `bootstrap_out`
The `rust-dev` dist component puts binaries in `bootstrap/bin`, but we expected them to be in
`bootstrap/debug` to match cargo's behavior. Rather than making the dist component inconsistent
with other components, make bootstrap slightly smarter and allow using any path as long as all the
binaries are in the same directory.
As a bonus, this greatly simplifies the logic, and makes it possible for the shell scripts to start
avoiding python.
Joshua Nelson [Wed, 14 Sep 2022 23:19:28 +0000 (18:19 -0500)]
Make it possible to run bootstrap on a different machine than the one it was built
- Default to trying git rev-parse for the root directory
CARGO_MANIFEST_DIR is a path on the build machine, not the running machine.
Don't require this to succeed, to allow building from a tarball; in that case fall back to CARGO_MANIFEST_DIR.
- Set `initial_rustc` to a path based on the path of the running executable, not CARGO_MANIFEST_DIR.
We only reset `initial_rustc` if we're sure this isn't the working tree bootstrap was originally built in,
since I'm paranoid that setting this in other cases will cause things to break;
it's not clear to me when $RUSTC differs from `build/$TARGET/stage0/bin/rustc` (maybe never? but better to be sure).
Instead, only set this when
a) We are not using a custom rustc. If someone has specified a custom rustc we should respect their wishes.
b) We are in a checkout of rust-lang/rust other than the one bootstrap was built in.
Originally, we planned to combine this with the `rust-dev` component.
However, I realized that would force LLVM to be redownloaded whenever bootstrap is modified.
LLVM is a much larger download, so split this to get better caching.
Auto merge of #101673 - crlf0710:generator_clone, r=oli-obk
Allow generators to impl Clone/Copy
Revives #95137. It's a pity that the original pr didn't land because the implementation is almost complete! All credits goes to `@canndrew,` and i just resolved the merge conflicts and updated the feature gate version number.
Auto merge of #101670 - obi1kenobi:patch-1, r=jyn514
Add @obi1kenobi to the cc list for rustdoc-json-types
I'm one of the maintainers of `cargo-semver-checks`, and as mentioned [in Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Long.20Term.20Rustdoc.20JSON.20Stability) it's very useful to me to know about upcoming rustdoc JSON types changes so I can be ready to publish new `cargo-semver-checks` releases compatible with the new JSON format.
Auto merge of #101482 - joboet:netbsd_parker, r=sanxiyn
Optimize thread parking on NetBSD
As the futex syscall is not present in the latest stable release, NetBSD cannot use the efficient thread parker and locks Linux uses. Currently, it therefore relies on a pthread-based parker, consisting of a mutex and semaphore which protect a state variable. NetBSD however has more efficient syscalls available: [`_lwp_park`](https://man.netbsd.org/_lwp_park.2) and [`_lwp_unpark`](https://man.netbsd.org/_lwp_unpark.2). These already provide the exact semantics of `thread::park` and `Thread::unpark`, but work with thread ids. In `std`, this ID is here stored in an atomic state variable, which is also used to optimize cases were the parking token is already available at the time `thread::park` is called.
Auto merge of #101613 - GuillaumeGomez:codeblock-tooltip, r=notriddle
Simplify codeblock and their associated tooltip
It is based on https://github.com/rust-lang/rust/pull/101600 so it needs to wait for this one to be merged first.
This PR does two things:
* Remove CSS class duplication by setting CSS classes such as `compile_fail` directly on the `div` wrapping both the codeblock and the tooltip.
* Simplify DOM: no need to wrap the tooltip into a `<div>`, it can work just as well without it.
You can test it [here](https://rustdoc.crud.net/imperio/codeblock-tooltip/std/string/struct.String.html#deref).
Auto merge of #101652 - Dylan-DPC:rollup-f4atky0, r=Dylan-DPC
Rollup of 6 pull requests
Successful merges:
- #101578 (remove bound var hack in `resolve`)
- #101606 (doc: fix minor typo)
- #101614 (Equate fn outputs when inferring RPITIT hidden types)
- #101631 (rustdoc: avoid cleaning modules with duplicate names)
- #101635 (Move `Queries::new` out of the macro)
- #101641 (Update browser-ui-test version to 0.9.8)
If we just subtype the signatures `fn() -> &'static str <: fn() -> _#1t` (where `_#1t` is the variable we've used to infer `impl Sized`), we'll end up `&'static str <: _#1t`, which causes us to infer `_#1t = #'_#2r str`, where `'_#2r` is unconstrained, which gets fixed up to `ReEmpty`, and which is certainly not what we want.
I can't actually think of a way to make this fail to compile, because during borrowck we've already done the method probe, and so we just look at the `impl` method signature and see the `&'static str` any time we call `<() as Foo>::bar()`. But this _does_ cause the ICE [here](https://github.com/rust-lang/rust/pull/98559#issuecomment-1241891994) in `@jackh726's` "Remove ReEmpty" PR (#98559) to stop ICEing, because after that PR we were leaking unconstrained region variables into the typeck results.
To keep the layout looking the same, the links need to not have `width: 100%` any more, relying instead on the box naturally growing to fit because it has `display: block`.
Similar to rust-lang/rust#100445, this adapts the new test added by rust-lang/rust#99207 to some relatively recent [LLVM changes](https://github.com/llvm/llvm-project/commit/057cabd997aeaef136e1e14f2ee645bd5bb197dd) that removed the function name from msan messages.
Found via our experimental rust + llvm @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/13347#018321b2-0cc3-4c91-b4db-774477e8b074
Rollup merge of #101595 - ehuss:fix-ice-flag-report, r=tmiasko
Fix ICE report flags display.
#92310 made some changes to the ICE report that displays the rustc flags, but it introduced a bug where a flag like `-Z incremental-verify-ich=yes` was being treated as-if it was `-Cincremental`. This corrupted the output and made it confusing. The cause was using `starts_with` instead of properly splitting the option.
For example, with the command like `rustc foo.rs -Cincremental=/tmp/a -Zincremental-verify-ich=yes --crate-type lib` would previously look like:
Rollup merge of #101413 - nicholasbishop:bishop-remove-uefi-static-reloc, r=petrochenkov
Use RelocModel::Pic for UEFI targets
In https://github.com/rust-lang/rust/pull/100537, the relocation model for UEFI targets was changed from PIC (the default value) to
static. There was some dicussion of this change here: https://github.com/rust-lang/rust/pull/100537#discussion_r952363012
It turns out that this can cause compilation to fail as described in https://github.com/rust-lang/rust/issues/101377, so switch back to PIC.
Auto merge of #99916 - dpaoliello:stablizerawdylib, r=wesleywiser
Stabilize raw-dylib for non-x86
This stabilizes the `raw-dylib` and `link_ordinal` features (#58713) for non-x86 architectures (i.e., `x86_64`, `aarch64` and `thumbv7a`):
* Marked the `raw_dylib` feature as `active`.
* Marked the `link_ordinal` attribute as `ungated`.
* Added new errors if either feature is used on x86 targets without the `raw_dylib` feature being enabled.
* Updated tests to only set the `raw_dylib` feature when building for x86.
Auto merge of #101617 - Dylan-DPC:rollup-iiy4ipc, r=Dylan-DPC
Rollup of 5 pull requests
Successful merges:
- #101366 (Restore old behaviour on broken UNC paths)
- #101492 (Suggest adding array lengths to references to arrays if possible)
- #101529 (Fix the example code and doctest for Formatter::sign_plus)
- #101573 (update `ParamKindOrd`)
- #101612 (Fix code generation of `Rvalue::Repeat` with 128 bit values)
Auto merge of #101611 - GuillaumeGomez:rollup-yw3qtug, r=GuillaumeGomez
Rollup of 5 pull requests
Successful merges:
- #101475 (Use futex-based locks and thread parker on Hermit)
- #101492 (Suggest adding array lengths to references to arrays if possible)
- #101495 (Compile spin_loop_hint as pause on x86 even without sse2 enabled)
- #101529 (Fix the example code and doctest for Formatter::sign_plus)
- #101600 (rustdoc: simplify the codeblock tooltip)
Nicholas Bishop [Sun, 4 Sep 2022 16:42:03 +0000 (12:42 -0400)]
Use RelocModel::Pic for UEFI targets
In https://github.com/rust-lang/rust/pull/100537, the relocation model
for UEFI targets was changed from PIC (the default value) to
static. There was some dicussion of this change here:
https://github.com/rust-lang/rust/pull/100537#discussion_r952363012
It turns out that this can cause compilation to fail as described in
https://github.com/rust-lang/rust/issues/101377, so switch back to PIC.
To keep the layout looking the same, the links need to not have
`width: 100%` any more, relying instead on the box naturally growing to
fit because it has `display: block`.
Rollup merge of #101529 - mousetail:patch-2, r=thomcc
Fix the example code and doctest for Formatter::sign_plus
The provided example to the `sign_plus` method on `fmt` was broken, it displays the `-` sign twice for negative numbers.
This pull request should fix the issue by `.abs()` ing the number so that the negative sign appears only once. It is just one possible solution to the issue, not sure if it's the best. However, this one will behave as expected when combined with fill and alignment operators.
Rollup merge of #101366 - ChrisDenton:unc-forward-slash, r=m-ou-se
Restore old behaviour on broken UNC paths
This fixes #101358 by restoring the behaviour from previous stable Rust versions. I'm not convinced this is ultimately right but I think it's less wrong and maybe this should be backported to beta?
This PR moves the tooltip into example-wrap, simplifying several overly-complex aspects of how these tooltips work:
* The mousover javascript can be removed, because hovering example-wrap can style the tooltip inside.
* The sibling selecor can be removed, because hovering the tooltip also hovers the wrapper, which can hover the codeblock itself.
* The relative positioning of the `<li>` tag, which was added in https://github.com/rust-lang/rust/commit/e861efd9f9ca45c1048a256812dfe8faffbb1367 to fix the positioning of the code tooltip, can now be removed, because example-wrap itself already has relative positioning.
Rollup merge of #101529 - mousetail:patch-2, r=thomcc
Fix the example code and doctest for Formatter::sign_plus
The provided example to the `sign_plus` method on `fmt` was broken, it displays the `-` sign twice for negative numbers.
This pull request should fix the issue by `.abs()` ing the number so that the negative sign appears only once. It is just one possible solution to the issue, not sure if it's the best. However, this one will behave as expected when combined with fill and alignment operators.
Rollup merge of #101495 - bjorn3:pause-no-sse2, r=Mark-Simulacrum
Compile spin_loop_hint as pause on x86 even without sse2 enabled
The x86 `pause` instruction was introduced with sse2, but because it is encoded as `rep nop`, it works just fine on cpu's without sse2 support. It just doesn't do anything.
Rollup merge of #101475 - joboet:hermit_futex_locks, r=m-ou-se
Use futex-based locks and thread parker on Hermit
[Hermit now has futex syscalls](https://github.com/hermitcore/libhermit-rs/pull/534), which means Hermit can share the well-tested and performant locks and thread parker used on Linux.
Michael Howell [Fri, 9 Sep 2022 00:46:57 +0000 (17:46 -0700)]
rustdoc: simplify the codeblock tooltip
This commit moves the tooltip into example-wrap, simplifying allowing several
overly-complex things to be fixed:
* The mousover javascript can be removed, because hovering example-wrap can
style the tooltip inside.
* The sibling selecor can be removed, because hovering the tooltip also
hovers the wrapper, which can hover the codeblock itself.
* The relative positioning of the `<li>` tag, which was added in e861efd9f9ca45c1048a256812dfe8faffbb1367 to fix the positioning of the code
tooltip, can now be removed, because example-wrap itself already has
relative positioning.
Auto merge of #101527 - Kobzol:ci-update-llvm, r=Mark-Simulacrum
Update LLVM used in x86 CI dist builds to `15.0.0`
LLVM 15.0.0 has been released, so we can use it in CI builds. We need (at least) LLVM 15 for BOLT, and we regularly update to most recent stable versions. It would also be good to first see the perf. effect of upgrading by itself, to have a better baseline for BOLT.
Rollup merge of #101556 - compiler-errors:tweak-generator-print, r=jackh726
Tweak future opaque ty pretty printing
1. The `Return` type of a generator doesn't need to be a lang item just for diagnostic printing of types
2. We shouldn't suppress the `Output = Ty` of a opaque future if the type is a int or float var.
Auto merge of #101224 - compiler-errors:rpitit, r=oli-obk
Initial implementation of return-position `impl Trait` in traits
* Create a new item kind, called `ImplTraitPlaceholder`, which is used to lower `ast::TyKind::ImplTrait` in trait method returns.
* This item is the child of the trait method, which simplifies the way we calculate bounds and stuff.
* Use the def-id of this type to construct a projection type that we use during astconv for the return type of the trait method signature.
* Implement logic to normalize this `ImplTraitPlaceholder` projection type when we know its concrete impl (this is pretty limited currently, but really there are no other selection candidates that make sense -- for now!)
* Check that the `impl Trait`'s bounds are satisfied on the concrete type provided in the impl.
This is obviously nowhere near complete, but I wanted to at least get some initial support landed so we can start playing around with it.
What works:
* async fn in trait and RPITIT, including multiple `impl Trait`s and `impl Trait` nested in associated type bindings, like `impl Future<Output = impl Sized>`