Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize -Z instrument-coverage as -C instrument-coverage #90132

Merged
merged 6 commits into from
Feb 5, 2022

Conversation

joshtriplett
Copy link
Member

(Tracking issue for instrument-coverage: #79121)

This PR stabilizes support for instrumentation-based code coverage, previously provided via the -Z instrument-coverage option. (Continue supporting -Z instrument-coverage for compatibility for now, but show a deprecation warning for it.)

Many, many people have tested this support, and there are numerous reports of it working as expected.

Move the documentation from the unstable book to stable rustc documentation. Update uses and documentation to use the -C option.

Addressing questions raised in the tracking issue:

If/when stabilized, will the compiler flag be updated to -C instrument-coverage? (If so, the -Z variant could also be supported for some time, to ease migrations for existing users and scripts.)

This stabilization PR updates the option to -C and keeps the -Z variant to ease migration.

The Rust coverage implementation depends on (and automatically turns on) -Z symbol-mangling-version=v0. Will stabilizing this feature depend on stabilizing v0 symbol-mangling first? If so, what is the current status and timeline?

This stabilization PR depends on #90128 , which stabilizes -C symbol-mangling-version=v0 (but does not change the default symbol-mangling-version).

The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM.

Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement.

The tracking issue and the issue label A-code-coverage link to a few open issues related to instrument-coverage, but none of them seem like showstoppers. All of them seem like improvements and refinements we can make after stabilization.

The original -Z instrument-coverage support went through a compiler-team MCP at rust-lang/compiler-team#278 . Based on that, @pnkfelix suggested that this needed a stabilization PR and a compiler-team FCP.

@rust-highfive
Copy link
Collaborator

Some changes occured to rustc_codegen_gcc

cc @antoyo

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 21, 2021
@joshtriplett joshtriplett added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 21, 2021
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in this PR look good to me.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@antoyo antoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gcc part looks good to me.

@richkadel
Copy link
Contributor

You may also need to stablize the #[no_coverage] attribute as well. See #84605. It's a minimal solution at present, but I think sufficient for the time being. Stablizing will allow you to move the references to that attribute to the stable docs, resolving the broken link here.

@Mark-Simulacrum
Copy link
Member

The documentation I think currently points users towards installing/using https://crates.io/crates/cargo-cov, which looks both somewhat old and is not a rust-lang crate. I think we generally try to stay away from third party tools being directly referenced by our documentation, and especially it worries me when it says "may eat your laundry". We also point towards https://crates.io/crates/cargo-binutils and json5format, the latter of which seems entirely unnecessary.

I also note that the recommended path is making use of the llvm-tools-preview component, which I am somewhat uncomfortable with: as it notes, it's intentionally a preview component and while we have no firm policy, we don't treat it as really stable. Obviously, users can find llvm-cov in distros and such too, but that feels a little bit outside the beaten path. This component is not currently nightly-only, but only because it's introduction predates the ability to declare components as nightly only, I think.

In general, I think usage of LLVM tools (e.g., profdata, cov) should be OK -- we may want to consider uplifting them to a separate component and we should check with upstream that they're expected to stick around. (For example, the split-dwarf effort discovered that the LLVM tool it wanted to use is not well maintained, IIRC). But I would like us to drop references to third-party crates or consider whether they should be blessed from the documentation before we stabilize.

I think regardless, we need a description in the documentation for this flag as to what is considered stable (and if LLVM upstream or whatever changes, we need to workaround and patch to keep same behavior) and what isn't. This will be useful for future PR review making changes to this feature, such as #90047.

@richkadel
Copy link
Contributor

@Mark-Simulacrum - These are all good concerns/recommendations.

Since I wrote most of the initial docs, its reasonable someone might want me to make at least some of the required changes, but...

I'll be out of office for about 3 weeks, without a laptop, starting tonight. (I'll probably check email via my phone, periodically, in case there's a question I can answer.)

Please keep @tmandry in the loop. He may be able to help with some parts of this. And if I can help when I return, I will.

Thanks!

@joshtriplett
Copy link
Member Author

I'm happy to update the documentation.

@cuviper
Copy link
Member

cuviper commented Oct 22, 2021

requiring LLVM 11 for coverage support seems like a reasonable requirement.

We're also bumping the overall minimum to LLVM 11 in #90062.

@joshtriplett
Copy link
Member Author

@richkadel I've updated the link to point to #[no_coverage] in the unstable book for the moment. We can always stabilize #[no_coverage] after this, but I'd like to avoid combining the two stabilizations.

@joshtriplett
Copy link
Member Author

@Mark-Simulacrum The documentation doesn't point towards the cargo-cov crate; it's using cargo-cov from cargo-binutils.

I've rewritten the documentation to use the LLVM tools directly. It still mentions the existence of llvm-tools-preview, but notes that it is still experimental.

@joshtriplett
Copy link
Member Author

I think I've now addressed all of the open issues, except that the example still uses json5format. I do think it's important that the example uses something with a command-line tool, tests, and doctests; it'd be trivial to replace the command-line example with something like this:

fn main() {
    if let arg = std::env::args().nth(1).next() {
        println!("{}", arg);
    } else {
        println!("no argument");
    }
}

But such an example wouldn't show how to handle tests or doctests.

We've had this as the unstable documentation for quite some time, and while unstable features do get less usage, the unstable book is still official Rust documentation. I would propose that we merge the (now-rewritten) version, complete with the example using json5format; I don't think doing so amounts to blessing the json5format crate as anything other than "a crate on which we're demonstrating the use of instrument-coverage".

@pietroalbini
Copy link
Member

I have a couple questions around this stabilization:

  • Programs instrumented with this flag are currently emitting version 4 of the coverage mapping format, but there is already a PR bumping the format to version 6 (Update CoverageMappingFormat to Version6 #90047). What's the expected stability of the format of the emitted coverage files?

  • The implementation seems to be tied with LLVM (the environment variable is called LLVM_PROFILE_FILE, instrumented programs rely on compiler-rt...), how is this feature expected to work with alternate codegen backends?

@joshtriplett
Copy link
Member Author

@pietroalbini I would expect a relatively recent stable version of LLVM tooling to be required; in particular, I would not expect it to be required to work with tools from the oldest version of LLVM we support. I'll add documentation noting that the format will evolve over time, but will always work with a stable LLVM.

Regarding other codegen backends, in theory they could emit data in the same format. I would expect otherwise that they should produce an error comparable to the one produced by a build with an old LLVM.

@pietroalbini
Copy link
Member

I would expect a relatively recent stable version of LLVM tooling to be required; in particular, I would not expect it to be required to work with tools from the oldest version of LLVM we support. I'll add documentation noting that the format will evolve over time, but will always work with a stable LLVM.

Hmm, I'm worried about emitting an unstable format from a stable flag, especially one that won't be niche like this one.

Thinking about the experience for end users, we recommend installing the tools required to use the generated files from the user's distribution, but for example neither Debian nor Ubuntu have LLVM 13 tools available in their stable distribution, and Debian lacks LLVM 12 tools too. Other distributions also likely ship older LLVM versions. If the compiler is free to bump the version of the format, those users will have their coverage setup break when updating the stable compiler.

Bumping the format without considering backward compatibility will also break everyone who uses third party tools to parse those files. cargo-tarpaulin, a fairly popular code coverage tool for Rust, is developing a pure-Rust parser for the format to avoid requiring the LLVM tools being installed, and I could definitely see tools being written to convert from the coverage information Rust emits into other formats if someone needs to integrate Rust code coverage inside a larger project.

Right now using this flag in a supported way (without llvm-tools-preview) implies coverage support will break eventually if someone updates the stable compiler, which I don't think is appropriate for a stable flag.

Regarding other codegen backends, in theory they could emit data in the same format. I would expect otherwise that they should produce an error comparable to the one produced by a build with an old LLVM.

Hmm, yeah. Would we expect the environment variable to still be LLVM_PROFILE_FLAG then?

@tmandry
Copy link
Member

tmandry commented Oct 22, 2021

There are two formats, the profile data itself and the source mapping.

As I understand it, the profiles have no backwards compatibility guarantees. There is a version number that gets bumped with every change that is not backwards compatible, but older versions are not supported. The best way of guaranteeing compatibility for these is to release llvm-profdata with the Rust compiler. There's a decent chance that using tooling from the same major version of LLVM will work, but I don't know if that's guaranteed (@petrhosek may know more).

For the source mapping I'm not sure about backwards compatibility, but if it's the same story then we should release llvm-cov as well.

@joshtriplett
Copy link
Member Author

To clarify: my expectation would be that we would occasionally bump the compatibility requirements of the format when there is a specific need to do so, such as new functionality we require, and I would expect us to not keep the version requirement in lockstep with our baseline requirement for LLVM, but I would still expect us to put thought into bumping the format compatibility forward. If, for example, cargo tarpaulin had support for a certain format version, I think we would take that into account before bumping our compatibility requirements past that.

Long-term, I do think either something like cargo tarpaulin or something distributed by rustup would be the smoothest experience. But I don't think we need to wait for that before shipping support for an otherwise widely used format.

Regarding the environment variable, I had interpreted LLVM_PROFILE_FILE as "file to put the profile in LLVM format" rather than "file where the LLVM-backend-generated code should put the profile".

@pietroalbini
Copy link
Member

Long-term, I do think either something like cargo tarpaulin or something distributed by rustup would be the smoothest experience. But I don't think we need to wait for that before shipping support for an otherwise widely used format.

As I understand it, the profiles have no backwards compatibility guarantees. There is a version number that gets bumped with every change that is not backwards compatible, but older versions are not supported. The best way of guaranteeing compatibility for these is to release llvm-profdata with the Rust compiler. There's a decent chance that using tooling from the same major version of LLVM will work, but I don't know if that's guaranteed (petrhosek may know more).

For the source mapping I'm not sure about backwards compatibility, but if it's the same story then we should release llvm-cov as well.

Shipping llvm-profdata and llvm-cov in a coverage-tools rustup component would definitely alleviate the concerns for end users, and it'd be great to do it along with this stabilization.

To clarify: my expectation would be that we would occasionally bump the compatibility requirements of the format when there is a specific need to do so, such as new functionality we require, and I would expect us to not keep the version requirement in lockstep with our baseline requirement for LLVM, but I would still expect us to put thought into bumping the format compatibility forward. If, for example, cargo tarpaulin had support for a certain format version, I think we would take that into account before bumping our compatibility requirements past that.

Taking into account other tools is good, but we don't know all of the tools that will rely on the format and not all of those tools will be publicly available. Our stability guarantee can't be limited to just tools we're aware of.

Also, can we actually tell LLVM not to generate files in a newer format if we don't have a specific need for the changes? Otherwise we'd be forced to either make the breaking change or avoid bumping LLVM as a whole.

Regarding the environment variable, I had interpreted LLVM_PROFILE_FILE as "file to put the profile in LLVM format" rather than "file where the LLVM-backend-generated code should put the profile".

Good point! I didn't see it that way, but it makes sense!

@wesleywiser
Copy link
Member

Also, can we actually tell LLVM not to generate files in a newer format if we don't have a specific need for the changes? Otherwise we'd be forced to either make the breaking change or avoid bumping LLVM as a whole.

Yes, we're actually still using version 4 even though the latest available version in LLVM 13 is version 6.

@richkadel
Copy link
Contributor

FYI while it's likely true that the coverage mapping format can be controlled because we generate it, the profraw data generated by the running binary is not under rustc control. I'm not aware of any kind of flag or environment variable to tell the llvm runtime libraries what output format you want for that, which is why we probably need to bundle the required tools matching the version of llvm used by a given version of rustc.

@bors

This comment has been minimized.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 4, 2022
@bors
Copy link
Contributor

bors commented Feb 4, 2022

⌛ Testing commit 3187f41 with merge 7c88966249ed78522e3f23357a849800e61acffd...

@bors
Copy link
Contributor

bors commented Feb 4, 2022

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 4, 2022
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@wesleywiser
Copy link
Member

Looks like i686-msvc-1 timed out while running stage 2 tests.

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 4, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 5, 2022
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#90132 (Stabilize `-Z instrument-coverage` as `-C instrument-coverage`)
 - rust-lang#91589 (impl `Arc::unwrap_or_clone`)
 - rust-lang#93495 (kmc-solid: Fix off-by-one error in `SystemTime::now`)
 - rust-lang#93576 (Emit more valid HTML from rustdoc)
 - rust-lang#93608 (Clean up `find_library_crate`)
 - rust-lang#93612 (doc: use U+2212 for minus sign in integer MIN/MAX text)
 - rust-lang#93615 (Fix `isize` optimization in `StableHasher` for big-endian architectures)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2fe9a32 into rust-lang:master Feb 5, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 5, 2022
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Feb 10, 2022
@joshtriplett joshtriplett deleted the stabilize-instrument-coverage branch February 21, 2022 20:56
kazuk added a commit to kazuk/grcov that referenced this pull request Mar 2, 2022
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Apr 15, 2022
Pkgsrc changes:
 * Bump available bootstraps to 1.59.0.
 * Delete one patch which no longer applies,
   adjust another.

Upstream changes:

Version 1.60.0 (2022-04-07)
==========================

Language
--------
- [Stabilize `#[cfg(panic = "...")]` for either `"unwind"` or `"abort"`.]
  [93658]
- [Stabilize `#[cfg(target_has_atomic = "...")]` for each integer
  size and `"ptr"`.][93824]

Compiler
--------
- [Enable combining `+crt-static` and `relocation-model=pic` on
  `x86_64-unknown-linux-gnu`][86374]
- [Fixes wrong `unreachable_pub` lints on nested and glob public
  reexport][87487]
- [Stabilize `-Z instrument-coverage` as `-C instrument-coverage`][90132]
- [Stabilize `-Z print-link-args` as `--print link-args`][91606]
- [Add new Tier 3 target `mips64-openwrt-linux-musl`\*][92300]
- [Add new Tier 3 target `armv7-unknown-linux-uclibceabi` (softfloat)\*][92383]
- [Fix invalid removal of newlines from doc comments][92357]
- [Add kernel target for RustyHermit][92670]
- [Deny mixing bin crate type with lib crate types][92933]
- [Make rustc use `RUST_BACKTRACE=full` by default][93566]
- [Upgrade to LLVM 14][93577]

\* Refer to Rust's [platform support page][platform-support-doc] for more
   information on Rust's tiered platform support.

Libraries
---------
- [Guarantee call order for `sort_by_cached_key`][89621]
- [Improve `Duration::try_from_secs_f32`/`f64` accuracy by directly
  processing exponent and mantissa][90247]
- [Make `Instant::{duration_since, elapsed, sub}` saturating][89926]
- [Remove non-monotonic clocks workarounds in `Instant::now`][89926]
- [Make `BuildHasherDefault`, `iter::Empty` and `future::Pending`
  covariant][92630]

Stabilized APIs
---------------
- [`Arc::new_cyclic`][arc_new_cyclic]
- [`Rc::new_cyclic`][rc_new_cyclic]
- [`slice::EscapeAscii`][slice_escape_ascii]
- [`<[u8]>::escape_ascii`][slice_u8_escape_ascii]
- [`u8::escape_ascii`][u8_escape_ascii]
- [`Vec::spare_capacity_mut`][vec_spare_capacity_mut]
- [`MaybeUninit::assume_init_drop`][assume_init_drop]
- [`MaybeUninit::assume_init_read`][assume_init_read]
- [`i8::abs_diff`][i8_abs_diff]
- [`i16::abs_diff`][i16_abs_diff]
- [`i32::abs_diff`][i32_abs_diff]
- [`i64::abs_diff`][i64_abs_diff]
- [`i128::abs_diff`][i128_abs_diff]
- [`isize::abs_diff`][isize_abs_diff]
- [`u8::abs_diff`][u8_abs_diff]
- [`u16::abs_diff`][u16_abs_diff]
- [`u32::abs_diff`][u32_abs_diff]
- [`u64::abs_diff`][u64_abs_diff]
- [`u128::abs_diff`][u128_abs_diff]
- [`usize::abs_diff`][usize_abs_diff]
- [`Display for io::ErrorKind`][display_error_kind]
- [`From<u8> for ExitCode`][from_u8_exit_code]
- [`Not for !` (the "never" type)][not_never]
- [_Op_`Assign<$t> for Wrapping<$t>`][wrapping_assign_ops]
- [`arch::is_aarch64_feature_detected!`][is_aarch64_feature_detected]

Cargo
-----
- [Port cargo from `toml-rs` to `toml_edit`][cargo/10086]
- [Stabilize `-Ztimings` as `--timings`][cargo/10245]
- [Stabilize namespaced and weak dependency features.][cargo/10269]
- [Accept more `cargo:rustc-link-arg-*` types from build script
  output.][cargo/10274]
- [cargo-new should not add ignore rule on Cargo.lock inside
  subdirs][cargo/10379]

Misc
----
- [Ship docs on Tier 2 platforms by reusing the closest Tier 1
  platform docs][92800]
- [Drop rustc-docs from complete profile][93742]
- [bootstrap: tidy up flag handling for llvm build][93918]

Compatibility Notes
-------------------
- [Remove compiler-rt linking hack on Android][83822]
- [Mitigations for platforms with non-monotonic clocks have been removed from
  `Instant::now`][89926]. On platforms that don't provide monotonic clocks, an
  instant is not guaranteed to be greater than an earlier instant anymore.
- [`Instant::{duration_since, elapsed, sub}` do not panic anymore on underflow,
  saturating to `0` instead][89926]. In the real world the panic happened mostly
  on platforms with buggy monotonic clock implementations rather than catching
  programming errors like reversing the start and end times. Such programming
  errors will now results in `0` rather than a panic.
- In a future release we're planning to increase the baseline requirements for
  the Linux kernel to version 3.2, and for glibc to version 2.17. We'd love
  your feedback in [PR #95026][95026].

Internal Changes
----------------

These changes provide no direct user facing benefits, but represent
significant improvements to the internals and overall performance
of rustc and related tools.

- [Switch all libraries to the 2021 edition][92068]

[83822]: rust-lang/rust#83822
[86374]: rust-lang/rust#86374
[87487]: rust-lang/rust#87487
[89621]: rust-lang/rust#89621
[89926]: rust-lang/rust#89926
[90132]: rust-lang/rust#90132
[90247]: rust-lang/rust#90247
[91606]: rust-lang/rust#91606
[92068]: rust-lang/rust#92068
[92300]: rust-lang/rust#92300
[92357]: rust-lang/rust#92357
[92383]: rust-lang/rust#92383
[92630]: rust-lang/rust#92630
[92670]: rust-lang/rust#92670
[92800]: rust-lang/rust#92800
[92933]: rust-lang/rust#92933
[93566]: rust-lang/rust#93566
[93577]: rust-lang/rust#93577
[93658]: rust-lang/rust#93658
[93742]: rust-lang/rust#93742
[93824]: rust-lang/rust#93824
[93918]: rust-lang/rust#93918
[95026]: rust-lang/rust#95026

[cargo/10086]: rust-lang/cargo#10086
[cargo/10245]: rust-lang/cargo#10245
[cargo/10269]: rust-lang/cargo#10269
[cargo/10274]: rust-lang/cargo#10274
[cargo/10379]: rust-lang/cargo#10379

[arc_new_cyclic]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_cyclic
[rc_new_cyclic]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_cyclic
[slice_escape_ascii]: https://doc.rust-lang.org/stable/std/slice/struct.EscapeAscii.html
[slice_u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.escape_ascii
[u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.escape_ascii
[vec_spare_capacity_mut]: https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.spare_capacity_mut
[assume_init_drop]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_drop
[assume_init_read]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_read
[i8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.abs_diff
[i16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.abs_diff
[i32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.abs_diff
[i64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.abs_diff
[i128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.abs_diff
[isize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.abs_diff
[u8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.abs_diff
[u16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.abs_diff
[u32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.abs_diff
[u64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.abs_diff
[u128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.abs_diff
[usize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.abs_diff
[display_error_kind]: https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#impl-Display
[from_u8_exit_code]: https://doc.rust-lang.org/stable/std/process/struct.ExitCode.html#impl-From%3Cu8%3E
[not_never]: https://doc.rust-lang.org/stable/std/primitive.never.html#impl-Not
[wrapping_assign_ops]: https://doc.rust-lang.org/stable/std/num/struct.Wrapping.html#trait-implementations
[is_aarch64_feature_detected]: https://doc.rust-lang.org/stable/std/arch/macro.is_aarch64_feature_detected.html
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request May 25, 2022
Pkgsrc changes:
 * Bump available bootstraps to 1.59.0.
 * Adjust line number in patches which had non-zero offsets.

Upstream changes:

Version 1.60.0 (2022-04-07)
===========================

Language
--------
- [Stabilize `#[cfg(panic = "...")]` for either `"unwind"` or `"abort"`.]
  [93658]
- [Stabilize `#[cfg(target_has_atomic = "...")]` for each integer
  size and `"ptr"`.][93824]

Compiler
--------
- [Enable combining `+crt-static` and `relocation-model=pic` on
  `x86_64-unknown-linux-gnu`][86374]
- [Fixes wrong `unreachable_pub` lints on nested and glob public
  reexport][87487]
- [Stabilize `-Z instrument-coverage` as `-C instrument-coverage`][90132]
- [Stabilize `-Z print-link-args` as `--print link-args`][91606]
- [Add new Tier 3 target `mips64-openwrt-linux-musl`\*][92300]
- [Add new Tier 3 target `armv7-unknown-linux-uclibceabi` (softfloat)\*][92383]
- [Fix invalid removal of newlines from doc comments][92357]
- [Add kernel target for RustyHermit][92670]
- [Deny mixing bin crate type with lib crate types][92933]
- [Make rustc use `RUST_BACKTRACE=full` by default][93566]
- [Upgrade to LLVM 14][93577]

\* Refer to Rust's [platform support page][platform-support-doc] for more
   information on Rust's tiered platform support.

Libraries
---------
- [Guarantee call order for `sort_by_cached_key`][89621]
- [Improve `Duration::try_from_secs_f32`/`f64` accuracy by directly
  processing exponent and mantissa][90247]
- [Make `Instant::{duration_since, elapsed, sub}` saturating][89926]
- [Remove non-monotonic clocks workarounds in `Instant::now`][89926]
- [Make `BuildHasherDefault`, `iter::Empty` and `future::Pending`
  covariant][92630]

Stabilized APIs
---------------
- [`Arc::new_cyclic`][arc_new_cyclic]
- [`Rc::new_cyclic`][rc_new_cyclic]
- [`slice::EscapeAscii`][slice_escape_ascii]
- [`<[u8]>::escape_ascii`][slice_u8_escape_ascii]
- [`u8::escape_ascii`][u8_escape_ascii]
- [`Vec::spare_capacity_mut`][vec_spare_capacity_mut]
- [`MaybeUninit::assume_init_drop`][assume_init_drop]
- [`MaybeUninit::assume_init_read`][assume_init_read]
- [`i8::abs_diff`][i8_abs_diff]
- [`i16::abs_diff`][i16_abs_diff]
- [`i32::abs_diff`][i32_abs_diff]
- [`i64::abs_diff`][i64_abs_diff]
- [`i128::abs_diff`][i128_abs_diff]
- [`isize::abs_diff`][isize_abs_diff]
- [`u8::abs_diff`][u8_abs_diff]
- [`u16::abs_diff`][u16_abs_diff]
- [`u32::abs_diff`][u32_abs_diff]
- [`u64::abs_diff`][u64_abs_diff]
- [`u128::abs_diff`][u128_abs_diff]
- [`usize::abs_diff`][usize_abs_diff]
- [`Display for io::ErrorKind`][display_error_kind]
- [`From<u8> for ExitCode`][from_u8_exit_code]
- [`Not for !` (the "never" type)][not_never]
- [_Op_`Assign<$t> for Wrapping<$t>`][wrapping_assign_ops]
- [`arch::is_aarch64_feature_detected!`][is_aarch64_feature_detected]

Cargo
-----
- [Port cargo from `toml-rs` to `toml_edit`][cargo/10086]
- [Stabilize `-Ztimings` as `--timings`][cargo/10245]
- [Stabilize namespaced and weak dependency features.][cargo/10269]
- [Accept more `cargo:rustc-link-arg-*` types from build script
  output.][cargo/10274]
- [cargo-new should not add ignore rule on Cargo.lock inside
  subdirs][cargo/10379]

Misc
----
- [Ship docs on Tier 2 platforms by reusing the closest Tier 1
  platform docs][92800]
- [Drop rustc-docs from complete profile][93742]
- [bootstrap: tidy up flag handling for llvm build][93918]

Compatibility Notes
-------------------
- [Remove compiler-rt linking hack on Android][83822]
- [Mitigations for platforms with non-monotonic clocks have been removed from
  `Instant::now`][89926]. On platforms that don't provide monotonic clocks, an
  instant is not guaranteed to be greater than an earlier instant anymore.
- [`Instant::{duration_since, elapsed, sub}` do not panic anymore on underflow,
  saturating to `0` instead][89926]. In the real world the panic happened mostly
  on platforms with buggy monotonic clock implementations rather than catching
  programming errors like reversing the start and end times. Such programming
  errors will now results in `0` rather than a panic.
- In a future release we're planning to increase the baseline requirements for
  the Linux kernel to version 3.2, and for glibc to version 2.17. We'd love
  your feedback in [PR #95026][95026].

Internal Changes
----------------

These changes provide no direct user facing benefits, but represent
significant improvements to the internals and overall performance
of rustc and related tools.

- [Switch all libraries to the 2021 edition][92068]

[83822]: rust-lang/rust#83822
[86374]: rust-lang/rust#86374
[87487]: rust-lang/rust#87487
[89621]: rust-lang/rust#89621
[89926]: rust-lang/rust#89926
[90132]: rust-lang/rust#90132
[90247]: rust-lang/rust#90247
[91606]: rust-lang/rust#91606
[92068]: rust-lang/rust#92068
[92300]: rust-lang/rust#92300
[92357]: rust-lang/rust#92357
[92383]: rust-lang/rust#92383
[92630]: rust-lang/rust#92630
[92670]: rust-lang/rust#92670
[92800]: rust-lang/rust#92800
[92933]: rust-lang/rust#92933
[93566]: rust-lang/rust#93566
[93577]: rust-lang/rust#93577
[93658]: rust-lang/rust#93658
[93742]: rust-lang/rust#93742
[93824]: rust-lang/rust#93824
[93918]: rust-lang/rust#93918
[95026]: rust-lang/rust#95026

[cargo/10086]: rust-lang/cargo#10086
[cargo/10245]: rust-lang/cargo#10245
[cargo/10269]: rust-lang/cargo#10269
[cargo/10274]: rust-lang/cargo#10274
[cargo/10379]: rust-lang/cargo#10379

[arc_new_cyclic]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_cyclic
[rc_new_cyclic]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_cyclic
[slice_escape_ascii]: https://doc.rust-lang.org/stable/std/slice/struct.EscapeAscii.html
[slice_u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.escape_ascii
[u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.escape_ascii
[vec_spare_capacity_mut]: https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.spare_capacity_mut
[assume_init_drop]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_drop
[assume_init_read]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_read
[i8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.abs_diff
[i16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.abs_diff
[i32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.abs_diff
[i64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.abs_diff
[i128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.abs_diff
[isize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.abs_diff
[u8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.abs_diff
[u16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.abs_diff
[u32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.abs_diff
[u64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.abs_diff
[u128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.abs_diff
[usize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.abs_diff
[display_error_kind]: https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#impl-Display
[from_u8_exit_code]: https://doc.rust-lang.org/stable/std/process/struct.ExitCode.html#impl-From%3Cu8%3E
[not_never]: https://doc.rust-lang.org/stable/std/primitive.never.html#impl-Not
[wrapping_assign_ops]: https://doc.rust-lang.org/stable/std/num/struct.Wrapping.html#trait-implementations
[is_aarch64_feature_detected]: https://doc.rust-lang.org/stable/std/arch/macro.is_aarch64_feature_detected.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.