make generalization code create new variables in correct universe
In our type inference system, when we "generalize" a type T to become
a suitable value for a type variable V, we sometimes wind up creating
new inference variables. So, for example, if we are making V be some
subtype of `&'X u32`, then we might instantiate V with `&'Y u32`.
This generalized type is then related `&'Y u32 <: &'X u32`, resulting
in a region constriant `'Y: 'X`. Previously, however, we were making
these fresh variables like `'Y` in the "current universe", but they
should be created in the universe of V. Moreover, we sometimes cheat
in an invariant context and avoid creating fresh variables if we know
the result must be equal -- we can only do that when the universes
work out.
Fixes#57843
r? @pnkfelix
Make overflowing and wrapping negation const
Remember that the signed and unsigned versions are slightly different here, so there's four functions made const instead of just two.
Reduce Some Code Repetitions like `(n << amt) >> amt`
This Pull Request is related to [#49937](https://github.com/rust-lang/rust/issues/49937).
This Pull Request has reduced repetition of `(n << amt) >> amt`.
Fix typo in std::future::Future docs
I am not quite sure if this is actually a typo but
1. to me the sentence doesn't make sense if it says "expect"
2. I hope that `Future`s are not really allowed to cause memory unsafety if they are polled after completion.
Explain a panic in test case net::tcp::tests::double_bind
Those who try to build libstd on the Windows Subsystem for Linux experience a single failing test, where the point of failure is an explicit but anonymous panic, as reported in https://github.com/rust-lang/rust/issues/49367
This commit somewhat explains why and allows diagnosing a little.
Fix doc for rustc "-g" flag
The rustc `-g` CLI flag was miss documented to be a synonym of `-C debug-level=2` and not `-C debuglevel=2`. Also add links to the codegen docs for each synonym.
I am unsure of this will conflict with work on #52938
Add alias methods to PathBuf for underlying OsString (#58234)
Implemented the following methods on PathBuf which forward to the underlying OsString.
- capacity
- with_capacity
- clear
- reserve
- reserve_exact
- shrink_to_fit
- shrink_to
These methods have been documented with reference to the original docs for `OsString`. @Mark-Simulacrum please let me know if you feel this does not suffice.
Further, I've not yet included tests for these definitions - please advise on how comprehensive tests need to be for methods such as these that simply alias other (already tested) methods.
(This PR addresses issue #58234)
Monomorphize less code in fs::{read|write}
Since the generic-ness is only for the as_refs, might as well have std just compile the important part once instead of on every use.
Fix search results interactions
The bug is visible when you search for "none": the second tab is empty and therefore it messes with the classes. Then when you try to use arrows on the third tab, it just crashes (because only 2 "search-results" are present and you're on tab 3).
r? @QuietMisdreavus
Modify doctest's auto-`fn main()` to allow `Result`s
This lets the default `fn main()` ~~return `impl Termination`~~ unwrap Results, which allows the use of `?` in most tests without adding it manually. This fixes#56260
~~Blocked on `std::process::Termination` stabilization.~~
Using `Termination` would have been cleaner, but this should work OK.
rustdoc: Don't modify library path for doctests
It shouldn't be needed anymore because doctests are no longer compiled with `prefer-dynamic` (since #54939).
r? @QuietMisdreavus
ci: fix docker cache hash collision
#58416 uncovered a bug in our caching for docker images: if the image `foo` pulls files from the image `bar` and a file in `bar` changed, the hash of `foo` will be the same even though it should be different. In that PR's case, `dist-i686-linux` pulls scripts from `dist-x86_64-linux`, and the PR only changed those scripts, causing an hash collision for `dist-i686-linux`.
We have to fix this, since the image will be rebuilt every time bors switches from testing master to testing beta/stable (and when it switches back), making CI way more painful than it currently is.
The approach used by this PR is to just include all the files in `src/ci/docker` in the hash. It's a bit heavy-handed and it will cause a rebuild of all the images every time a single image changes, but it's the best I can think of.
r? @Mark-Simulacrum
cc @alexcrichton @kennytm
Before this commit the hash used to cache docker images was calculated
from the image's files and the files in the scripts/ directory. This
worked fine when all the files used by an image were in those
directories, but some images pull files from other images, causing hash
collisions in some cases.
This commit changes the hash to include the files of all the docker
images, causing a rebuild of all the images when a single one changes.
That's a bit heavy-handed, but we have no way to track which files an
image pulls in and hash collisions are really painful to deal with.