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

Reasons for rebuilding #11407

Merged
merged 6 commits into from
Dec 30, 2022
Merged

Reasons for rebuilding #11407

merged 6 commits into from
Dec 30, 2022

Conversation

dnbln
Copy link
Contributor

@dnbln dnbln commented Nov 22, 2022

What does this PR try to resolve?

Attempts to provide some reasons for why crates are rebuilt (issue #2904 has been around for a very long time).

Basically adds an Option<DirtyReason> to Job, returned by the Fingerprint::compare method, and displays it in DrainState::note_working_on, almost analogous to displaying Fresh, but unlike Fresh, it is displayed regardless of verbosity, though with -v it gives a few more details Edit: now only displayed with --verbose. Also needed to add a few FsStatus variants to track why it was stale, to be able to display that information.

How should we test and review this PR?

I updated the freshness tests with the correct outputs after the change. Unsure if any of the other tests need to be changed. Edit: turns out quite a few did.

Additional information

Topic on zulip.

As for the actual presentation, it definitely can be improved, and I would love to hear some other thoughts on it. There are some variants that seem pretty enigmatic, and that I have few ideas how to actually present in any meaningful way (specifically: CompileKindChanged, LocalLengthsChanged, PrecalculatedComponentsChanged, DepInfoOutputChanged, LocalFingerprintTypeChanged, and NothingObvious).

Fixes #2904

@rustbot
Copy link
Collaborator

rustbot commented Nov 22, 2022

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @epage (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 22, 2022
@epage
Copy link
Contributor

epage commented Nov 22, 2022

r? @weihanglo

As I'm unlikely to catch up on this topic and get to this at this time

@rustbot rustbot assigned weihanglo and unassigned epage Nov 22, 2022
@dnbln
Copy link
Contributor Author

dnbln commented Nov 22, 2022

Those failing tests... they pass on my machine (on windows, with the nightly msvc toolchain), but for some reason something else happens on linux and the changes in the fingerprint aren't detected anymore(dirty_reason = None, leading to nothing being displayed and the crate just gets recompiled, with no explanation why, so the tests fail).

I saw this comment:

// MSVC does not include hash in binary filename, so it gets recompiled.
if cfg!(target_env = "msvc") {
e.with_stderr("[COMPILING] foo[..]\n[FINISHED] dev[..]");
} else {
e.with_stderr("[FINISHED] dev[..]");
}

So I'm going to do the same thing for the remaining failing tests, and hope a rollback would be easy if necessary.

@dnbln dnbln marked this pull request as ready for review November 22, 2022 23:01
@dnbln dnbln marked this pull request as draft November 23, 2022 12:14
@bors
Copy link
Contributor

bors commented Nov 25, 2022

☔ The latest upstream changes (presumably #11417) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Fabulous! I really love how Dirty message gets encoded. It is almost good to go!

For From and To message, it may be a debate on them. If possible, could we spin off them to a follow-up pull request?

src/cargo/core/compiler/job.rs Outdated Show resolved Hide resolved
self.rustflags
)
bail!(DirtyReason::RustflagsChanged {
old: old.rustflags.clone(),
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to avoid this kind of clone? For this specific rustflags changed, it would be cloned over for all dependencies in your dependencies graph of your crate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I understand your concern, but maybe using InternedString instead could help? Or alternatively move the

        if !self.fs_status.up_to_date() {
            bail!(DirtyReason::FsStatusOutdated(FsStatusOutdated::new(
                self.fs_status.clone()
            )))
        }

Check before the others, which would force most of the crates to have the reason of "dependency ... was rebuilt" instead of one of the more potentially specific ones. It corresponds to this variant:

StaleDependency {
name: InternedString,
dep_mtime: Option<FileTime>,
max_mtime: FileTime,
},

Which is also a lot cheaper to clone.

Copy link
Member

Choose a reason for hiding this comment

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

I meant avoid some clones like these inside DirtyReason. A little overhead is present even during non-verbose mode. Though to fix it, we might introduce quirky lifetime annotations 😞.

Not really a blocker to me if others feel fine with it.

diff --git a/src/cargo/core/compiler/fingerprint.rs b/src/cargo/core/compiler/fingerprint.rs
index 474ce169f..1e2545878 100644
--- a/src/cargo/core/compiler/fingerprint.rs
+++ b/src/cargo/core/compiler/fingerprint.rs
@@ -855,8 +855,8 @@ impl Fingerprint {
         }
         if self.features != old.features {
             bail!(DirtyReason::FeaturesChanged {
-                old: old.features.clone(),
-                new: self.features.clone()
+                old: &old.features,
+                new: &self.features,
             });
         }
         if self.target != old.target {
@@ -870,8 +870,8 @@ impl Fingerprint {
         }
         if self.rustflags != old.rustflags {
             bail!(DirtyReason::RustflagsChanged {
-                old: old.rustflags.clone(),
-                new: self.rustflags.clone(),
+                old: &old.rustflags,
+                new: &self.rustflags,
             })
         }
         if self.metadata != old.metadata {
diff --git a/src/cargo/core/compiler/fingerprint/dirty_reason.rs b/src/cargo/core/compiler/fingerprint/dirty_reason.rs
index 025aa8ee1..6f0d9f552 100644
--- a/src/cargo/core/compiler/fingerprint/dirty_reason.rs
+++ b/src/cargo/core/compiler/fingerprint/dirty_reason.rs
@@ -5,47 +5,47 @@ use crate::Config;
 use std::fmt;
 
 #[derive(Debug)]
-pub enum DirtyReason {
+pub enum DirtyReason<'a> {
     RustcChanged,
     FeaturesChanged {
-        old: String,
-        new: String,
+        old: &'a str,
+        new: &'a str,
     },
     TargetConfigurationChanged,
     PathToSourceChanged,
     ProfileConfigurationChanged,
     RustflagsChanged {
-        old: Vec<String>,
-        new: Vec<String>,
+        old: &'a [String],
+        new: &'a [String],
     },

Copy link
Contributor Author

@dnbln dnbln Nov 26, 2022

Choose a reason for hiding this comment

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

That would mean the lifetime would be added to Job, and store both the new and the old Arc<Fingerprint>s somewhere (e.g. in Job, so we run into the issue of lifetime-of-other-field). Alternatively, we could make the Fingerprint::compare method take in owned values and return them, skipping the need to clone, but then the write_fingerprint call wouldn't have a Fingerprint to work with. In the case of the first one, I guess it'd be possible and feasible to remove all the expensive-to-clone fields from DirtyReason, and to make the old and the new Fingerprint fields of DirtyReasonPresentation, to get them from there instead, but then the fingerprints themselves would live for a lot more than they probably should(edit: nevermind, that happens anyway because of write_fingerprint), and also the logs that use <DirtyReason as Display> would lose all those details.

Copy link
Member

Choose a reason for hiding this comment

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

From the other angle, the message is quite useful, but only in verbose mode. I wonder if we can avoid the tiny overhead when not in verbose mode.

Copy link
Contributor Author

@dnbln dnbln Dec 6, 2022

Choose a reason for hiding this comment

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

It would be possible, maybe with another enum DirtyReasonRef<'a> and using the references from the Fingerprints, coupled with some mechanism to turn a DirtyReasonRef<'a> to DirtyReason (maybe similar to ToOwned) by cloning the references, invoked only in verbose mode, but that would involve changing the Result of the Fingerprint::compare function to something like Result<(), DirtyReasonRef<'a>>, since anyhow::Errors have to be 'static. I'm not really sure if that is really worth it, but I might be wrong.

Copy link
Member

Choose a reason for hiding this comment

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

You're totally right. It might not be that worthy, depending on how much code to change, as freshness check is not really in the hot path.

@ehuss
Copy link
Contributor

ehuss commented Nov 25, 2022

Just a quick comment on the overall approach, I think this should only be displayed with --verbose, similar to the "Fresh" status message. Cargo is already pretty verbose in the default mode, and we may be looking to remove some of the output it already has. Adding more output is kinda going in the opposite direction.

I haven't had a chance to look at this more closely, but I think it will be great to have!

Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Thank you for the update!

What I meant in the previous review is maybe we could remove From/To status and all relevant machinery (StaleItem, StaleDependency and so on). So that we can focus moving old logging into verbose output. Then we extend it to the innovative From/To format in the next PR. It would make PR easier to reach a consensus.

That's just my personal idea, though. Other people may have different thoughts.

BTW, cargo build --verbose prints all rustc invocations already. Does anyone feel it is so verbose that users might mess freshness status?

@dnbln
Copy link
Contributor Author

dnbln commented Dec 6, 2022

Thank you for the update!

What I meant in the previous review is maybe we could remove From/To status and all relevant machinery (StaleItem, StaleDependency and so on). So that we can focus moving old logging into verbose output.

StaleItem and StaleDependency were not actually used for From/To, but for the regular Dirty, here:

FsStatus::StaleItem { item } => match item {
StaleItem::MissingFile(missing_file) => {
let file = missing_file.strip_prefix(root).unwrap_or(&missing_file);
s.dirty_because(unit, format!("the file `{}` is missing", file.display()))
}
StaleItem::ChangedFile {
stale,
stale_mtime,
reference_mtime,
..
} => {
let file = stale.strip_prefix(root).unwrap_or(&stale);
s.dirty_because(
unit,
format!(
"the file `{}` has changed ({})",
file.display(),
Self::after(*reference_mtime, *stale_mtime, "last build"),
),
)
}
StaleItem::ChangedEnv { var, .. } => {
s.dirty_because(unit, format!("the environment variable {var} changed"))?;
Ok(())
}
},
FsStatus::StaleDependency {
name,
dep_mtime,
max_mtime,
..
} => {
let message = match dep_mtime {
Some(dep_mtime) => {
format!(
"the dependency {name} was rebuilt ({})",
Self::after(*max_mtime, *dep_mtime, "last build"),
)
}
None => {
format!("the dependency {name} was rebuilt")
}
};
s.dirty_because(unit, message)
}

Changing files and rebuilding dependencies are perhaps the most common reasons why cargo would decide to rebuild a crate, so I think more concrete information would be very useful (rather than just "this is stale", which would be the case if we removed them).

Then we extend it to the innovative From/To format in the next PR. It would make PR easier to reach a consensus.

That's just my personal idea, though. Other people may have different thoughts.

Regarding From/To, adding them back in should be as easy as reverting e08848c, which is why I did it in a single commit.

BTW, cargo build --verbose prints all rustc invocations already. Does anyone feel it is so verbose that users might mess freshness status?

Yes, that is indeed the case, so maybe a special log option specifically for this would be the way to go (maybe enabled by default with --verbose too?).

@weihanglo
Copy link
Member

Ok now I see it. I'll try to bring this up to the next few Cargo meetings then we can move on. Thank you for the work so far!

@weihanglo weihanglo added I-nominated-to-discuss To be discussed during issue triage on the next Cargo team meeting and removed I-nominated-to-discuss To be discussed during issue triage on the next Cargo team meeting labels Dec 7, 2022
@weihanglo
Copy link
Member

Hi @dnbln. The Cargo team talked about this in the triage meeting today. We appreciate your efforts so far and are happy to move forward!

Like I guessed, we had some concerns around how to display it based on this screenshot. For example, From and To might be better as a part of Dirty status, instead of putting them in their own status. We also discussed default to writing fingerprint info to a logfile, as it's often too late to realize you need to enable verbose/logging mode to check rebuild fingerprints. The discussion was also expanded to moving to a more structural logging implementation, such as tracing.

Anyhow, the team agreed that this PR is in a good state to merge, given it only prints Dirty status when in verbose mode, which is way more discoverable than CARGO_LOG. We can continue exploring other possibilities as future extensions afterwards.

If you are ready, please flag this as ready-to-review, and perhaps attach some more screenshots to help other reviewers catch up which UI has been changed. Thank you!

@dnbln
Copy link
Contributor Author

dnbln commented Dec 14, 2022

Hello!

We appreciate your efforts so far and are happy to move forward!

I'm happy to hear that!

For example, From and To might be better as a part of Dirty status, instead of putting them in their own status.

The initial line of reasoning to put them on separate lines was that if they are right under one another, the difference can be spotted easily, at least much easier than if they were on the same line. Some of them can be really long too (for example environment variables containing paths, and may not really fit on the same line). I've already removed them in e08848c, but let me know if I should add them back in (even as parts of the Dirty status).

We also discussed default to writing fingerprint info to a logfile, as it's often too late to realize you need to enable verbose/logging mode to check rebuild fingerprints.

Maybe it is. Initially what drove me to write this patch was to figure out why 2 crates kept recompiling again and again (causing the rebuild of ~60 others) at every invocation of cargo (typenum and winapi specifically, turned out to be because of something to do with their build script when compiled with MSVC, I am not sure what exactly). I find it somewhat tolerable when it just happens once, but when that is triggered at every cargo build and cargo test the --verbose flag can help pinpoint the issue, so in practice (most of the time at least) I don't think it would be too late since running cargo in verbose mode with a crate that always rebuilds would still tell you why (since debugging specifically that would most likely be why you would be using this in the first place).

Anyhow, the team agreed that this PR is in a good state to merge, given it only prints Dirty status when in verbose mode, which is way more discoverable than CARGO_LOG.

That is already the case after 1966436.

If you are ready, please flag this as ready-to-review, and perhaps attach some more screenshots to help other reviewers catch up which UI has been changed. Thank you!

Here are some more screenshots (of what it looks like right now, after 95064a0):

For file changes:

image
image

Rebuilding dependency because of a file change in that dependency:

image

Feature set changes:

image

env!-macro referenced environment variables:

image

or build.rs cargo:rerun-if-env-changed:
image

build.rs cargo:rerun-if-changed:

image
image

Most of the others are hardly if ever at all displayed (since different fingerprint hashes are always going to trigger a new build with Job::new_dirty(..., None))

For more, feel free to take a look over the patched tests (not too many actually use -v, so I should probably write some more😅).

@dnbln dnbln marked this pull request as ready for review December 14, 2022 15:43
Copy link
Contributor Author

@dnbln dnbln left a comment

Choose a reason for hiding this comment

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

I'm not entirely sure I got these bits right, so I'll ask here.

src/cargo/core/compiler/fingerprint.rs Outdated Show resolved Hide resolved
src/cargo/core/compiler/fingerprint/dirty_reason.rs Outdated Show resolved Hide resolved
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Thank you for the update. I didn't realize putting too many comments until now 😆

There are things could be improved:

  • DirtyReasonDeps is not used anymore. Should remove it and relevant usages.
  • It is better to commit formatting changes in a separate commit or even a separate PR.
  • Some new types and functions seem not necessary. Maybe I missed something and you can explain them.
  • I'd like to see tests exercising those new Dirty status. Perhaps turn on --verbose for some tests under tests/testsuite/freshness? For example, some newly added message in DirtyReason::FsStatusOutdated worth a test.

crates/cargo-test-support/src/compare.rs Show resolved Hide resolved
src/cargo/core/compiler/fingerprint.rs Outdated Show resolved Hide resolved
src/cargo/core/compiler/fingerprint.rs Outdated Show resolved Hide resolved
src/cargo/core/compiler/fingerprint/dirty_reason.rs Outdated Show resolved Hide resolved
tests/testsuite/freshness.rs Show resolved Hide resolved
src/cargo/core/compiler/fingerprint/dirty_reason.rs Outdated Show resolved Hide resolved
src/cargo/core/compiler/fingerprint/dirty_reason.rs Outdated Show resolved Hide resolved
src/cargo/core/compiler/fingerprint/dirty_reason.rs Outdated Show resolved Hide resolved
src/cargo/core/compiler/fingerprint/dirty_reason.rs Outdated Show resolved Hide resolved
src/cargo/core/compiler/fingerprint/dirty_reason.rs Outdated Show resolved Hide resolved
@dnbln
Copy link
Contributor Author

dnbln commented Dec 16, 2022

Thank you for the review!

I applied a few suggestions in the last few commits.

I will work more on this over the weekend; probably also rebase at some point to fix those changes that shouldn't have been there.

Since there's more work to be done, I'm marking this as a draft for now.

@dnbln dnbln marked this pull request as draft December 16, 2022 22:13
@dnbln
Copy link
Contributor Author

dnbln commented Dec 28, 2022

Seems like the tests pass again. I've squashed all the commits into 0beb5fe (including the fixes for most of the comments above), and 2071acd adds --verbose to a few features tests (just so [DIRTY-MSVC] gets used somewhere 😅). Marking this as ready for review again.

@dnbln dnbln marked this pull request as ready for review December 28, 2022 18:13
// Because the directory doesn't exist, it will trigger a rebuild every time.
// https://github.com/rust-lang/cargo/issues/6003
dirty();
dirty(
"[DIRTY] foo v0.1.0 ([..]): the file `somedir` is missing",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another question: what to do about changes to directories? Using the file `...` ... seems misleading.

Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Thank you for the update! It's almost ready to merge :)

src/cargo/core/compiler/fingerprint/dirty_reason.rs Outdated Show resolved Hide resolved
tests/testsuite/features.rs Show resolved Hide resolved
crates/cargo-test-support/src/compare.rs Show resolved Hide resolved
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Looks good to me. Some dirty messages are not exercised but can be added afterward.

Let's move on. Thank you!

@weihanglo
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Dec 30, 2022

📌 Commit 6913486 has been approved by weihanglo

It is now in the queue for this repository.

@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 Dec 30, 2022
@bors
Copy link
Contributor

bors commented Dec 30, 2022

⌛ Testing commit 6913486 with merge dd99005...

@bors
Copy link
Contributor

bors commented Dec 30, 2022

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing dd99005 to master...

@bors bors merged commit dd99005 into rust-lang:master Dec 30, 2022
@dnbln dnbln deleted the reasons-for-rebuilding branch December 30, 2022 14:29
weihanglo added a commit to weihanglo/rust that referenced this pull request Jan 4, 2023
8 commits in 2381cbdb4e9b07090f552d34a44a529b6e620e44..8c460b2237a6359a7e3335890db8da049bdd62fc
2022-12-23 12:19:27 +0000 to 2023-01-04 14:30:01 +0000
- test: revive nightly plugin tests to work (rust-lang/cargo#11534)
- Add note to release notes about rejecting multiple registries. (rust-lang/cargo#11531)
- Fix a typo `fresheness` -&gt; `freshness` (rust-lang/cargo#11529)
- Reasons for rebuilding (rust-lang/cargo#11407)
- Asymmetric tokens (rust-lang/cargo#10771)
- Use proper git URL for GitHub repos (rust-lang/cargo#11517)
- Add `registry.default` example (rust-lang/cargo#11516)
- Support vendoring with different revs from same git repo (rust-lang/cargo#10690)

Also update license exceptions and permitted dependencies
for new cargo dependency "pasetors".

A new dependency `getrandom` is added into `rustc-workspace-hacks`,
since it requires feature `js`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 4, 2023
Update cargo

8 commits in 2381cbdb4e9b07090f552d34a44a529b6e620e44..8c460b2237a6359a7e3335890db8da049bdd62fc
2022-12-23 12:19:27 +0000 to 2023-01-04 14:30:01 +0000
- test: revive nightly plugin tests to work (rust-lang/cargo#11534)
- Add note to release notes about rejecting multiple registries. (rust-lang/cargo#11531)
- Fix a typo `fresheness` -&gt; `freshness` (rust-lang/cargo#11529)
- Reasons for rebuilding (rust-lang/cargo#11407)
- Asymmetric tokens (rust-lang/cargo#10771)
- Use proper git URL for GitHub repos (rust-lang/cargo#11517)
- Add `registry.default` example (rust-lang/cargo#11516)
- Support vendoring with different revs from same git repo (rust-lang/cargo#10690)

Also update license exceptions and permitted dependencies
for new cargo dependency "pasetors".

A new dependency `getrandom` is added into `rustc-workspace-hacks`,
since it requires feature `js`.

r? `@ghost`
@ehuss ehuss added this to the 1.68.0 milestone Jan 28, 2023
weihanglo added a commit to weihanglo/cargo that referenced this pull request Feb 3, 2023
This fixes a regression introduced by rust-lang#11407,
which Cargo should always verify a source before it recompiles.
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Mar 20, 2023
Pkgsrc changes:
 * Adjust patches and cargo checksums to new versions.

Upstream changes:

Version 1.68.0 (2023-03-09)
===========================

Language
--------

- [Stabilize default_alloc_error_handler]
  (rust-lang/rust#102318)
  This allows usage of `alloc` on stable without requiring the
  definition of a handler for allocation failure. Defining custom
  handlers is still unstable.
- [Stabilize `efiapi` calling convention.]
  (rust-lang/rust#105795)
- [Remove implicit promotion for types with drop glue]
  (rust-lang/rust#105085)

Compiler
--------

- [Change `bindings_with_variant_name` to deny-by-default]
  (rust-lang/rust#104154)
- [Allow .. to be parsed as let initializer]
  (rust-lang/rust#105701)
- [Add `armv7-sony-vita-newlibeabihf` as a tier 3 target]
  (rust-lang/rust#105712)
- [Always check alignment during compile-time const evaluation]
  (rust-lang/rust#104616)
- [Disable "split dwarf inlining" by default.]
  (rust-lang/rust#106709)
- [Add vendor to Fuchsia's target triple]
  (rust-lang/rust#106429)
- [Enable sanitizers for s390x-linux]
  (rust-lang/rust#107127)

Libraries
---------

- [Loosen the bound on the Debug implementation of Weak.]
  (rust-lang/rust#90291)
- [Make `std::task::Context` !Send and !Sync]
  (rust-lang/rust#95985)
- [PhantomData layout guarantees]
  (rust-lang/rust#104081)
- [Don't derive Debug for `OnceWith` & `RepeatWith`]
  (rust-lang/rust#104163)
- [Implement DerefMut for PathBuf]
  (rust-lang/rust#105018)
- [Add O(1) `Vec -> VecDeque` conversion guarantee]
  (rust-lang/rust#105128)
- [Leak amplification for peek_mut() to ensure BinaryHeap's invariant
  is always met]
  (rust-lang/rust#105851)

Stabilized APIs
---------------

- [`{core,std}::pin::pin!`]
  (https://doc.rust-lang.org/stable/std/pin/macro.pin.html)
- [`impl From<bool> for {f32,f64}`]
  (https://doc.rust-lang.org/stable/std/primitive.f32.html#impl-From%3Cbool%3E-for-f32)
- [`std::path::MAIN_SEPARATOR_STR`]
  (https://doc.rust-lang.org/stable/std/path/constant.MAIN_SEPARATOR_STR.html)
- [`impl DerefMut for PathBuf`]
  (https://doc.rust-lang.org/stable/std/path/struct.PathBuf.html#impl-DerefMut-for-PathBuf)

These APIs are now stable in const contexts:

- [`VecDeque::new`]
  (https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.new)

Cargo
-----

- [Stabilize sparse registry support for crates.io]
  (rust-lang/cargo#11224)
- [`cargo build --verbose` tells you more about why it recompiles.]
  (rust-lang/cargo#11407)
- [Show progress of crates.io index update even `net.git-fetch-with-cli`
  option enabled]
  (rust-lang/cargo#11579)

Misc
----

Compatibility Notes
-------------------

- [Add `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` to future-incompat report]
  (rust-lang/rust#103418)
- [Only specify `--target` by default for `-Zgcc-ld=lld` on wasm]
  (rust-lang/rust#101792)
- [Bump `IMPLIED_BOUNDS_ENTAILMENT` to Deny + ReportNow]
  (rust-lang/rust#106465)
- [`std::task::Context` no longer implements Send and Sync]
  (rust-lang/rust#95985)

nternal Changes
----------------

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

- [Encode spans relative to the enclosing item]
  (rust-lang/rust#84762)
- [Don't normalize in AstConv]
  (rust-lang/rust#101947)
- [Find the right lower bound region in the scenario of partial order relations]
  (rust-lang/rust#104765)
- [Fix impl block in const expr]
  (rust-lang/rust#104889)
- [Check ADT fields for copy implementations considering regions]
  (rust-lang/rust#105102)
- [rustdoc: simplify JS search routine by not messing with lev distance]
  (rust-lang/rust#105796)
- [Enable ThinLTO for rustc on `x86_64-pc-windows-msvc`]
  (rust-lang/rust#103591)
- [Enable ThinLTO for rustc on `x86_64-apple-darwin`]
  (rust-lang/rust#103647)
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Apr 8, 2023
Pkgsrc changes:
 * Adjust patches (add & remove) and cargo checksums to new versions.
 * It's conceivable that the workaround for LLVM based NetBSD works
   even less in this version (ref. PKGSRC_HAVE_LIBCPP not having a
   corresponding patch anymore).

Upstream changes:

Version 1.68.2 (2023-03-28)
===========================

- [Update the GitHub RSA host key bundled within Cargo]
  (rust-lang/cargo#11883).
  The key was [rotated by GitHub]
  (https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/)
  on 2023-03-24 after the old one leaked.
- [Mark the old GitHub RSA host key as revoked]
  (rust-lang/cargo#11889).
  This will prevent Cargo from accepting the leaked key even when
  trusted by the system.
- [Add support for `@revoked` and a better error message for
  `@cert-authority` in Cargo's SSH host key verification]
  (rust-lang/cargo#11635)

Version 1.68.1 (2023-03-23)
===========================

- [Fix miscompilation in produced Windows MSVC artifacts]
  (rust-lang/rust#109094)
  This was introduced by enabling ThinLTO for the distributed rustc
  which led to miscompilations in the resulting binary. Currently
  this is believed to be limited to the -Zdylib-lto flag used for
  rustc compilation, rather than a general bug in ThinLTO, so only
  rustc artifacts should be affected.
- [Fix --enable-local-rust builds]
  (rust-lang/rust#109111)
- [Treat `$prefix-clang` as `clang` in linker detection code]
  (rust-lang/rust#109156)
- [Fix panic in compiler code]
  (rust-lang/rust#108162)

Version 1.68.0 (2023-03-09)
===========================

Language
--------

- [Stabilize default_alloc_error_handler]
  (rust-lang/rust#102318)
  This allows usage of `alloc` on stable without requiring the
  definition of a handler for allocation failure. Defining custom
  handlers is still unstable.
- [Stabilize `efiapi` calling convention.]
  (rust-lang/rust#105795)
- [Remove implicit promotion for types with drop glue]
  (rust-lang/rust#105085)

Compiler
--------

- [Change `bindings_with_variant_name` to deny-by-default]
  (rust-lang/rust#104154)
- [Allow .. to be parsed as let initializer]
  (rust-lang/rust#105701)
- [Add `armv7-sony-vita-newlibeabihf` as a tier 3 target]
  (rust-lang/rust#105712)
- [Always check alignment during compile-time const evaluation]
  (rust-lang/rust#104616)
- [Disable "split dwarf inlining" by default.]
  (rust-lang/rust#106709)
- [Add vendor to Fuchsia's target triple]
  (rust-lang/rust#106429)
- [Enable sanitizers for s390x-linux]
  (rust-lang/rust#107127)

Libraries
---------

- [Loosen the bound on the Debug implementation of Weak.]
  (rust-lang/rust#90291)
- [Make `std::task::Context` !Send and !Sync]
  (rust-lang/rust#95985)
- [PhantomData layout guarantees]
  (rust-lang/rust#104081)
- [Don't derive Debug for `OnceWith` & `RepeatWith`]
  (rust-lang/rust#104163)
- [Implement DerefMut for PathBuf]
  (rust-lang/rust#105018)
- [Add O(1) `Vec -> VecDeque` conversion guarantee]
  (rust-lang/rust#105128)
- [Leak amplification for peek_mut() to ensure BinaryHeap's invariant
  is always met]
  (rust-lang/rust#105851)

Stabilized APIs
---------------

- [`{core,std}::pin::pin!`]
  (https://doc.rust-lang.org/stable/std/pin/macro.pin.html)
- [`impl From<bool> for {f32,f64}`]
  (https://doc.rust-lang.org/stable/std/primitive.f32.html#impl-From%3Cbool%3E-for-f32)
- [`std::path::MAIN_SEPARATOR_STR`]
  (https://doc.rust-lang.org/stable/std/path/constant.MAIN_SEPARATOR_STR.html)
- [`impl DerefMut for PathBuf`]
  (https://doc.rust-lang.org/stable/std/path/struct.PathBuf.html#impl-DerefMut-for-PathBuf)

These APIs are now stable in const contexts:

- [`VecDeque::new`]
  (https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.new)

Cargo
-----

- [Stabilize sparse registry support for crates.io]
  (rust-lang/cargo#11224)
- [`cargo build --verbose` tells you more about why it recompiles.]
  (rust-lang/cargo#11407)
- [Show progress of crates.io index update even `net.git-fetch-with-cli`
  option enabled]
  (rust-lang/cargo#11579)

Misc
----

Compatibility Notes
-------------------

- [Add `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` to future-incompat report]
  (rust-lang/rust#103418)
- [Only specify `--target` by default for `-Zgcc-ld=lld` on wasm]
  (rust-lang/rust#101792)
- [Bump `IMPLIED_BOUNDS_ENTAILMENT` to Deny + ReportNow]
  (rust-lang/rust#106465)
- [`std::task::Context` no longer implements Send and Sync]
  (rust-lang/rust#95985)

nternal Changes
----------------

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

- [Encode spans relative to the enclosing item]
  (rust-lang/rust#84762)
- [Don't normalize in AstConv]
  (rust-lang/rust#101947)
- [Find the right lower bound region in the scenario of partial order relations]
  (rust-lang/rust#104765)
- [Fix impl block in const expr]
  (rust-lang/rust#104889)
- [Check ADT fields for copy implementations considering regions]
  (rust-lang/rust#105102)
- [rustdoc: simplify JS search routine by not messing with lev distance]
  (rust-lang/rust#105796)
- [Enable ThinLTO for rustc on `x86_64-pc-windows-msvc`]
  (rust-lang/rust#103591)
- [Enable ThinLTO for rustc on `x86_64-apple-darwin`]
  (rust-lang/rust#103647)

Version 1.67.0 (2023-01-26)
==========================

Language
--------

- [Make `Sized` predicates coinductive, allowing cycles.]
  (rust-lang/rust#100386)
- [`#[must_use]` annotations on `async fn` also affect the
  `Future::Output`.] (rust-lang/rust#100633)
- [Elaborate supertrait obligations when deducing closure signatures.]
  (rust-lang/rust#101834)
- [Invalid literals are no longer an error under `cfg(FALSE)`.]
  (rust-lang/rust#102944)
- [Unreserve braced enum variants in value namespace.]
  (rust-lang/rust#103578)

Compiler
--------

- [Enable varargs support for calling conventions other than `C`
  or `cdecl`.] (rust-lang/rust#97971)
- [Add new MIR constant propagation based on dataflow analysis.]
  (rust-lang/rust#101168)
- [Optimize field ordering by grouping m\*2^n-sized fields with
  equivalently aligned ones.] (rust-lang/rust#102750)
- [Stabilize native library modifier `verbatim`.]
  (rust-lang/rust#104360)

Added and removed targets:

- [Add a tier 3 target for PowerPC on AIX]
  (rust-lang/rust#102293), `powerpc64-ibm-aix`.
- [Add a tier 3 target for the Sony PlayStation 1]
  (rust-lang/rust#102689), `mipsel-sony-psx`.
- [Add tier 3 `no_std` targets for the QNX Neutrino RTOS]
  (rust-lang/rust#102701),
  `aarch64-unknown-nto-qnx710` and `x86_64-pc-nto-qnx710`.
- [Remove tier 3 `linuxkernel` targets]
  (rust-lang/rust#104015) (not used by the
  actual kernel).

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

Libraries
---------

- [Merge `crossbeam-channel` into `std::sync::mpsc`.]
  (rust-lang/rust#93563)
- [Fix inconsistent rounding of 0.5 when formatted to 0 decimal places.]
  (rust-lang/rust#102935)
- [Derive `Eq` and `Hash` for `ControlFlow`.]
  (rust-lang/rust#103084)
- [Don't build `compiler_builtins` with `-C panic=abort`.]
  (rust-lang/rust#103786)

Stabilized APIs
---------------

- [`{integer}::checked_ilog`]
  (https://doc.rust-lang.org/stable/std/primitive.i32.html#method.checked_ilog)
- [`{integer}::checked_ilog2`]
  (https://doc.rust-lang.org/stable/std/primitive.i32.html#method.checked_ilog2)
- [`{integer}::checked_ilog10`]
  (https://doc.rust-lang.org/stable/std/primitive.i32.html#method.checked_ilog10)
- [`{integer}::ilog`]
  (https://doc.rust-lang.org/stable/std/primitive.i32.html#method.ilog)
- [`{integer}::ilog2`]
  (https://doc.rust-lang.org/stable/std/primitive.i32.html#method.ilog2)
- [`{integer}::ilog10`]
  (https://doc.rust-lang.org/stable/std/primitive.i32.html#method.ilog10)
- [`NonZeroU*::ilog2`]
  (https://doc.rust-lang.org/stable/std/num/struct.NonZeroU32.html#method.ilog2)
- [`NonZeroU*::ilog10`]
  (https://doc.rust-lang.org/stable/std/num/struct.NonZeroU32.html#method.ilog10)
- [`NonZero*::BITS`]
  (https://doc.rust-lang.org/stable/std/num/struct.NonZeroU32.html#associatedconstant.BITS)

These APIs are now stable in const contexts:

- [`char::from_u32`]
  (https://doc.rust-lang.org/stable/std/primitive.char.html#method.from_u32)
- [`char::from_digit`]
  (https://doc.rust-lang.org/stable/std/primitive.char.html#method.from_digit)
- [`char::to_digit`]
  (https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_digit)
- [`core::char::from_u32`]
  (https://doc.rust-lang.org/stable/core/char/fn.from_u32.html)
- [`core::char::from_digit`]
  (https://doc.rust-lang.org/stable/core/char/fn.from_digit.html)

Compatibility Notes
-------------------

- [The layout of `repr(Rust)` types now groups m\*2^n-sized fields
  with equivalently aligned ones.]
  (rust-lang/rust#102750) This is intended
  to be an optimization, but it is also known to increase type
  sizes in a few cases for the placement of enum tags. As a reminder,
  the layout of `repr(Rust)` types is an implementation detail,
  subject to change.
- [0.5 now rounds to 0 when formatted to 0 decimal places.]
  (rust-lang/rust#102935)
  This makes it consistent with the rest of floating point formatting that
  rounds ties toward even digits.
- [Chains of `&&` and `||` will now drop temporaries from their
  sub-expressions in evaluation order, left-to-right.]
  (rust-lang/rust#103293) Previously, it
  was "twisted" such that the _first_ expression dropped its
  temporaries _last_, after all of the other expressions dropped
  in order.
- [Underscore suffixes on string literals are now a hard error.]
  (rust-lang/rust#103914)
  This has been a future-compatibility warning since 1.20.0.
- [Stop passing `-export-dynamic` to `wasm-ld`.]
  (rust-lang/rust#105405)
- [`main` is now mangled as `__main_void` on `wasm32-wasi`.]
  (rust-lang/rust#105468)
- [Cargo now emits an error if there are multiple registries in
  the configuration with the same index URL.]
  (rust-lang/cargo#10592)

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

These changes do not affect any public interfaces of Rust, but they
represent significant improvements to the performance or internals
of rustc and related tools.

- [Rewrite LLVM's archive writer in Rust.]
  (rust-lang/rust#97485)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide better diagnostics for why crates are rebuilt
6 participants