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

Implement RFC 3139: alternative registry authentication support #10592

Merged
merged 1 commit into from
Nov 17, 2022

Conversation

arlosi
Copy link
Contributor

@arlosi arlosi commented Apr 22, 2022

Allows registries to request Cargo to send the authentication token for all requests, rather than just publish/yank, implementing RFC 3139.

Items from the tracking issue

Do registries need a more fine-grained switch for which API commands require authentication?

This PR uses the auth_required boolean as described in the RFC.

The RFC mentions adding --token to additional commands like install and search

These flags are not added by this PR.

Consider changing the name and form of the X- header

Changed to the www-authenticate header as suggested by the comments.

Will there be any concerns with the interaction with rust-lang/rfcs#3231

Not that I know of.


Adds a new field "auth-required": true to config.json that indicates Cargo should include the token in all requests to a registry.

For HTTP registries, Cargo first attempts an un-authenticated request, then if that fails with HTTP 401, an authenticated request is attempted. The registry server may include a www-authenticate header with the HTTP 401 to instruct Cargo with URL the user can visit to acquire a token (crates.io/me).

Since the API URL is not known (because it's stored in the index), the unstable credential provider feature is modified to key off the index url, and the registry name is no longer provided.

To handle the case where an alternative registry's name is not known (such as coming from a lock file, or via --index), Cargo can now look up the token in the configuration by matching on the index URL. This introduces a new error if two alternative registries are configured with the same index URL.

Several operations, such as cargo install could have had a --token argument added, however it appears that Cargo would like to move away from passing the token on the command line for security reasons. In this case, users would need to configure the registry via the config file (or environment variables) when using cargo install --index ... or similar.

@rust-highfive
Copy link

r? @ehuss

(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 Apr 22, 2022
src/cargo/util/mod.rs Outdated Show resolved Hide resolved
tests/testsuite/build.rs Outdated Show resolved Hide resolved
@arlosi arlosi force-pushed the auth branch 2 times, most recently from c91ddf4 to 482700d Compare May 11, 2022 20:13
@arlosi
Copy link
Contributor Author

arlosi commented May 11, 2022

@Eh2406 I updated this PR to address your comments. I've also cleaned up the test framework to combine the two test http servers (index and api) into one, and added additional tests.

@Eh2406
Copy link
Contributor

Eh2406 commented May 16, 2022

This is looking good.

Some points for discussion at the next available Cargo meeting:

  1. Since the API URL is not known (because it's stored in the index), the unstable credential provider feature is modified to key off the index url, and the registry name is no longer provided.
  2. It may be better to just remove CARGO_REGISTRY_NAME_OPT
  3. This introduces a new error if two alternative registries are configured with the same index URL.
  4. With this change, cargo always reads the credentials file when it loads the other configuration.
  5. New dep on https://github.com/scottlamb/http-auth with default=false

Thanks for all the hard work!

@Eh2406
Copy link
Contributor

Eh2406 commented May 18, 2022

We were able to discuss this PR briefly at yesterday's meeting. I am trying to recall what we were able to discuss and what we weren't, and try and assign people to follow up.

We did not particularly talk about:

Since the API URL is not known (because it's stored in the index), the unstable credential provider feature is modified to key off the index url, and the registry name is no longer provided.

It may be better to just remove CARGO_REGISTRY_NAME_OPT

Some more context: This is an environment variable that is provided to a credential provider when a registry name is known. Given that it's never technically necessary, and not consistently available, should we just remove it?

This introduces a new error if two alternative registries are configured with the same index URL.

Some more context: The RFC authorized us to make this an error. This PR implements the error eagerly. This has the advantage that the moment you corrupt your configuration you will get an error message. And the implementation is pretty straightforward, load all configuration and look for conflicts. It has the disadvantage that ms-configuring registry foo will prevent you from building a project that depends only on crates.io.

@rust-lang/cargo any thoughts on the above questions?

We were able to briefly discuss:

With this change, cargo always reads the credentials file when it loads the other configuration.

Some more context: This is a consequence of the eager evaluation above. We need to load all registry configurations in order to figure out if any of them conflict, to fully load a registry we need to look at credentials to see if there's a token associated with it.

In the meeting: We would like to not read credentials if we don't have to, but are not 100% committed to it. we were wondering what the alternative designs would be here, and what their disadvantages would be? Could we eagerly load config's but lazily load credentials? @arlosi what are your thoughts?

New dep on https://github.com/scottlamb/http-auth with default=false

Some more context: Cargo needs some way for a server to tell it how a user can get a token. It would be nice to follow the www-authenticate standard, but it is a bit of a mess. The PR originally had 200 lines of parsing code, but I was not confident in this being completely correct. We found a dependency that does this parsing and switch to using that.

In the meeting: We would like to do a little more research on alternatives to this dependency. One alternative is to parse ourselves using one of the libraries we already use. (@epage you got the most experience with parsing, does this make any sense?) Alternatively we would like to shop around to see how this crate compares to other crates for this purpose. Specifically, What crates are there? And for each one:

  • How actively maintained as it / does the code look up to snuff?
  • Is it widely used? Reverse dependencies / download counts.
  • Is the API plausible for our use?
  • Is the license reasonable for our use?
  • Are the dependencies reasonable?

We may decide that the one I picked originally is correct, but someone should document the due diligence. @arlosi what are your thoughts, would you be up to collecting this data? (If not I can redo the work, and this time document it.)

@arlosi
Copy link
Contributor Author

arlosi commented May 18, 2022

Could we eagerly load config's but lazily load credentials?

Cargo currently works by eagerly loading credentials for operations that are known to require them (publish, etc). The credentials are then merged into the Config.

This change makes it so the credentials may be required for pretty much anything hitting the network. If we wanted to continue to lazy-load the credentials, we'd probably want to do it in auth::registry_credential_config.

Unfortunately, the Config is not mutable, which makes it difficult to merge additional values into it at that point.

Should we use the http-auth crate to parse the www-authenticate header?

  • License is OK (Apache 2, or MIT)
  • Reverse dependencies are minimal (only 3 small crate)
  • Download count is small (3k)
  • Code seems actively maintained and good quality
  • Has no new transitive dependencies (with default-features = false)
  • We're only using a subset of crate functionality. It can do other things such as respond to Basic and Digest auth (if those features are enabled).

If we're going to use an existing external crate, http-auth seems like the best one. Other crates considered:

  • www-authenticate has unsafe mem::transmute and has two new transitive deps (hyperx, unicase). It could work, but we'd need to understand the mem::transmutes.
  • authentic uses http-auth
  • actix-web-httpauth has dependencies on actix
  • http-auth-basic supports only "Basic" auth

Another alternative is the parser I wrote within cargo.

  • Less well tested
  • Avoids a dependency
  • Makes best effort to parse
  • 69 lines of code (excluding tests)

This PR currently uses the http-auth crate.

src/cargo/util/auth.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

A mostly cursory review of just a few things I noticed.

src/cargo/core/source/source_id.rs Outdated Show resolved Hide resolved
src/cargo/sources/registry/http_remote.rs Outdated Show resolved Hide resolved
src/cargo/sources/registry/http_remote.rs Outdated Show resolved Hide resolved
let mut headers = List::new();
headers.append("cargo-protocol: version=1")?;
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't seen any discussion about what this cargo-protocol header is. Can you say more about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was a suggestion in the RFC process. It would enable the server to potentially do something different if we ever change how the protocol works. It currently doesn't do anything.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment to that effect to explain what it is for?

src/cargo/sources/registry/http_remote.rs Outdated Show resolved Hide resolved
@ehuss
Copy link
Contributor

ehuss commented May 23, 2022

Thanks so much for working on this, it looks great! I particularly like the updates to the tests.

Some notes:

  • I think it would be good to keep the CARGO_REGISTRY_NAME_OPT option, and to use that to store as an informational element in the key store. That way, if a user looks at the key store they can see something that has a little more meaning than just a URL.
  • It looks like the 1password credential program is broken. It looks like the search code isn't working correctly, as it is looking at the title, but this was changed to remove the title. I think it needs some kind of title. I'm not sure if the search code can search by URL. Can you make sure that all of the credential programs continue to work?
  • -Z registry_auth needs to be documented in unstable.md.
  • Can you make sure to update the version of crates-io to 0.35.0, and cargo-credential to 0.2.0?
  • I would be much more comfortable if credentials were loaded only as needed. I imagine there are several ways that could be done, but one idea is to have two values tables (the normal Config.values and a new one for credentials). The get_cv function could then consult the credentials one first, and then the normal one. In the common case where the credentials aren't loaded, I don't think it should impact performance noticeably. I'm not sure I fully follow what Config.credential_cache is currently doing, but perhaps it could use that?

@bors
Copy link
Collaborator

bors commented May 24, 2022

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

@arlosi
Copy link
Contributor Author

arlosi commented May 25, 2022

Thanks for all the feedback. I'll get started on figuring out how to lazy load the credentials file.

For 1password:

I can test the other credential providers.

@ehuss
Copy link
Contributor

ehuss commented May 27, 2022

Hm, I didn't know there was a new version of the 1password client. It would probably be good to update it, but that can probably be done separately.

The key issue is that there needs to be a way to uniquely find the credential. The search function currently filters based on the title which was the registry name. I think perhaps that can be changed to search for the url, something like:

diff --git a/crates/credential/cargo-credential-1password/src/main.rs b/crates/credential/cargo-credential-1password/src/main.rs
index 86fc9fed8..bd713fd0e 100644
--- a/crates/credential/cargo-credential-1password/src/main.rs
+++ b/crates/credential/cargo-credential-1password/src/main.rs
@@ -41,7 +41,7 @@ struct ListItem {

 #[derive(Deserialize)]
 struct Overview {
-    title: String,
+    url: String,
 }

 impl OnePasswordKeychain {
@@ -175,11 +175,7 @@ impl OnePasswordKeychain {
         Ok(buffer)
     }

-    fn search(
-        &self,
-        session: &Option<String>,
-        registry_name: &str,
-    ) -> Result<Option<String>, Error> {
+    fn search(&self, session: &Option<String>, index_url: &str) -> Result<Option<String>, Error> {
         let cmd = self.make_cmd(
             session,
             &[
@@ -196,15 +192,15 @@ impl OnePasswordKeychain {
             .map_err(|e| format!("failed to deserialize JSON from 1password list: {}", e))?;
         let mut matches = items
             .into_iter()
-            .filter(|item| item.overview.title == registry_name);
+            .filter(|item| item.overview.url == index_url);
         match matches.next() {
             Some(login) => {
                 // Should this maybe just sort on `updatedAt` and return the newest one?
                 if matches.next().is_some() {
                     return Err(format!(
-                        "too many 1password logins match registry name {}, \
+                        "too many 1password logins match registry URL {}, \
                         consider deleting the excess entries",
-                        registry_name
+                        index_url
                     )
                     .into());
                 }
@@ -232,6 +228,8 @@ impl OnePasswordKeychain {
                 "Login",
                 &format!("password={}", token),
                 &format!("url={}", index_url),
+                "--title",
+                "Cargo registry token",
                 "--tags",
                 CARGO_TAG,
             ],

@bors
Copy link
Collaborator

bors commented Nov 17, 2022

📌 Commit 9827412 has been approved by ehuss

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 Nov 17, 2022
@bors
Copy link
Collaborator

bors commented Nov 17, 2022

⌛ Testing commit 9827412 with merge 4d5c036...

@bors
Copy link
Collaborator

bors commented Nov 17, 2022

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing 4d5c036 to master...

@bors bors merged commit 4d5c036 into rust-lang:master Nov 17, 2022
@jonathanstrong
Copy link

very happy to see this merged! awesome work @arlosi and @ehuss! this change is a critical improvement enabling private registries like Shipyard.rs.

weihanglo added a commit to weihanglo/rust that referenced this pull request Nov 18, 2022
3 commits in 16b097879b6f117c8ae698aab054c87f26ff325e..eb5d35917b2395194593c9ca70c3778f60c1573b
2022-11-14 23:28:16 +0000 to 2022-11-17 22:08:43 +0000
- Fix several tests that are waiting 60 seconds for publishing to time out (rust-lang/cargo#11388)
- Implement RFC 3139: alternative registry authentication support (rust-lang/cargo#10592)
- Fix cargo install --index when used with registry.default (rust-lang/cargo#11302)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 19, 2022
Update cargo

3 commits in 16b097879b6f117c8ae698aab054c87f26ff325e..eb5d35917b2395194593c9ca70c3778f60c1573b
2022-11-14 23:28:16 +0000 to 2022-11-17 22:08:43 +0000
- Fix several tests that are waiting 60 seconds for publishing to time out (rust-lang/cargo#11388)
- Implement RFC 3139: alternative registry authentication support (rust-lang/cargo#10592)
- Fix cargo install --index when used with registry.default (rust-lang/cargo#11302)

r? `@ghost`
@fasterthanlime
Copy link

Can the -Z registry-auth option be passed to cargo as an environment variable? Right now (with cargo 2022-11-21 + shipyard.rs), my rust-analyzer setup is broken because... it invokes cargo metadata without -Z registry-auth (that's one of the rust-analyzer cargo invocations you can't override):

image

@Eh2406
Copy link
Contributor

Eh2406 commented Nov 21, 2022

Yes, the env is CARGO_UNSTABLE_REGISTRY_AUTH=true

@jonathanstrong
Copy link

just noting another option, in ~/.cargo/config.toml:

[unstable]
registry-auth = true

@fasterthanlime
Copy link

fasterthanlime commented Nov 21, 2022

@Eh2406 @jonathanstrong are either of these options documented somewhere? I've reached the "reading cargo sources" stage of banging my head against the wall here, maybe https://doc.rust-lang.org/cargo/reference/environment-variables.html could point somewhere useful?

edit: just found out this page existed: https://doc.rust-lang.org/cargo/reference/unstable.html

@Eh2406
Copy link
Contributor

Eh2406 commented Nov 21, 2022

Documenting unstable options is always a balancing act. If we knew how they were gonna work forever, it would be easy and helpful to document them but they wouldn't be unstable. If we hide the documentation too much to keep people from getting in over their heads, then it's really hard to find.

I would be open to a sentence or two providing breadcrumbs for people to find the unstable documentation. You're the one who most recently experience the confusion, and therefore are in the best place to know where a sentence would be helpful. PRs are welcome.

-Z registry-auth is actually a great example of this, it is likely to gain meaning when #10771 is merged. Your reputation precedes you, if you're planning to create one of your masterpieces about the improvements to authentication please be mindful that the current state of nightly is likely to change. The plan is for the stabilize version of the feature to require the use of asymmetric tokens for authenticated registries.

@jonathanstrong
Copy link

please be mindful that the current state of nightly is likely to change. The plan is for the stabilize version of the feature to require the use of asymmetric tokens for authenticated registries.

is there any place this decision is being discussed/debated? would like to weigh in and I imagine this is not the best venue!

@arlosi
Copy link
Contributor Author

arlosi commented Nov 22, 2022

is there any place this decision is being discussed/debated?

Feel free to start a thread on zulip if you'd like to chat, or create a new issue if there's something specific you'd like changed.

You can also keep adding comments here too.

bors added a commit that referenced this pull request Dec 29, 2022
Asymmetric tokens

Builds on and is blocked by #10592. This adds initial support for Asymmetric Tokens #10519.
bors added a commit that referenced this pull request Dec 29, 2022
Asymmetric tokens

Builds on and is blocked by #10592. This adds initial support for Asymmetric Tokens #10519.
unable to get packages from source

Caused by:
multiple registries are configured with the same index url \
Copy link

Choose a reason for hiding this comment

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

Why has this been added? I have "e" and "estuary" pointing to the same registry url and one is just an alias. This change makes it impossible to publish to the registry without either modifying the .cargo config.toml file or switching back to stable.

Copy link
Contributor

@ehuss ehuss Dec 30, 2022

Choose a reason for hiding this comment

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

@dasbard It's better to file a new issue instead of commenting on a closed PR. I opened #11524 to track it.

@ehuss ehuss added this to the 1.67.0 milestone Dec 30, 2022
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Jan 27, 2023
Pkgsrc changes:
 * Adjust patches and cargo checksums to new versions,
   but also one strange "mips" conditional.

Upstream changes:

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)
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)
@ehuss ehuss mentioned this pull request Jul 12, 2023
1 task
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.

10 participants