Use similar compression settings as before updating to use flate2
Fixes#42879
(My first PR to rust-lang yay)
This changes the compression settings back to how they were before the change to use the flate2 crate rather than the in-tree flate library. The specific changes are to use the `Fast` compression level (which should be equivialent to what was used before), and use a raw deflate stream rather than wrapping the stream in a zlib wrapper. The [zlib](https://tools.ietf.org/html/rfc1950) wrapper adds an extra 2 bytes of header data, and 4 bytes for a checksum at the end. The change to use a faster compression level did give some compile speedups in the past (see #37298). Having to calculate a checksum also added a small overhead, which didn't exist before the change to flate2.
r? @alexcrichton
Only match a fragment specifier the if it starts with certain tokens.
When trying to match a fragment specifier, we first predict whether the current token can be matched at all. If it cannot be matched, don't bother to push the Earley item to `bb_eis`. This can fix a lot of issues which otherwise requires full backtracking (#42838).
In this PR the prediction treatment is not done for `:item`, `:stmt` and `:tt`, but it could be expanded in the future.
Fixes#24189.
Fixes#26444.
Fixes#27832.
Fixes#34030.
Fixes#35650.
Fixes#39964.
Fixes the 4th comment in #40569.
Fixes the issue blocking #40984.
Test src/doc once more
This was accidentally broken in https://github.com/rust-lang/rust/pull/42437 since we filtered too early to recurse into sub-directories.
In theory, @bors p=10
r? @alexcrichton
Fix feature gate for `#[link_args(..)]` attribute
Fix feature gate for `#[link_args(..)]` attribute so that it will fire regardless of context of attribute.
See also #29596 and #43106
Store all generic arguments for method calls in AST/HIR
The first part of https://github.com/rust-lang/rust/pull/42492.
Landed separately to start the process of merging libsyntax changes breaking rustfmt, which is not easy these days.
Fix stage 2 builds with a custom libdir.
When copying libstd for the stage 2 compiler, the builder ignores the
configured libdir/libdir_relative configuration parameters. This causes
the compiler to fail to find libstd, which cause any tools built with the
stage 2 compiler to fail.
To fix this, make the copy steps of rustbuild aware of the libdir_relative
parameter when the stage >= 2. Also update the dist target to be aware of
the new location of libstd.
Implemented `TypeFoldable` for `TypeError`s.
This is quite handy in some user code, for instance to pull out type errors from an inference context when `fresh_substs_for_item` has been used before.
Remove unused code from librustc_errors
While extracting librustc_errors into a [reusable library](https://github.com/kevinmehall/codemap-diagnostic), I noticed some obsolete code that the `dead_code` warning missed because it was marked `pub` but not used elsewhere.
Fold E0612, E0613 into E0609
As discussed in #42945, with PR 1506 tuple indices are no longer considered a separate case from normal field. This PR folds E06012 ("tuple index out of bounds") and E0613 ("type is not a tuple") into E0609 ("type does not have field with that name")
Resolves#42945
Fix Rustbuild linking on Illumos
Illumos (an OpenSolaris fork) expects to get several extra library references for some system functions used by Rust standard library. This commit adds required linker options to rustbuild, which is currently doesn't work on Illumos-based operating systems.
Implement O(1)-time Iterator::nth for Range*, and slim the Step trait
Fixes#43064.
Fixes part of #39975.
Fixes items 1 <s>and 3</s> of #42168.
CC #27741.
I think #42310 and #43012 should not have landed without the `nth` part of this PR, but oh well.
Skip the main thread's manual stack guard on Linux
Linux doesn't allocate the whole stack right away, and the kernel has its own stack-guard mechanism to fault when growing too close to an existing mapping. If we map our own guard, then the kernel starts enforcing a rather large gap above that, rendering much of the possible stack space useless.
Instead, we'll just note where we expect rlimit to start faulting, so our handler can report "stack overflow", and trust that the kernel's own stack guard will work.
Fixes#43052.
r? @alexcrichton
### Kernel compatibility:
Strictly speaking, Rust claims support for Linux kernels >= 2.6.18, and stack guards were only added to mainline in 2.6.36 for [CVE-2010-2240]. But since that vulnerability was so severe, the guards were backported to many stable branches, and Red Hat patched this all the way back to RHEL3's 2.4.21! I think it's reasonable for us to assume that any *supportable* kernel should have these stack guards.
At that time, the kernel only enforced one page of padding between the stack and other mappings, but thanks to [Stack Clash] that padding is now much larger, causing #43052. The kernel side of those fixes are in [CVE-2017-1000364], which Red Hat has backported to at least RHEL5's 2.6.18 so far.
[CVE-2010-2240]: https://access.redhat.com/security/cve/CVE-2010-2240
[CVE-2017-1000364]: https://access.redhat.com/security/cve/CVE-2017-1000364
[Stack Clash]: https://access.redhat.com/security/vulnerabilities/stackguard
When copying libstd for the stage 2 compiler, the builder ignores the
configured libdir/libdir_relative configuration parameters. This causes
the compiler to fail to find libstd, which cause any tools built with the
stage 2 compiler to fail.
To fix this, make the copy steps of rustbuild aware of the libdir_relative
parameter when the stage >= 2. Also update the dist target to be aware of
the new location of libstd.