From a25ec1a018391e2bf1e204bb5c2921a0b42f52f8 Mon Sep 17 00:00:00 2001 From: zedddie Date: Mon, 25 May 2026 16:16:38 +0200 Subject: [PATCH 1/4] move batch --- .../issue-16922-rpass.rs => coercion/fn-item-to-dyn-any.rs} | 0 .../auxiliary/dyn-trait-lifetime-infer-metadata.rs} | 0 .../dyn-trait-lifetime-infer-metadata.rs} | 0 .../deprecated-unstable-method-in-staged-api.rs} | 0 .../deprecated-unstable-method-in-staged-api.stderr} | 0 .../issue-17216.rs => drop/drop-in-for-loop-destructure.rs} | 0 .../need_type_info/unconstrained-type-in-closure.rs} | 0 .../need_type_info/unconstrained-type-in-closure.stderr} | 0 .../relate-bound-region-in-method-return.rs} | 0 .../tuple-variant-as-struct-variant.rs} | 0 .../tuple-variant-as-struct-variant.stderr} | 0 .../thread-local-borrow-past-function-end.rs} | 0 .../thread-local-borrow-past-function-end.stderr} | 0 .../where-clause-on-struct-definitions.rs} | 0 .../where-clause-on-unit-struct.rs} | 0 .../where-clause-on-unit-struct.stderr} | 0 16 files changed, 0 insertions(+), 0 deletions(-) rename tests/ui/{issues/issue-16922-rpass.rs => coercion/fn-item-to-dyn-any.rs} (100%) rename tests/ui/{issues/auxiliary/issue-17662.rs => cross-crate/auxiliary/dyn-trait-lifetime-infer-metadata.rs} (100%) rename tests/ui/{issues/issue-17662.rs => cross-crate/dyn-trait-lifetime-infer-metadata.rs} (100%) rename tests/ui/{issues/issue-17337.rs => deprecation/deprecated-unstable-method-in-staged-api.rs} (100%) rename tests/ui/{issues/issue-17337.stderr => deprecation/deprecated-unstable-method-in-staged-api.stderr} (100%) rename tests/ui/{issues/issue-17216.rs => drop/drop-in-for-loop-destructure.rs} (100%) rename tests/ui/{issues/issue-17551.rs => inference/need_type_info/unconstrained-type-in-closure.rs} (100%) rename tests/ui/{issues/issue-17551.stderr => inference/need_type_info/unconstrained-type-in-closure.stderr} (100%) rename tests/ui/{issues/issue-17121.rs => regions/relate-bound-region-in-method-return.rs} (100%) rename tests/ui/{issues/issue-17800.rs => structs-enums/tuple-variant-as-struct-variant.rs} (100%) rename tests/ui/{issues/issue-17800.stderr => structs-enums/tuple-variant-as-struct-variant.stderr} (100%) rename tests/ui/{issues/issue-17954.rs => thread-local/thread-local-borrow-past-function-end.rs} (100%) rename tests/ui/{issues/issue-17954.stderr => thread-local/thread-local-borrow-past-function-end.stderr} (100%) rename tests/ui/{issues/issue-17904.rs => where-clauses/where-clause-on-struct-definitions.rs} (100%) rename tests/ui/{issues/issue-17904-2.rs => where-clauses/where-clause-on-unit-struct.rs} (100%) rename tests/ui/{issues/issue-17904-2.stderr => where-clauses/where-clause-on-unit-struct.stderr} (100%) diff --git a/tests/ui/issues/issue-16922-rpass.rs b/tests/ui/coercion/fn-item-to-dyn-any.rs similarity index 100% rename from tests/ui/issues/issue-16922-rpass.rs rename to tests/ui/coercion/fn-item-to-dyn-any.rs diff --git a/tests/ui/issues/auxiliary/issue-17662.rs b/tests/ui/cross-crate/auxiliary/dyn-trait-lifetime-infer-metadata.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-17662.rs rename to tests/ui/cross-crate/auxiliary/dyn-trait-lifetime-infer-metadata.rs diff --git a/tests/ui/issues/issue-17662.rs b/tests/ui/cross-crate/dyn-trait-lifetime-infer-metadata.rs similarity index 100% rename from tests/ui/issues/issue-17662.rs rename to tests/ui/cross-crate/dyn-trait-lifetime-infer-metadata.rs diff --git a/tests/ui/issues/issue-17337.rs b/tests/ui/deprecation/deprecated-unstable-method-in-staged-api.rs similarity index 100% rename from tests/ui/issues/issue-17337.rs rename to tests/ui/deprecation/deprecated-unstable-method-in-staged-api.rs diff --git a/tests/ui/issues/issue-17337.stderr b/tests/ui/deprecation/deprecated-unstable-method-in-staged-api.stderr similarity index 100% rename from tests/ui/issues/issue-17337.stderr rename to tests/ui/deprecation/deprecated-unstable-method-in-staged-api.stderr diff --git a/tests/ui/issues/issue-17216.rs b/tests/ui/drop/drop-in-for-loop-destructure.rs similarity index 100% rename from tests/ui/issues/issue-17216.rs rename to tests/ui/drop/drop-in-for-loop-destructure.rs diff --git a/tests/ui/issues/issue-17551.rs b/tests/ui/inference/need_type_info/unconstrained-type-in-closure.rs similarity index 100% rename from tests/ui/issues/issue-17551.rs rename to tests/ui/inference/need_type_info/unconstrained-type-in-closure.rs diff --git a/tests/ui/issues/issue-17551.stderr b/tests/ui/inference/need_type_info/unconstrained-type-in-closure.stderr similarity index 100% rename from tests/ui/issues/issue-17551.stderr rename to tests/ui/inference/need_type_info/unconstrained-type-in-closure.stderr diff --git a/tests/ui/issues/issue-17121.rs b/tests/ui/regions/relate-bound-region-in-method-return.rs similarity index 100% rename from tests/ui/issues/issue-17121.rs rename to tests/ui/regions/relate-bound-region-in-method-return.rs diff --git a/tests/ui/issues/issue-17800.rs b/tests/ui/structs-enums/tuple-variant-as-struct-variant.rs similarity index 100% rename from tests/ui/issues/issue-17800.rs rename to tests/ui/structs-enums/tuple-variant-as-struct-variant.rs diff --git a/tests/ui/issues/issue-17800.stderr b/tests/ui/structs-enums/tuple-variant-as-struct-variant.stderr similarity index 100% rename from tests/ui/issues/issue-17800.stderr rename to tests/ui/structs-enums/tuple-variant-as-struct-variant.stderr diff --git a/tests/ui/issues/issue-17954.rs b/tests/ui/thread-local/thread-local-borrow-past-function-end.rs similarity index 100% rename from tests/ui/issues/issue-17954.rs rename to tests/ui/thread-local/thread-local-borrow-past-function-end.rs diff --git a/tests/ui/issues/issue-17954.stderr b/tests/ui/thread-local/thread-local-borrow-past-function-end.stderr similarity index 100% rename from tests/ui/issues/issue-17954.stderr rename to tests/ui/thread-local/thread-local-borrow-past-function-end.stderr diff --git a/tests/ui/issues/issue-17904.rs b/tests/ui/where-clauses/where-clause-on-struct-definitions.rs similarity index 100% rename from tests/ui/issues/issue-17904.rs rename to tests/ui/where-clauses/where-clause-on-struct-definitions.rs diff --git a/tests/ui/issues/issue-17904-2.rs b/tests/ui/where-clauses/where-clause-on-unit-struct.rs similarity index 100% rename from tests/ui/issues/issue-17904-2.rs rename to tests/ui/where-clauses/where-clause-on-unit-struct.rs diff --git a/tests/ui/issues/issue-17904-2.stderr b/tests/ui/where-clauses/where-clause-on-unit-struct.stderr similarity index 100% rename from tests/ui/issues/issue-17904-2.stderr rename to tests/ui/where-clauses/where-clause-on-unit-struct.stderr From 480b44c8e1b9f4eb0885430bbc7a4ac89ff2b3f6 Mon Sep 17 00:00:00 2001 From: zedddie Date: Mon, 25 May 2026 17:48:48 +0200 Subject: [PATCH 2/4] bless batch --- tests/ui/coercion/fn-item-to-dyn-any.rs | 1 + .../auxiliary/dyn-trait-lifetime-infer-metadata.rs | 1 + tests/ui/cross-crate/dyn-trait-lifetime-infer-metadata.rs | 6 +++--- .../deprecation/deprecated-unstable-method-in-staged-api.rs | 1 + .../deprecated-unstable-method-in-staged-api.stderr | 4 ++-- tests/ui/drop/drop-in-for-loop-destructure.rs | 1 + .../need_type_info/unconstrained-type-in-closure.rs | 2 ++ .../need_type_info/unconstrained-type-in-closure.stderr | 2 +- tests/ui/regions/relate-bound-region-in-method-return.rs | 1 + tests/ui/structs-enums/tuple-variant-as-struct-variant.rs | 2 ++ .../ui/structs-enums/tuple-variant-as-struct-variant.stderr | 2 +- .../thread-local/thread-local-borrow-past-function-end.rs | 1 + .../thread-local-borrow-past-function-end.stderr | 2 +- .../ui/where-clauses/where-clause-on-struct-definitions.rs | 1 + tests/ui/where-clauses/where-clause-on-unit-struct.rs | 1 + tests/ui/where-clauses/where-clause-on-unit-struct.stderr | 2 +- 16 files changed, 21 insertions(+), 9 deletions(-) diff --git a/tests/ui/coercion/fn-item-to-dyn-any.rs b/tests/ui/coercion/fn-item-to-dyn-any.rs index f7ffcfb1d94e3..0e6e5aa5f89ce 100644 --- a/tests/ui/coercion/fn-item-to-dyn-any.rs +++ b/tests/ui/coercion/fn-item-to-dyn-any.rs @@ -1,3 +1,4 @@ +//! Regression test for . //@ run-pass use std::any::Any; diff --git a/tests/ui/cross-crate/auxiliary/dyn-trait-lifetime-infer-metadata.rs b/tests/ui/cross-crate/auxiliary/dyn-trait-lifetime-infer-metadata.rs index 5ecec31deb018..b2265886cb243 100644 --- a/tests/ui/cross-crate/auxiliary/dyn-trait-lifetime-infer-metadata.rs +++ b/tests/ui/cross-crate/auxiliary/dyn-trait-lifetime-infer-metadata.rs @@ -1,3 +1,4 @@ +//! Auxiliary crate for . #![crate_type = "lib"] pub trait Foo<'a, T> { diff --git a/tests/ui/cross-crate/dyn-trait-lifetime-infer-metadata.rs b/tests/ui/cross-crate/dyn-trait-lifetime-infer-metadata.rs index e75613e04d333..aacc91f5f6f99 100644 --- a/tests/ui/cross-crate/dyn-trait-lifetime-infer-metadata.rs +++ b/tests/ui/cross-crate/dyn-trait-lifetime-infer-metadata.rs @@ -1,8 +1,8 @@ +//! Regression test for . //@ run-pass -//@ aux-build:issue-17662.rs +//@ aux-build:dyn-trait-lifetime-infer-metadata.rs - -extern crate issue_17662 as i; +extern crate dyn_trait_lifetime_infer_metadata as i; use std::marker; diff --git a/tests/ui/deprecation/deprecated-unstable-method-in-staged-api.rs b/tests/ui/deprecation/deprecated-unstable-method-in-staged-api.rs index 193f89f837897..a4142ff701aec 100644 --- a/tests/ui/deprecation/deprecated-unstable-method-in-staged-api.rs +++ b/tests/ui/deprecation/deprecated-unstable-method-in-staged-api.rs @@ -1,3 +1,4 @@ +//! Regression test for . #![feature(staged_api)] #![deny(deprecated)] diff --git a/tests/ui/deprecation/deprecated-unstable-method-in-staged-api.stderr b/tests/ui/deprecation/deprecated-unstable-method-in-staged-api.stderr index 8fbf6882699de..6c21b45dfd3cc 100644 --- a/tests/ui/deprecation/deprecated-unstable-method-in-staged-api.stderr +++ b/tests/ui/deprecation/deprecated-unstable-method-in-staged-api.stderr @@ -1,11 +1,11 @@ error: use of deprecated method `Foo::foo`: text - --> $DIR/issue-17337.rs:16:6 + --> $DIR/deprecated-unstable-method-in-staged-api.rs:17:6 | LL | .foo(); | ^^^ | note: the lint level is defined here - --> $DIR/issue-17337.rs:2:9 + --> $DIR/deprecated-unstable-method-in-staged-api.rs:3:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ diff --git a/tests/ui/drop/drop-in-for-loop-destructure.rs b/tests/ui/drop/drop-in-for-loop-destructure.rs index 31b16ef3a2f7b..2c277777eaf6a 100644 --- a/tests/ui/drop/drop-in-for-loop-destructure.rs +++ b/tests/ui/drop/drop-in-for-loop-destructure.rs @@ -1,3 +1,4 @@ +//! Regression test for . //@ run-pass #![allow(unused_variables)] struct Leak<'a> { diff --git a/tests/ui/inference/need_type_info/unconstrained-type-in-closure.rs b/tests/ui/inference/need_type_info/unconstrained-type-in-closure.rs index a65957ce074ef..3b6c20fe5bfbb 100644 --- a/tests/ui/inference/need_type_info/unconstrained-type-in-closure.rs +++ b/tests/ui/inference/need_type_info/unconstrained-type-in-closure.rs @@ -1,3 +1,5 @@ +//! Regression test for . + use std::marker; struct B(marker::PhantomData); diff --git a/tests/ui/inference/need_type_info/unconstrained-type-in-closure.stderr b/tests/ui/inference/need_type_info/unconstrained-type-in-closure.stderr index b9cb76fc298d9..18c7f669fae7d 100644 --- a/tests/ui/inference/need_type_info/unconstrained-type-in-closure.stderr +++ b/tests/ui/inference/need_type_info/unconstrained-type-in-closure.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed for `B<_>` - --> $DIR/issue-17551.rs:6:9 + --> $DIR/unconstrained-type-in-closure.rs:8:9 | LL | let foo = B(marker::PhantomData); | ^^^ ------------------- type must be known at this point diff --git a/tests/ui/regions/relate-bound-region-in-method-return.rs b/tests/ui/regions/relate-bound-region-in-method-return.rs index 6bb89a4aa7b43..a994f7f1af0cb 100644 --- a/tests/ui/regions/relate-bound-region-in-method-return.rs +++ b/tests/ui/regions/relate-bound-region-in-method-return.rs @@ -1,3 +1,4 @@ +//! Regression test for . //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/structs-enums/tuple-variant-as-struct-variant.rs b/tests/ui/structs-enums/tuple-variant-as-struct-variant.rs index 5254f45d7c2de..53da4622013ba 100644 --- a/tests/ui/structs-enums/tuple-variant-as-struct-variant.rs +++ b/tests/ui/structs-enums/tuple-variant-as-struct-variant.rs @@ -1,3 +1,5 @@ +//! Regression test for . + enum MyOption { MySome(T), MyNone, diff --git a/tests/ui/structs-enums/tuple-variant-as-struct-variant.stderr b/tests/ui/structs-enums/tuple-variant-as-struct-variant.stderr index 322c77eaa1dc5..1170e3b7bfd8a 100644 --- a/tests/ui/structs-enums/tuple-variant-as-struct-variant.stderr +++ b/tests/ui/structs-enums/tuple-variant-as-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0769]: tuple variant `MyOption::MySome` written as struct variant - --> $DIR/issue-17800.rs:8:9 + --> $DIR/tuple-variant-as-struct-variant.rs:10:9 | LL | MyOption::MySome { x: 42 } => (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/thread-local/thread-local-borrow-past-function-end.rs b/tests/ui/thread-local/thread-local-borrow-past-function-end.rs index eb6a3d70f58e2..12938f0a0a2d4 100644 --- a/tests/ui/thread-local/thread-local-borrow-past-function-end.rs +++ b/tests/ui/thread-local/thread-local-borrow-past-function-end.rs @@ -1,3 +1,4 @@ +//! Regression test for . #![feature(thread_local)] #[thread_local] diff --git a/tests/ui/thread-local/thread-local-borrow-past-function-end.stderr b/tests/ui/thread-local/thread-local-borrow-past-function-end.stderr index 0dddea8336483..7686a6b714764 100644 --- a/tests/ui/thread-local/thread-local-borrow-past-function-end.stderr +++ b/tests/ui/thread-local/thread-local-borrow-past-function-end.stderr @@ -1,5 +1,5 @@ error[E0712]: thread-local variable borrowed past end of function - --> $DIR/issue-17954.rs:7:13 + --> $DIR/thread-local-borrow-past-function-end.rs:8:13 | LL | let a = &FOO; | ^^^^ thread-local variables cannot be borrowed beyond the end of the function diff --git a/tests/ui/where-clauses/where-clause-on-struct-definitions.rs b/tests/ui/where-clauses/where-clause-on-struct-definitions.rs index fba71f70dd98e..a49df546ac31b 100644 --- a/tests/ui/where-clauses/where-clause-on-struct-definitions.rs +++ b/tests/ui/where-clauses/where-clause-on-struct-definitions.rs @@ -1,3 +1,4 @@ +//! Regression test for . //@ check-pass #![allow(dead_code)] // Test that we can parse where clauses on various forms of tuple diff --git a/tests/ui/where-clauses/where-clause-on-unit-struct.rs b/tests/ui/where-clauses/where-clause-on-unit-struct.rs index 9603da097b1cf..46fdd3737fa70 100644 --- a/tests/ui/where-clauses/where-clause-on-unit-struct.rs +++ b/tests/ui/where-clauses/where-clause-on-unit-struct.rs @@ -1,3 +1,4 @@ +//! Regression test for . // Test that we can parse a unit struct with a where clause, even if // it leads to an error later on since `T` is unused. diff --git a/tests/ui/where-clauses/where-clause-on-unit-struct.stderr b/tests/ui/where-clauses/where-clause-on-unit-struct.stderr index 9965106d1401a..174c2d9e22e8d 100644 --- a/tests/ui/where-clauses/where-clause-on-unit-struct.stderr +++ b/tests/ui/where-clauses/where-clause-on-unit-struct.stderr @@ -1,5 +1,5 @@ error[E0392]: type parameter `T` is never used - --> $DIR/issue-17904-2.rs:4:12 + --> $DIR/where-clause-on-unit-struct.rs:5:12 | LL | struct Foo where T: Copy; | ^ unused type parameter From b328c251b736ea89d14af55bd14a257d620531a4 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 25 May 2026 17:59:47 -0700 Subject: [PATCH 3/4] Update mdbook to 0.5.3 This is a small update with a few bug fixes. Changelog: https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-053 --- src/tools/rustbook/Cargo.lock | 685 +++++++++++++++++++++++----------- src/tools/rustbook/Cargo.toml | 2 +- 2 files changed, 474 insertions(+), 213 deletions(-) diff --git a/src/tools/rustbook/Cargo.lock b/src/tools/rustbook/Cargo.lock index 89a581c90aa88..36b3705027aa1 100644 --- a/src/tools/rustbook/Cargo.lock +++ b/src/tools/rustbook/Cargo.lock @@ -28,9 +28,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.21" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", "anstyle-parse", @@ -43,15 +43,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anstyle-parse" -version = "0.2.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" dependencies = [ "utf8parse", ] @@ -78,15 +78,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.100" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "autocfg" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" [[package]] name = "bincode" @@ -114,9 +114,9 @@ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" -version = "2.10.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" [[package]] name = "block-buffer" @@ -127,17 +127,26 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-buffer" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be" +dependencies = [ + "hybrid-array", +] + [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" [[package]] name = "cc" -version = "1.2.45" +version = "1.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35900b6c8d709fb1d854671ae27aeaa9eec2f8b01b364e1619a40da3e6fe2afe" +checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98" dependencies = [ "find-msvc-tools", "shlex", @@ -151,9 +160,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" -version = "0.4.42" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" dependencies = [ "iana-time-zone", "js-sys", @@ -164,9 +173,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.51" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" dependencies = [ "clap_builder", "clap_derive", @@ -174,9 +183,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.51" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ "anstream", "anstyle", @@ -186,9 +195,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.49" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" dependencies = [ "heck", "proc-macro2", @@ -198,15 +207,21 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "colorchoice" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "const-oid" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" [[package]] name = "core-foundation-sys" @@ -223,6 +238,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.0" @@ -234,14 +258,23 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", "typenum", ] +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + [[package]] name = "darling" version = "0.20.11" @@ -330,8 +363,19 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", - "crypto-common", + "block-buffer 0.10.4", + "crypto-common 0.1.7", +] + +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer 0.12.0", + "const-oid", + "crypto-common 0.2.2", ] [[package]] @@ -342,9 +386,9 @@ checksum = "780955b8b195a21ab8e4ac6b60dd1dbdcec1dc6c51c0617964b08c81785e12c9" [[package]] name = "ego-tree" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2972feb8dffe7bc8c5463b1dacda1b0dfbed3710e50f977d965429692d74cd8" +checksum = "b04dc5a38e4f151a79d9f2451ae6037fb6eaf5cba34771f44781f80e508498e3" [[package]] name = "elasticlunr-rs" @@ -395,21 +439,21 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.3.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" [[package]] name = "find-msvc-tools" -version = "0.1.4" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "flate2" -version = "1.1.5" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ "crc32fast", "miniz_oxide", @@ -421,27 +465,47 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "font-awesome-as-a-crate" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "932dcfbd51320af5f27f1ba02d2e567dec332cac7d2c221ba45d8e767264c4dc" +checksum = "b40fbe89eb7639971503bf5f17bd31c41338e8f92e03c5744d07f2e03d43f679" [[package]] -name = "futf" -version = "0.1.5" +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-task" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ - "mac", - "new_debug_unreachable", + "futures-core", + "futures-task", + "pin-project-lite", + "slab", ] [[package]] name = "generic-array" -version = "0.14.9" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -458,14 +522,15 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.4" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" dependencies = [ "cfg-if", "libc", "r-efi", "wasip2", + "wasip3", ] [[package]] @@ -480,9 +545,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "6.3.2" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759e2d5aea3287cb1190c8ec394f42866cb5bf74fcbf213f354e3c856ea26098" +checksum = "d43ccdfe15a81ab0a8af639e90254227c9a46afd9c5f5b6ec7efaa345c4b0f00" dependencies = [ "derive_builder", "log", @@ -491,14 +556,23 @@ dependencies = [ "pest_derive", "serde", "serde_json", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] name = "hashbrown" -version = "0.16.1" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" [[package]] name = "heck" @@ -514,9 +588,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "html5ever" -version = "0.36.1" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6452c4751a24e1b99c3260d505eaeee76a050573e61f30ac2c924ddc7236f01e" +checksum = "46a1761807faccc9a19e86944bbf40610014066306f96edcdedc2fb714bcb7b8" dependencies = [ "log", "markup5ever", @@ -537,11 +611,20 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "hybrid-array" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9155a582abd142abc056962c29e3ce5ff2ad5469f4246b537ed42c5deba857da" +dependencies = [ + "typenum", +] + [[package]] name = "iana-time-zone" -version = "0.1.64" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -561,6 +644,12 @@ dependencies = [ "cc", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "ident_case" version = "1.0.1" @@ -569,12 +658,14 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "indexmap" -version = "2.12.1" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.17.1", + "serde", + "serde_core", ] [[package]] @@ -585,16 +676,18 @@ checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "js-sys" -version = "0.3.82" +version = "0.3.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" +checksum = "142bc4740e452c1e57ade0cbc129f139c9093e354346f0872ef985f4f5cf5f11" dependencies = [ + "cfg-if", + "futures-util", "once_cell", "wasm-bindgen", ] @@ -605,11 +698,17 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" -version = "0.2.177" +version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" [[package]] name = "linereader" @@ -622,9 +721,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "lock_api" @@ -637,21 +736,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" - -[[package]] -name = "mac" -version = "0.1.1" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" +checksum = "616ec5685824bcc94416c6d4a7a446eea774a31efd7062c8480ba6fd06d7a6e5" [[package]] name = "markup5ever" -version = "0.36.1" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c3294c4d74d0742910f8c7b466f44dda9eb2d5742c1e430138df290a1e8451c" +checksum = "7122d987ec5f704ee56f6e5b41a7d93722e9aae27ae07cafa4036c4d3f9757de" dependencies = [ "log", "tendril", @@ -669,23 +762,23 @@ dependencies = [ [[package]] name = "mdbook-core" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39a3873d4afac65583f1acb56ff058df989d5b4a2464bb02c785549727d307ee" +checksum = "6fc1c4da7fd9e2e412f3891428f9468fab890ed159723ed0892bb85a049ac1c1" dependencies = [ "anyhow", "regex", "serde", "serde_json", - "toml 0.9.8", + "toml 1.1.2+spec-1.1.0", "tracing", ] [[package]] name = "mdbook-driver" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a229930b29a9908560883e1f386eae25d8a971d259a80f49916a50627f04a42d" +checksum = "2068566fc3c100cfd19f4a13e4e0eb4fdcd2250cfd0aa633ec25102b1c98d53e" dependencies = [ "anyhow", "indexmap", @@ -700,16 +793,16 @@ dependencies = [ "serde_json", "shlex", "tempfile", - "toml 0.9.8", + "toml 1.1.2+spec-1.1.0", "topological-sort", "tracing", ] [[package]] name = "mdbook-html" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dee80c03c65e3212fb528b8c9be5568a6a85cf795d03cf9fd6ba39ad52069ca" +checksum = "85ed2140251689f928615f0a5615413eb072eb28e003d179257aa4f034c95513" dependencies = [ "anyhow", "ego-tree", @@ -722,11 +815,11 @@ dependencies = [ "mdbook-core", "mdbook-markdown", "mdbook-renderer", - "pulldown-cmark 0.13.0", + "pulldown-cmark 0.13.4", "regex", "serde", "serde_json", - "sha2", + "sha2 0.11.0", "tracing", ] @@ -742,7 +835,7 @@ dependencies = [ "mdbook-preprocessor", "mdbook-renderer", "polib", - "pulldown-cmark 0.13.0", + "pulldown-cmark 0.13.4", "pulldown-cmark-to-cmark 21.1.0", "regex", "semver", @@ -753,20 +846,20 @@ dependencies = [ [[package]] name = "mdbook-markdown" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07c41bf35212f5d8b83e543aa6a4887dc5709c8489c5fb9ed00f1b51ce1a2cc6" +checksum = "2cb3ca9eadf02ce206118a0b9c264718723d669b110c01a720fa9a0786f30642" dependencies = [ - "pulldown-cmark 0.13.0", + "pulldown-cmark 0.13.4", "regex", "tracing", ] [[package]] name = "mdbook-preprocessor" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d87bf40be0597f26f0822f939a64f02bf92c4655ba04490aadbf83601a013bb" +checksum = "8eff7b4afaafd664a649a03b8891ad8199aef359a35b911ad6c31acab38ed209" dependencies = [ "anyhow", "mdbook-core", @@ -776,9 +869,9 @@ dependencies = [ [[package]] name = "mdbook-renderer" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ed59f225b3ae4283c56bea633db83184627a090d892908bd66990c68e10b43" +checksum = "e607259410d53aa5cdaf5b6c1c6b3fd61f2e0f0523ebf457d34cd4f0b71e2a88" dependencies = [ "anyhow", "mdbook-core", @@ -807,14 +900,14 @@ dependencies = [ [[package]] name = "mdbook-summary" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c00d85b291d67a69c92e939450390fe34d6ea418a868c8f7b42f0b300af35a7b" +checksum = "cae8a734e5e35b0bc145b46d01fd27e266ba647dcdb9b8c907cb6a29eca9122b" dependencies = [ "anyhow", "mdbook-core", "memchr", - "pulldown-cmark 0.13.0", + "pulldown-cmark 0.13.4", "serde", "tracing", ] @@ -837,9 +930,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "miniz_oxide" @@ -892,9 +985,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "once_cell_polyfill" @@ -933,9 +1026,9 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "pest" -version = "2.8.3" +version = "2.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e7521a040efde50c3ab6bbadafbe15ab6dc042686926be59ac35d74607df4" +checksum = "e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662" dependencies = [ "memchr", "ucd-trie", @@ -943,9 +1036,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.8.3" +version = "2.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "187da9a3030dbafabbbfb20cb323b976dc7b7ce91fcd84f2f74d6e31d378e2de" +checksum = "11f486f1ea21e6c10ed15d5a7c77165d0ee443402f0780849d1768e7d9d6fe77" dependencies = [ "pest", "pest_generator", @@ -953,9 +1046,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.8.3" +version = "2.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b401d98f5757ebe97a26085998d6c0eecec4995cad6ab7fc30ffdf4b052843" +checksum = "8040c4647b13b210a963c1ed407c1ff4fdfa01c31d6d2a098218702e6664f94f" dependencies = [ "pest", "pest_meta", @@ -966,12 +1059,12 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.8.3" +version = "2.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f27a2cfee9f9039c4d86faa5af122a0ac3851441a34865b8a043b46be0065a" +checksum = "89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220" dependencies = [ "pest", - "sha2", + "sha2 0.10.9", ] [[package]] @@ -1015,9 +1108,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "polib" @@ -1034,11 +1127,21 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] @@ -1058,9 +1161,9 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.13.0" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e8bbe1a966bd2f362681a44f6edce3c2310ac21e4d5067a6e7ec396297a6ea0" +checksum = "e9f068eba8e7071c5f9511831b44f32c740d5adf574e990f946ddb53db2f314e" dependencies = [ "bitflags", "memchr", @@ -1089,29 +1192,29 @@ version = "21.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8246feae3db61428fd0bb94285c690b460e4517d83152377543ca802357785f1" dependencies = [ - "pulldown-cmark 0.13.0", + "pulldown-cmark 0.13.4", ] [[package]] name = "quote" -version = "1.0.42" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] [[package]] name = "r-efi" -version = "5.3.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "railroad" -version = "0.3.3" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5b8e8a7c20c600f9b98cbf46b64e63d5c9e69deb98cee1ff264de9f1dda5d" +checksum = "813b53dbe6d583f1ac0c3fb394e0ce3b613530adff8265c274fcdfcd82cc6da5" dependencies = [ "unicode-width", ] @@ -1127,9 +1230,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -1139,9 +1242,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -1150,9 +1253,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "rustbook" @@ -1168,9 +1271,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ "bitflags", "errno", @@ -1185,12 +1288,6 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - [[package]] name = "same-file" version = "1.0.6" @@ -1208,9 +1305,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" [[package]] name = "serde" @@ -1244,15 +1341,15 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" dependencies = [ "itoa", "memchr", - "ryu", "serde", "serde_core", + "zmij", ] [[package]] @@ -1266,9 +1363,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.0.3" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" dependencies = [ "serde_core", ] @@ -1280,8 +1377,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", - "digest", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "digest 0.11.3", ] [[package]] @@ -1301,15 +1409,21 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "simd-adler32" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" [[package]] name = "siphasher" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" @@ -1327,7 +1441,6 @@ dependencies = [ "parking_lot", "phf_shared", "precomputed-hash", - "serde", ] [[package]] @@ -1350,9 +1463,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.110" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -1373,15 +1486,15 @@ dependencies = [ "regex-syntax", "serde", "serde_derive", - "thiserror 2.0.17", + "thiserror 2.0.18", "walkdir", ] [[package]] name = "tempfile" -version = "3.23.0" +version = "3.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", "getrandom", @@ -1392,12 +1505,11 @@ dependencies = [ [[package]] name = "tendril" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +checksum = "c4790fc369d5a530f4b544b094e31388b9b3a37c0f4652ade4505945f5660d24" dependencies = [ - "futf", - "mac", + "new_debug_unreachable", "utf-8", ] @@ -1418,11 +1530,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl 2.0.17", + "thiserror-impl 2.0.18", ] [[package]] @@ -1438,9 +1550,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", @@ -1470,17 +1582,17 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.8" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8" +checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" dependencies = [ "indexmap", "serde_core", - "serde_spanned 1.0.3", - "toml_datetime 0.7.3", + "serde_spanned 1.1.1", + "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", "toml_writer", - "winnow", + "winnow 1.0.3", ] [[package]] @@ -1494,9 +1606,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.3" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" dependencies = [ "serde_core", ] @@ -1512,16 +1624,16 @@ dependencies = [ "serde_spanned 0.6.9", "toml_datetime 0.6.11", "toml_write", - "winnow", + "winnow 0.7.15", ] [[package]] name = "toml_parser" -version = "1.0.4" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" dependencies = [ - "winnow", + "winnow 1.0.3", ] [[package]] @@ -1532,9 +1644,9 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" [[package]] name = "toml_writer" -version = "1.0.4" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" [[package]] name = "topological-sort" @@ -1544,9 +1656,9 @@ checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" [[package]] name = "tracing" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -1566,9 +1678,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -1587,9 +1699,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" dependencies = [ "matchers", "nu-ansi-term", @@ -1605,9 +1717,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de" [[package]] name = "ucd-trie" @@ -1617,15 +1729,15 @@ checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unicase" -version = "2.8.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" [[package]] name = "unicode-ident" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-width" @@ -1633,6 +1745,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "utf-8" version = "0.7.6" @@ -1669,18 +1787,27 @@ dependencies = [ [[package]] name = "wasip2" -version = "1.0.1+wasi-0.2.4" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen 0.57.1", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.51.0", ] [[package]] name = "wasm-bindgen" -version = "0.2.105" +version = "0.2.122" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" +checksum = "3ed04576f974d2b2fba0f38c51dbc5518011e38c36bf1143164be765528fd409" dependencies = [ "cfg-if", "once_cell", @@ -1691,9 +1818,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.105" +version = "0.2.122" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" +checksum = "916151b09da36bd82f6615cbf3a419e2f0ba23a03c6160e8e92eb6bd4aa1dec6" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1701,9 +1828,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.105" +version = "0.2.122" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" +checksum = "299047362ccbfce148b67ab7e73349f77748e00c8296f9542adfad2ad82c5c5e" dependencies = [ "bumpalo", "proc-macro2", @@ -1714,18 +1841,52 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.105" +version = "0.2.122" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" +checksum = "9a929b2c61f11ba3e9bc35b50c1f25cb38e0e892c0c231ae2b8cf78d5dad4437" dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + [[package]] name = "web_atoms" -version = "0.2.0" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd0c322f146d0f8aad130ce6c187953889359584497dac6561204c8e17bb43d" +checksum = "d7cff6eef815df1834fd250e3a2ff436044d82a9f1bc1980ca1dbdf07effc538" dependencies = [ "phf", "phf_codegen", @@ -1812,15 +1973,115 @@ dependencies = [ [[package]] name = "winnow" -version = "0.7.13" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + [[package]] name = "wit-bindgen" -version = "0.46.0" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "zmij" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml index 6f28ebe519314..f981d09fbbee1 100644 --- a/src/tools/rustbook/Cargo.toml +++ b/src/tools/rustbook/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" [dependencies] clap = { version = "4.0.32", features = ["cargo"] } -mdbook-driver = { version = "0.5.2", features = ["search"] } +mdbook-driver = { version = "0.5.3", features = ["search"] } mdbook-i18n-helpers = "0.4.0" mdbook-spec = { path = "../../doc/reference/tools/mdbook-spec" } mdbook-trpl = { path = "../../doc/book/packages/mdbook-trpl" } From 40a782103b749f09d15e7629083e18803dc307db Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Tue, 26 May 2026 08:06:36 +0300 Subject: [PATCH 4/4] Remove method call generation in delegation --- compiler/rustc_ast_lowering/src/delegation.rs | 182 +- .../src/delegation/generics.rs | 45 +- compiler/rustc_hir/src/hir.rs | 11 +- compiler/rustc_hir_analysis/src/delegation.rs | 22 +- compiler/rustc_hir_analysis/src/lib.rs | 2 +- compiler/rustc_hir_typeck/src/callee.rs | 123 +- .../rustc_hir_typeck/src/fn_ctxt/checks.rs | 9 +- .../rustc_hir_typeck/src/method/confirm.rs | 31 +- compiler/rustc_hir_typeck/src/method/mod.rs | 2 +- tests/pretty/delegation-inline-attribute.pp | 31 +- tests/pretty/delegation-self-rename.pp | 2 +- ...y_owner_parent_found_in_diagnostics.stderr | 47 +- .../delegation/generics/generics-aux-pass.rs | 5 - .../generics/impl-to-trait-method.rs | 1 - .../generics/impl-to-trait-method.stderr | 11 +- tests/ui/delegation/self-coercion-errors.rs | 234 ++ .../ui/delegation/self-coercion-errors.stderr | 1916 +++++++++++++++++ .../delegation/self-coercion-static-free.rs | 52 + .../self-coercion-static-free.stderr | 87 + tests/ui/delegation/self-coercion.rs | 14 +- tests/ui/delegation/wrong-lifetime-rib.rs | 2 +- tests/ui/delegation/wrong-lifetime-rib.stderr | 14 +- 22 files changed, 2606 insertions(+), 237 deletions(-) create mode 100644 tests/ui/delegation/self-coercion-errors.rs create mode 100644 tests/ui/delegation/self-coercion-errors.stderr create mode 100644 tests/ui/delegation/self-coercion-static-free.rs create mode 100644 tests/ui/delegation/self-coercion-static-free.stderr diff --git a/compiler/rustc_ast_lowering/src/delegation.rs b/compiler/rustc_ast_lowering/src/delegation.rs index df5ea7c3168ff..8accaa8c3125c 100644 --- a/compiler/rustc_ast_lowering/src/delegation.rs +++ b/compiler/rustc_ast_lowering/src/delegation.rs @@ -58,8 +58,8 @@ use smallvec::SmallVec; use crate::delegation::generics::{GenericsGenerationResult, GenericsGenerationResults}; use crate::errors::{CycleInDelegationSignatureResolution, UnresolvedDelegationCallee}; use crate::{ - AllowReturnTypeNotation, GenericArgsMode, ImplTraitContext, ImplTraitPosition, LoweringContext, - ParamMode, ResolverAstLoweringExt, + AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode, + ResolverAstLoweringExt, }; mod generics; @@ -144,7 +144,7 @@ impl<'hir> LoweringContext<'_, 'hir> { let mut generics = self.uplift_delegation_generics(delegation, sig_id, is_method); - let body_id = self.lower_delegation_body( + let (body_id, call_expr_id) = self.lower_delegation_body( delegation, is_method, param_count, @@ -152,16 +152,23 @@ impl<'hir> LoweringContext<'_, 'hir> { span, ); - let decl = - self.lower_delegation_decl(sig_id, param_count, c_variadic, span, &generics); + let decl = self.lower_delegation_decl( + sig_id, + param_count, + c_variadic, + span, + &generics, + delegation.id, + call_expr_id, + ); let sig = self.lower_delegation_sig(sig_id, decl, span); let ident = self.lower_ident(delegation.ident); let generics = self.arena.alloc(hir::Generics { has_where_clause_predicates: false, - params: self.arena.alloc_from_iter(generics.all_params(span, self)), - predicates: self.arena.alloc_from_iter(generics.all_predicates(span, self)), + params: self.arena.alloc_from_iter(generics.all_params()), + predicates: self.arena.alloc_from_iter(generics.all_predicates()), span, where_clause_span: span, }); @@ -280,6 +287,8 @@ impl<'hir> LoweringContext<'_, 'hir> { c_variadic: bool, span: Span, generics: &GenericsGenerationResults<'hir>, + call_path_node_id: NodeId, + call_expr_id: HirId, ) -> &'hir hir::FnDecl<'hir> { // The last parameter in C variadic functions is skipped in the signature, // like during regular lowering. @@ -297,7 +306,9 @@ impl<'hir> LoweringContext<'_, 'hir> { hir_id: self.next_id(), kind: hir::TyKind::InferDelegation(hir::InferDelegation::Sig( sig_id, - hir::InferDelegationSig::Output(self.arena.alloc(hir::DelegationGenerics { + hir::InferDelegationSig::Output(self.arena.alloc(hir::DelegationInfo { + call_expr_id, + call_path_res: self.get_resolution_id(call_path_node_id), child_args_segment_id: generics.child.args_segment_id, parent_args_segment_id: generics.parent.args_segment_id, self_ty_id: generics.self_ty_id, @@ -400,10 +411,11 @@ impl<'hir> LoweringContext<'_, 'hir> { param_count: usize, generics: &mut GenericsGenerationResults<'hir>, span: Span, - ) -> BodyId { + ) -> (BodyId, HirId) { let block = delegation.body.as_deref(); + let mut call_expr_id = HirId::INVALID; - self.lower_body(|this| { + let block_id = self.lower_body(|this| { let mut parameters: Vec> = Vec::with_capacity(param_count); let mut args: Vec> = Vec::with_capacity(param_count); @@ -440,10 +452,17 @@ impl<'hir> LoweringContext<'_, 'hir> { args.push(this.lower_target_expr(&block)); } - let final_expr = this.finalize_body_lowering(delegation, args, generics, span); + let (final_expr, hir_id) = + this.finalize_body_lowering(delegation, args, generics, span); + + call_expr_id = hir_id; (this.arena.alloc_from_iter(parameters), final_expr) - }) + }); + + debug_assert_ne!(call_expr_id, HirId::INVALID); + + (block_id, call_expr_id) } // FIXME(fn_delegation): Alternatives for target expression lowering: @@ -459,108 +478,59 @@ impl<'hir> LoweringContext<'_, 'hir> { self.mk_expr(hir::ExprKind::Block(block, None), block.span) } - // Generates expression for the resulting body. If possible, `MethodCall` is used - // to allow autoref/autoderef for target expression. For example in: - // - // trait Trait : Sized { - // fn by_value(self) -> i32 { 1 } - // fn by_mut_ref(&mut self) -> i32 { 2 } - // fn by_ref(&self) -> i32 { 3 } - // } - // - // struct NewType(SomeType); - // impl Trait for NewType { - // reuse Trait::* { self.0 } - // } - // - // `self.0` will automatically coerce. fn finalize_body_lowering( &mut self, delegation: &Delegation, args: Vec>, generics: &mut GenericsGenerationResults<'hir>, span: Span, - ) -> hir::Expr<'hir> { - let args = self.arena.alloc_from_iter(args); - - let has_generic_args = - delegation.path.segments.iter().rev().skip(1).any(|segment| segment.args.is_some()); - - let call = if self - .get_resolution_id(delegation.id) - .map(|def_id| self.is_method(def_id, span)) - .unwrap_or_default() - && delegation.qself.is_none() - && !has_generic_args - && !args.is_empty() - { - let ast_segment = delegation.path.segments.last().unwrap(); - let segment = self.lower_path_segment( - delegation.path.span, - ast_segment, - ParamMode::Optional, - GenericArgsMode::Err, - ImplTraitContext::Disallowed(ImplTraitPosition::Path), - None, - ); - - // FIXME(fn_delegation): proper support for parent generics propagation - // in method call scenario. - let segment = self.process_segment(span, &segment, &mut generics.child); - let segment = self.arena.alloc(segment); - - self.arena.alloc(hir::Expr { - hir_id: self.next_id(), - kind: hir::ExprKind::MethodCall(segment, &args[0], &args[1..], span), - span, - }) - } else { - let path = self.lower_qpath( - delegation.id, - &delegation.qself, - &delegation.path, - ParamMode::Optional, - AllowReturnTypeNotation::No, - ImplTraitContext::Disallowed(ImplTraitPosition::Path), - None, - ); - - let new_path = match path { - hir::QPath::Resolved(ty, path) => { - let mut new_path = path.clone(); - let len = new_path.segments.len(); - - new_path.segments = self.arena.alloc_from_iter( - new_path.segments.iter().enumerate().map(|(idx, segment)| { - if idx + 2 == len { - self.process_segment(span, segment, &mut generics.parent) - } else if idx + 1 == len { - self.process_segment(span, segment, &mut generics.child) - } else { - segment.clone() - } - }), - ); - - hir::QPath::Resolved(ty, self.arena.alloc(new_path)) - } - hir::QPath::TypeRelative(ty, segment) => { - let segment = self.process_segment(span, segment, &mut generics.child); - - hir::QPath::TypeRelative(ty, self.arena.alloc(segment)) - } - }; + ) -> (hir::Expr<'hir>, HirId) { + let path = self.lower_qpath( + delegation.id, + &delegation.qself, + &delegation.path, + ParamMode::Optional, + AllowReturnTypeNotation::No, + ImplTraitContext::Disallowed(ImplTraitPosition::Path), + None, + ); + + let new_path = match path { + hir::QPath::Resolved(ty, path) => { + let mut new_path = path.clone(); + let len = new_path.segments.len(); + + new_path.segments = self.arena.alloc_from_iter( + new_path.segments.iter().enumerate().map(|(idx, segment)| { + if idx + 2 == len { + self.process_segment(span, segment, &mut generics.parent) + } else if idx + 1 == len { + self.process_segment(span, segment, &mut generics.child) + } else { + segment.clone() + } + }), + ); - generics.self_ty_id = match new_path { - hir::QPath::Resolved(ty, _) => ty, - hir::QPath::TypeRelative(ty, _) => Some(ty), + hir::QPath::Resolved(ty, self.arena.alloc(new_path)) } - .map(|ty| ty.hir_id); + hir::QPath::TypeRelative(ty, segment) => { + let segment = self.process_segment(span, segment, &mut generics.child); - let callee_path = self.arena.alloc(self.mk_expr(hir::ExprKind::Path(new_path), span)); - self.arena.alloc(self.mk_expr(hir::ExprKind::Call(callee_path, args), span)) + hir::QPath::TypeRelative(ty, self.arena.alloc(segment)) + } }; + generics.self_ty_id = match new_path { + hir::QPath::Resolved(ty, _) => ty, + hir::QPath::TypeRelative(ty, _) => Some(ty), + } + .map(|ty| ty.hir_id); + + let callee_path = self.arena.alloc(self.mk_expr(hir::ExprKind::Path(new_path), span)); + let args = self.arena.alloc_from_iter(args); + let call = self.arena.alloc(self.mk_expr(hir::ExprKind::Call(callee_path, args), span)); + let block = self.arena.alloc(hir::Block { stmts: &[], expr: Some(call), @@ -570,7 +540,7 @@ impl<'hir> LoweringContext<'_, 'hir> { targeted_by_break: false, }); - self.mk_expr(hir::ExprKind::Block(block, None), span) + (self.mk_expr(hir::ExprKind::Block(block, None), span), call.hir_id) } fn process_segment( @@ -581,8 +551,10 @@ impl<'hir> LoweringContext<'_, 'hir> { ) -> hir::PathSegment<'hir> { let details = result.generics.args_propagation_details(); + // Always uplift generic params, because if they are not empty then they + // should be generated in delegation. + let generics = result.generics.into_hir_generics(self, span); let segment = if details.should_propagate { - let generics = result.generics.into_hir_generics(self, span); let args = generics.into_generic_args(self, span); // Needed for better error messages (`trait-impl-wrong-args-count.rs` test). diff --git a/compiler/rustc_ast_lowering/src/delegation/generics.rs b/compiler/rustc_ast_lowering/src/delegation/generics.rs index c2c3bd740e3cf..f8e3528750035 100644 --- a/compiler/rustc_ast_lowering/src/delegation/generics.rs +++ b/compiler/rustc_ast_lowering/src/delegation/generics.rs @@ -171,22 +171,9 @@ impl<'hir> GenericsGenerationResult<'hir> { } impl<'hir> GenericsGenerationResults<'hir> { - pub(super) fn all_params( - &mut self, - span: Span, - ctx: &mut LoweringContext<'_, 'hir>, - ) -> impl Iterator> { - // Now we always call `into_hir_generics` both on child and parent, - // however in future we would not do that, when scenarios like - // method call will be supported (if HIR generics were not obtained - // then it means that we did not propagated them, thus we do not need - // to generate params). - let mut create_params = |result: &mut GenericsGenerationResult<'hir>| { - result.generics.into_hir_generics(ctx, span).hir_generics_or_empty().params - }; - - let parent = create_params(&mut self.parent); - let child = create_params(&mut self.child); + pub(super) fn all_params(&self) -> impl Iterator> { + let parent = self.parent.generics.hir_generics_or_empty().params; + let child = self.child.generics.hir_generics_or_empty().params; // Order generics, first we have parent and child lifetimes, // then parent and child types and consts. @@ -205,24 +192,14 @@ impl<'hir> GenericsGenerationResults<'hir> { /// and `generate_lifetime_predicate` functions) we need to add them to delegation generics. /// Those predicates will not affect resulting predicate inheritance and folding /// in `rustc_hir_analysis`, as we inherit all predicates from delegation signature. - pub(super) fn all_predicates( - &mut self, - span: Span, - ctx: &mut LoweringContext<'_, 'hir>, - ) -> impl Iterator> { - // Now we always call `into_hir_generics` both on child and parent, - // however in future we would not do that, when scenarios like - // method call will be supported (if HIR generics were not obtained - // then it means that we did not propagated them, thus we do not need - // to generate predicates). - let mut create_predicates = |result: &mut GenericsGenerationResult<'hir>| { - result.generics.into_hir_generics(ctx, span).hir_generics_or_empty().predicates - }; - - let parent = create_predicates(&mut self.parent); - let child = create_predicates(&mut self.child); - - parent.into_iter().chain(child).copied() + pub(super) fn all_predicates(&self) -> impl Iterator> { + self.parent + .generics + .hir_generics_or_empty() + .predicates + .into_iter() + .chain(self.child.generics.hir_generics_or_empty().predicates) + .copied() } } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 0569c1b986d1a..59d1b4b5576ee 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -3864,9 +3864,10 @@ pub enum OpaqueTyOrigin { }, } -// Ids of parent (or child) path segment that contains user-specified args #[derive(Debug, Clone, Copy, PartialEq, Eq, StableHash)] -pub struct DelegationGenerics { +pub struct DelegationInfo { + pub call_expr_id: HirId, + pub call_path_res: Option, pub parent_args_segment_id: Option, pub child_args_segment_id: Option, pub self_ty_id: Option, @@ -3876,8 +3877,8 @@ pub struct DelegationGenerics { #[derive(Debug, Clone, Copy, PartialEq, Eq, StableHash)] pub enum InferDelegationSig<'hir> { Input(usize), - // Place generics info here, as we always specify output type for delegations. - Output(&'hir DelegationGenerics), + // Place delegation info here, as we always specify output type for delegations. + Output(&'hir DelegationInfo), } #[derive(Debug, Clone, Copy, PartialEq, Eq, StableHash)] @@ -4164,7 +4165,7 @@ impl<'hir> FnDecl<'hir> { None } - pub fn opt_delegation_generics(&self) -> Option<&'hir DelegationGenerics> { + pub fn opt_delegation_info(&self) -> Option<&'hir DelegationInfo> { if let FnRetTy::Return(ty) = self.output && let TyKind::InferDelegation(InferDelegation::Sig(_, kind)) = ty.kind && let InferDelegationSig::Output(generics) = kind diff --git a/compiler/rustc_hir_analysis/src/delegation.rs b/compiler/rustc_hir_analysis/src/delegation.rs index 2d6d5a5d81f9a..f67181a4655b9 100644 --- a/compiler/rustc_hir_analysis/src/delegation.rs +++ b/compiler/rustc_hir_analysis/src/delegation.rs @@ -7,7 +7,7 @@ use std::debug_assert_matches; use rustc_data_structures::fx::FxHashMap; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, LocalDefId}; -use rustc_hir::{DelegationGenerics, HirId, PathSegment}; +use rustc_hir::{DelegationInfo, HirId, PathSegment}; use rustc_middle::ty::{ self, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt, }; @@ -71,13 +71,17 @@ enum SelfPositionKind { None, } -fn get_delegation_generics(tcx: TyCtxt<'_>, delegation_id: LocalDefId) -> &DelegationGenerics { +pub fn opt_get_delegation_info( + tcx: TyCtxt<'_>, + delegation_id: LocalDefId, +) -> Option<&DelegationInfo> { tcx.hir_node(tcx.local_def_id_to_hir_id(delegation_id)) .fn_sig() - .expect("processing delegation") - .decl - .opt_delegation_generics() - .expect("processing delegation") + .and_then(|sig| sig.decl.opt_delegation_info()) +} + +fn get_delegation_info(tcx: TyCtxt<'_>, delegation_id: LocalDefId) -> &DelegationInfo { + opt_get_delegation_info(tcx, delegation_id).expect("processing delegation") } fn create_self_position_kind( @@ -92,7 +96,7 @@ fn create_self_position_kind( | (FnKind::AssocTrait, FnKind::Free) => SelfPositionKind::Zero, (FnKind::Free, FnKind::AssocTrait) => { - let propagate_self_ty = get_delegation_generics(tcx, delegation_id).propagate_self_ty; + let propagate_self_ty = get_delegation_info(tcx, delegation_id).propagate_self_ty; SelfPositionKind::AfterLifetimes(propagate_self_ty) } @@ -278,7 +282,7 @@ fn get_parent_and_inheritance_kind<'tcx>( } fn get_delegation_self_ty_or_err(tcx: TyCtxt<'_>, delegation_id: LocalDefId) -> Ty<'_> { - get_delegation_generics(tcx, delegation_id) + get_delegation_info(tcx, delegation_id) .self_ty_id .map(|id| { let ctx = ItemCtxt::new(tcx, delegation_id); @@ -640,7 +644,7 @@ fn get_delegation_user_specified_args<'tcx>( tcx: TyCtxt<'tcx>, delegation_id: LocalDefId, ) -> (&'tcx [ty::GenericArg<'tcx>], &'tcx [ty::GenericArg<'tcx>]) { - let info = get_delegation_generics(tcx, delegation_id); + let info = get_delegation_info(tcx, delegation_id); let get_segment = |hir_id: HirId| -> Option<(&'tcx PathSegment<'tcx>, DefId)> { let segment = tcx.hir_node(hir_id).expect_path_segment(); diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index 9cadaef8f886b..1e9bc80749881 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -73,7 +73,7 @@ mod check_unused; mod coherence; mod collect; mod constrained_generic_params; -mod delegation; +pub mod delegation; pub mod errors; pub mod hir_ty_lowering; pub mod hir_wf_check; diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs index e15c9fe661641..d51a0bf2c3ef4 100644 --- a/compiler/rustc_hir_typeck/src/callee.rs +++ b/compiler/rustc_hir_typeck/src/callee.rs @@ -7,15 +7,16 @@ use rustc_hir::def::{self, CtorKind, Namespace, Res}; use rustc_hir::def_id::DefId; use rustc_hir::{self as hir, HirId, LangItem, find_attr}; use rustc_hir_analysis::autoderef::Autoderef; +use rustc_hir_analysis::delegation::opt_get_delegation_info; use rustc_infer::infer::BoundRegionConversionTime; use rustc_infer::traits::{Obligation, ObligationCause, ObligationCauseCode}; use rustc_middle::ty::adjustment::{ Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability, }; -use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt, TypeVisitableExt, Unnormalized}; +use rustc_middle::ty::{self, FnSig, GenericArgsRef, Ty, TyCtxt, TypeVisitableExt, Unnormalized}; use rustc_middle::{bug, span_bug}; use rustc_span::def_id::LocalDefId; -use rustc_span::{Span, sym}; +use rustc_span::{Ident, Span, sym}; use rustc_target::spec::{AbiMap, AbiMapping}; use rustc_trait_selection::error_reporting::traits::DefIdOrName; use rustc_trait_selection::infer::InferCtxtExt as _; @@ -27,6 +28,8 @@ use super::method::probe::ProbeScope; use super::{Expectation, FnCtxt, TupleArgumentsFlag}; use crate::errors; use crate::method::TreatNotYetDefinedOpaques; +use crate::method::confirm::ConfirmContext; +use crate::method::probe::{IsSuggestion, Mode}; /// Checks that it is legal to call methods of the trait corresponding /// to `trait_id` (this only cares about the trait, not the specific @@ -591,16 +594,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); let fn_sig = self.normalize(call_expr.span, Unnormalized::new_wip(fn_sig)); - self.check_argument_types( - call_expr.span, - call_expr, - fn_sig.inputs(), - fn_sig.output(), - expected, - arg_exprs, - fn_sig.c_variadic(), - TupleArgumentsFlag::DontTupleArguments, - def_id, + self.check_argument_types_maybe_method_like( + &fn_sig, call_expr, arg_exprs, expected, def_id, ); if fn_sig.abi() == rustc_abi::ExternAbi::RustCall { @@ -620,6 +615,110 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn_sig.output() } + /// Performs arguments check with an additional routine of adjusting the first argument, + /// so it corresponds to the first parameter of the function. We reuse adjustments + /// that are obtained from `probe_for_name`, where the first argument pretends to be + /// a receiver like in a method call. At this point this routine is used for delegations, + /// as from this moment we always generate a call (earlier method calls were generated), + /// so we can both propagate parent generics and get benefits from adjustments from method call. + fn check_argument_types_maybe_method_like( + &self, + fn_sig: &FnSig<'tcx>, + call_expr: &'tcx hir::Expr<'tcx>, + arg_exprs: &'tcx [hir::Expr<'tcx>], + expected: Expectation<'tcx>, + def_id: Option, + ) { + let do_check = || { + self.check_argument_types( + call_expr.span, + call_expr, + fn_sig.inputs(), + fn_sig.output(), + expected, + arg_exprs, + fn_sig.c_variadic(), + TupleArgumentsFlag::DontTupleArguments, + def_id, + ); + }; + + let Some(scope) = self.get_scope_for_method_call_adjustments(call_expr, arg_exprs) else { + return do_check(); + }; + + let first_expr = &arg_exprs[0]; + let first_arg_type = self.check_expr(first_expr); + + // Reuse method probing that is used during method call, as all this code pretends that + // we generated method call. + let pick = self.probe_for_name( + Mode::MethodCall, + Ident::dummy(), + None, + IsSuggestion(false), + first_arg_type, + call_expr.hir_id, + scope, + ); + + let Ok(ref pick) = pick else { return do_check() }; + + // Fool typechecker by placing an adjusted type of the first arg to avoid errors. + // We already wrote type of `first_expr` during `self.check_expr(first_expr)` above. + let first_arg_type = self + .typeck_results + .borrow_mut() + .node_types_mut() + .insert(first_expr.hir_id, pick.self_ty) + .expect("must be set"); + + do_check(); + + let mut results = self.typeck_results.borrow_mut(); + + // Remove any added adjustments for `first_expr` during `do_check` and replace them with ours. + let mut adjustments = results.adjustments_mut(); + let adjustments = adjustments.entry(first_expr.hir_id).or_default(); + + let mut ctx = ConfirmContext::new(self, first_expr.span, first_expr, first_expr); + *adjustments = ctx.create_ty_adjustments_from_pick(first_arg_type, pick).1; + + // Restore original first provided arg type. + results.node_types_mut().insert(first_expr.hir_id, first_arg_type); + } + + /// Gets scope for method-call like adjustments for the first argument of the call. + /// Now only delegations are processed this way. + fn get_scope_for_method_call_adjustments( + &self, + call_expr: &'tcx hir::Expr<'tcx>, + arg_exprs: &'tcx [hir::Expr<'tcx>], + ) -> Option { + // Check that we are inside delegation and processing its call. First, we check that + // the parent of call expr. is delegation and then make sure that it is compiler-generated + // by comparing their hir ids (otherwise we will encounter errors in nested delegations, + // see tests\ui\delegation\impl-reuse-pass.rs:237). + let parent_def = self.tcx.hir_get_parent_item(call_expr.hir_id).def_id; + let Some(info) = opt_get_delegation_info(self.tcx, parent_def) else { return None }; + + if call_expr.hir_id != info.call_expr_id { + return None; + }; + + let Some(path_res_id) = info.call_path_res else { return None }; + + // Check that delegation has first provided arg and that the call path + // resolves to a trait method (inherent methods are not yet supported). + if arg_exprs.is_empty() + || !self.tcx.opt_associated_item(path_res_id).is_some_and(|i| i.is_method()) + { + return None; + } + + Some(ProbeScope::Single(path_res_id)) + } + /// Attempts to reinterpret `method(rcvr, args...)` as `rcvr.method(args...)` /// and suggesting the fix if the method probe is successful. fn suggest_call_as_method( diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 415630dab38b3..d62ba9cf804eb 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -13,6 +13,7 @@ use rustc_hir::def_id::DefId; use rustc_hir::intravisit::Visitor; use rustc_hir::{Expr, ExprKind, FnRetTy, HirId, LangItem, Node, QPath, is_range_literal}; use rustc_hir_analysis::check::potentially_plural_count; +use rustc_hir_analysis::delegation::opt_get_delegation_info; use rustc_hir_analysis::hir_ty_lowering::{HirTyLowerer, ResolvedStructPath}; use rustc_index::IndexVec; use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes, InferOk, TypeTrace}; @@ -329,7 +330,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let demand_compatible = |idx| { let formal_input_ty: Ty<'tcx> = formal_input_tys[idx]; let expected_input_ty: Ty<'tcx> = expected_input_tys[idx]; - let provided_arg = &provided_args[idx]; + let provided_arg: &hir::Expr<'tcx> = &provided_args[idx]; debug!("checking argument {}: {:?} = {:?}", idx, provided_arg, formal_input_ty); @@ -338,7 +339,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // 1. Unify the provided argument with the expected type let expectation = Expectation::rvalue_hint(self, expected_input_ty); - let checked_ty = self.check_expr_with_expectation(provided_arg, expectation); + // If we are processing first arg of delegation then we could have adjusted it + // in `execute_delegation_aware_arguments_check`. + let checked_ty = opt_get_delegation_info(self.tcx, self.body_id) + .and_then(|_| self.typeck_results.borrow().node_type_opt(provided_arg.hir_id)) + .unwrap_or_else(|| self.check_expr_with_expectation(provided_arg, expectation)); // 2. Coerce to the most detailed type that could be coerced // to, which is `expected_ty` if `rvalue_hint` returns an diff --git a/compiler/rustc_hir_typeck/src/method/confirm.rs b/compiler/rustc_hir_typeck/src/method/confirm.rs index 0c83c1948d6f2..4ef6de12f7623 100644 --- a/compiler/rustc_hir_typeck/src/method/confirm.rs +++ b/compiler/rustc_hir_typeck/src/method/confirm.rs @@ -34,7 +34,7 @@ use super::{MethodCallee, probe}; use crate::errors::{SupertraitItemShadowee, SupertraitItemShadower, SupertraitItemShadowing}; use crate::{FnCtxt, callee}; -struct ConfirmContext<'a, 'tcx> { +pub(crate) struct ConfirmContext<'a, 'tcx> { fcx: &'a FnCtxt<'a, 'tcx>, span: Span, self_expr: &'tcx hir::Expr<'tcx>, @@ -90,7 +90,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { - fn new( + pub(crate) fn new( fcx: &'a FnCtxt<'a, 'tcx>, span: Span, self_expr: &'tcx hir::Expr<'tcx>, @@ -178,14 +178,32 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { ) -> Ty<'tcx> { // Commit the autoderefs by calling `autoderef` again, but this // time writing the results into the various typeck results. + let (target, adjustments) = self.create_ty_adjustments_from_pick(unadjusted_self_ty, pick); + + // Write out the final adjustments. + if !self.skip_record_for_diagnostics { + self.apply_adjustments(self.self_expr, adjustments); + } + + target + } + + pub(crate) fn create_ty_adjustments_from_pick( + &mut self, + unadjusted_self_ty: Ty<'tcx>, + pick: &probe::Pick<'tcx>, + ) -> (Ty<'tcx>, Vec>) { let mut autoderef = self.autoderef(self.call_expr.span, unadjusted_self_ty); let Some((mut target, n)) = autoderef.nth(pick.autoderefs) else { - return Ty::new_error_with_message( + let error_ty = Ty::new_error_with_message( self.tcx, DUMMY_SP, format!("failed autoderef {}", pick.autoderefs), ); + + return (error_ty, vec![]); }; + assert_eq!(n, pick.autoderefs); let mut adjustments = self.adjust_steps(&autoderef); @@ -260,12 +278,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { self.register_predicates(autoderef.into_obligations()); - // Write out the final adjustments. - if !self.skip_record_for_diagnostics { - self.apply_adjustments(self.self_expr, adjustments); - } - - target + (target, adjustments) } /// Returns a set of generic parameters for the method *receiver* where all type and region diff --git a/compiler/rustc_hir_typeck/src/method/mod.rs b/compiler/rustc_hir_typeck/src/method/mod.rs index 49126ff0e964c..2ebff26ff9822 100644 --- a/compiler/rustc_hir_typeck/src/method/mod.rs +++ b/compiler/rustc_hir_typeck/src/method/mod.rs @@ -2,7 +2,7 @@ //! //! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir-typeck/method-lookup.html -mod confirm; +pub(crate) mod confirm; mod prelude_edition_lints; pub(crate) mod probe; mod suggest; diff --git a/tests/pretty/delegation-inline-attribute.pp b/tests/pretty/delegation-inline-attribute.pp index 125ed1c298262..fc409aa636d5c 100644 --- a/tests/pretty/delegation-inline-attribute.pp +++ b/tests/pretty/delegation-inline-attribute.pp @@ -38,33 +38,34 @@ fn foo(self: _) -> _ { - { - // Check that #[inline(hint)] is added to foo0 reuse inside another reuse + Trait::foo( + // Check that #[inline(hint)] is added to foo0 reuse inside another reuse + + // Check that #[inline(hint)] is added when other attributes present in inner reuse + + // Check that #[inline(never)] is preserved in inner reuse + + // Check that #[inline(always)] is preserved in inner reuse + + // Check that #[inline(never)] is preserved when there are other attributes in inner reuse + { #[attr = Inline(Hint)] fn foo0(arg0: _) -> _ { to_reuse::foo(self + 1) } - - // Check that #[inline(hint)] is added when other attributes present in inner reuse #[attr = Cold] #[attr = MustUse] #[attr = Deprecated {deprecation: Deprecation {since: Unspecified}}] #[attr = Inline(Hint)] fn foo1(arg0: _) -> _ { to_reuse::foo(self / 2) } - - // Check that #[inline(never)] is preserved in inner reuse #[attr = Inline(Never)] fn foo2(arg0: _) -> _ { to_reuse::foo(self / 2) } - - // Check that #[inline(always)] is preserved in inner reuse #[attr = Inline(Always)] fn foo3(arg0: _) -> _ { to_reuse::foo(self / 2) } - - // Check that #[inline(never)] is preserved when there are other attributes in inner reuse #[attr = Cold] #[attr = MustUse] #[attr = Inline(Never)] #[attr = Deprecated {deprecation: Deprecation {since: Unspecified}}] fn foo4(arg0: _) -> _ { to_reuse::foo(self / 2) } - }.foo() + }) } // Check that #[inline(hint)] is added when there are other attributes present in trait reuse @@ -72,22 +73,22 @@ #[attr = MustUse] #[attr = Deprecated {deprecation: Deprecation {since: Unspecified}}] #[attr = Inline(Hint)] - fn foo1(self: _) -> _ { self.0.foo1() } + fn foo1(self: _) -> _ { Trait::foo1(self.0) } // Check that #[inline(never)] is preserved in trait reuse #[attr = Inline(Never)] - fn foo2(self: _) -> _ { self.0.foo2() } + fn foo2(self: _) -> _ { Trait::foo2(self.0) } // Check that #[inline(always)] is preserved in trait reuse #[attr = Inline(Always)] - fn foo3(self: _) -> _ { self.0.foo3() } + fn foo3(self: _) -> _ { Trait::foo3(self.0) } // Check that #[inline(never)] is preserved when there are other attributes in trait reuse #[attr = Cold] #[attr = MustUse] #[attr = Inline(Never)] #[attr = Deprecated {deprecation: Deprecation {since: Unspecified}}] - fn foo4(self: _) -> _ { self.0.foo4() } + fn foo4(self: _) -> _ { Trait::foo4(self.0) } } fn main() { } diff --git a/tests/pretty/delegation-self-rename.pp b/tests/pretty/delegation-self-rename.pp index 59a07315185c7..7f7afc403607b 100644 --- a/tests/pretty/delegation-self-rename.pp +++ b/tests/pretty/delegation-self-rename.pp @@ -19,7 +19,7 @@ #[attr = Inline(Hint)] fn foo<'a, Self, A, const B: _, const B2: _, T, U, impl FnOnce() -> usize>(self: _, arg1: _) -> _ where - 'a:'a { self.foo::(arg1) } + 'a:'a { Trait::<'a, A, B>::foo::(self, arg1) } #[attr = Inline(Hint)] fn bar usize>(self: _, arg1: _) -> _ { Trait::<'static, (), true>::foo::(self, arg1) } diff --git a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr index ab0c6d66e9c51..9537e45f3b8f0 100644 --- a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr +++ b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr @@ -65,13 +65,20 @@ LL | impl Trait for Z { | ^^^^^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:21:53 + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:21:44 | LL | reuse ::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `InvariantRef<'_, ()>` + | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&u8`, found `&InvariantRef<'_, ()>` + | | + | arguments to this function are incorrect | - = note: expected type `u8` - found struct `InvariantRef<'_, ()>` + = note: expected reference `&u8` + found reference `&InvariantRef<'_, ()>` +note: method defined here + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:13:8 + | +LL | fn foo(&self) -> u8 { 0 } + | ^^^ ----- error[E0277]: the trait bound `u8: Trait` is not satisfied --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:21:12 @@ -87,14 +94,20 @@ LL | impl Trait for Z { = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0308]: mismatched types - --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:21:53 + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:21:44 | LL | reuse ::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `InvariantRef<'_, ()>` + | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&u8`, found `&InvariantRef<'_, ()>` + | | + | arguments to this function are incorrect | - = note: expected type `u8` - found struct `InvariantRef<'_, ()>` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + = note: expected reference `&u8` + found reference `&InvariantRef<'_, ()>` +note: method defined here + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:14:8 + | +LL | fn bar(&self) -> u8 { 1 } + | ^^^ ----- error[E0277]: the trait bound `u8: Trait` is not satisfied --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:21:12 @@ -110,14 +123,20 @@ LL | impl Trait for Z { = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0308]: mismatched types - --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:21:53 + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:21:44 | LL | reuse ::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `InvariantRef<'_, ()>` + | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&u8`, found `&InvariantRef<'_, ()>` + | | + | arguments to this function are incorrect | - = note: expected type `u8` - found struct `InvariantRef<'_, ()>` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + = note: expected reference `&u8` + found reference `&InvariantRef<'_, ()>` +note: method defined here + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:15:8 + | +LL | fn meh(&self) -> u8 { 2 } + | ^^^ ----- error: aborting due to 10 previous errors diff --git a/tests/ui/delegation/generics/generics-aux-pass.rs b/tests/ui/delegation/generics/generics-aux-pass.rs index 06f5c6d4d212e..f5d49c03a6137 100644 --- a/tests/ui/delegation/generics/generics-aux-pass.rs +++ b/tests/ui/delegation/generics/generics-aux-pass.rs @@ -16,20 +16,17 @@ impl generics::Trait<'static, i32, 1> for X {} impl X { reuse generics::foo as bar; - reuse generics::Trait::foo as trait_foo; reuse generics::foo::<'static, 'static, i32, i32, 1> as bar1; reuse generics::Trait::<'static, i32, 1>::foo::<'static, i32, false> as trait_foo1; } trait LocalTrait { - fn get() -> u8 { 123 } fn get_self(&self) -> u8 { 123 } reuse generics::foo as bar; reuse generics::foo::<'static, 'static, i32, i32, 1> as bar1; - reuse generics::Trait::foo as trait_foo { Self::get() } reuse generics::Trait::<'static, i32, 1>::foo::<'static, i32, false> as trait_foo1 { Self::get_self(&self) } @@ -50,13 +47,11 @@ fn main() { X::bar::(); X::bar::<'static, 'static, i32, i32, 1>(); X::bar1(); - x.trait_foo::<'static, 'static, i32, 1, String, true>(); x.trait_foo1(); ::bar::(); ::bar::<'static, 'static, i32, i32, 1>(); ::bar1(); - 1usize.trait_foo::<'static, 'static, i32, 1, String, true>(); 1usize.trait_foo1(); } diff --git a/tests/ui/delegation/generics/impl-to-trait-method.rs b/tests/ui/delegation/generics/impl-to-trait-method.rs index 102e905068e2a..88d6e4fdaabef 100644 --- a/tests/ui/delegation/generics/impl-to-trait-method.rs +++ b/tests/ui/delegation/generics/impl-to-trait-method.rs @@ -36,7 +36,6 @@ mod unconstrained_parameter { struct S(F); impl S { reuse Trait::foo { &self.0 } - //~^ ERROR type annotations needed } } diff --git a/tests/ui/delegation/generics/impl-to-trait-method.stderr b/tests/ui/delegation/generics/impl-to-trait-method.stderr index 114ebf48cca06..34259d49a1bd9 100644 --- a/tests/ui/delegation/generics/impl-to-trait-method.stderr +++ b/tests/ui/delegation/generics/impl-to-trait-method.stderr @@ -46,13 +46,6 @@ LL | fn foo(&self) LL | Self: Trait0, | ^^^^^^ required by this bound in `Trait1::foo` -error[E0282]: type annotations needed - --> $DIR/impl-to-trait-method.rs:38:22 - | -LL | reuse Trait::foo { &self.0 } - | ^^^ cannot infer type for type parameter `T` declared on the trait `Trait` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0277, E0282. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/delegation/self-coercion-errors.rs b/tests/ui/delegation/self-coercion-errors.rs new file mode 100644 index 0000000000000..6c8356bd7495b --- /dev/null +++ b/tests/ui/delegation/self-coercion-errors.rs @@ -0,0 +1,234 @@ +// Tests below represent situations when type of the first argument can not be adjusted +// to the type of first parameter (i.e., Rc -> &mut T). + +#![feature(fn_delegation)] + +use std::sync::Arc; +use std::pin::Pin; +use std::rc::Rc; + +trait Trait: Sized { + fn by_value(self) -> i32 { 1 } + fn by_mut_ref(&mut self) -> i32 { 2 } + fn by_ref(&self) -> i32 { 3 } + fn r#box(self: Box) -> i32 { 4 } + fn arc(self: Arc) -> i32 { 5 } + fn rc(self: Rc) -> i32 { 6 } + fn pin_box(self: Pin>) -> i32 { 7 } + fn pin_rc(self: Pin>) -> i32 { 8 } + fn pin_arc(self: Pin>) -> i32 { 9 } + fn box_box(self: Box>) -> i32 { 10 } +} + +struct F; +impl Trait for F {} + +struct S(F); + +fn foo() -> F { + F +} + +impl S { + reuse Trait::{by_value, by_mut_ref, by_ref} { + println!("123"); + let x = &self.0; + foo() + } +} + +struct S1(F); + +impl S1 { + reuse Trait::{by_value, by_mut_ref, by_ref} { + //~^ ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: the trait bound `fn() -> F {foo}: Trait` is not satisfied + println!("123"); + let x = &self.0; + foo + } +} + +struct S2(F); + +impl S2 { + reuse Trait::{by_value, by_mut_ref, by_ref} { + println!("123"); + let x = &self.0; + let x = foo(); + + x + } +} + +struct S3(F); + +impl S3 { + reuse Trait::{by_value, by_mut_ref, by_ref} { + println!("123"); + let x = &self.0; + let x = foo(); + + &mut x + //~^ ERROR: cannot borrow `x` as mutable, as it is not declared as mutable + //~| ERROR: cannot borrow `x` as mutable, as it is not declared as mutable + //~| ERROR: cannot borrow `x` as mutable, as it is not declared as mutable + //~| ERROR: cannot move out of a mutable reference + } +} + +struct X(F); + +impl X { + reuse Trait::* { &mut self.0 } + //~^ ERROR: cannot borrow `self.0` as mutable, as it is behind a `&` reference + //~| ERROR: cannot borrow `self.0` as mutable, as `self` is not declared as mutable + //~| ERROR: cannot move out of a mutable reference + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types +} + +struct X1(F); + +impl X1 { + reuse Trait::* { &self.0 } + //~^ ERROR: cannot borrow data in a `&` reference as mutable + //~| ERROR: cannot move out of a shared reference + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types +} + +struct X2(F); + +impl X2 { + reuse Trait::* { &&&&self.0 } + //~^ ERROR: cannot move out of a shared reference + //~| ERROR: cannot borrow data in a `&` reference as mutable + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types +} + +struct X3(Box); + +impl X3 { + reuse Trait::* { self.0.as_ref() } + //~^ ERROR: cannot borrow data in a `&` reference as mutable + //~| ERROR: cannot move out of a shared reference + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types +} + +struct X4(F); + +impl X4 { + reuse Trait::* { &mut &mut &mut self.0 } + //~^ ERROR: cannot move out of a mutable reference + //~| ERROR: cannot borrow `self.0` as mutable, as `self` is not declared as mutable + //~| ERROR: cannot borrow `self.0` as mutable, as it is behind a `&` reference + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types +} + +struct X5(F); + +impl X5 { + reuse Trait::* { &&mut self.0 } + //~^ ERROR: cannot borrow `self.0` as mutable, as it is behind a `&` reference + //~| ERROR: cannot borrow data in a `&` reference as mutable [E0596] + //~| ERROR: cannot borrow `self.0` as mutable, as `self` is not declared as mutable + //~| ERROR: cannot move out of a shared reference + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types +} + +struct X6(Box); + +impl X6 { + reuse Trait::* { self.0 } + //~^ ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types +} + +struct X7(Box>>); + +impl X7 { + reuse Trait::* { self.0 } + //~^ ERROR: cannot borrow data in an `Arc` as mutable + //~| ERROR: cannot move out of an `Arc` + //~| ERROR: cannot move out of an `Arc` + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types +} + +struct X8(Pin>); + +impl X8 { + reuse Trait::* { self.0 } + //~^ ERROR: cannot move out of dereference of `Pin>` + //~| ERROR: cannot borrow data in dereference of `Pin>` as mutable + //~| ERROR: cannot move out of dereference of `Pin>` + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types +} + +struct OtherStruct; +struct X9(OtherStruct); + +impl X9 { + reuse Trait::* { self.0 } + //~^ ERROR: the trait bound `OtherStruct: Trait` is not satisfied + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types +} + +fn main() {} diff --git a/tests/ui/delegation/self-coercion-errors.stderr b/tests/ui/delegation/self-coercion-errors.stderr new file mode 100644 index 0000000000000..89308b15d2d84 --- /dev/null +++ b/tests/ui/delegation/self-coercion-errors.stderr @@ -0,0 +1,1916 @@ +error[E0277]: the trait bound `fn() -> F {foo}: Trait` is not satisfied + --> $DIR/self-coercion-errors.rs:43:49 + | +LL | reuse Trait::{by_value, by_mut_ref, by_ref} { + | ___________________--------______________________^ + | | | + | | required by a bound introduced by this call +... | +LL | | foo + | | --- this tail expression is of type `fn() -> F {foo}` +LL | | } + | |_____^ the trait `Trait` is not implemented for fn item `fn() -> F {foo}` + | +help: use parentheses to call this function + | +LL | }() + | ++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:43:49 + | +LL | reuse Trait::{by_value, by_mut_ref, by_ref} { + | _____________________________----------__________^ + | | | + | | arguments to this function are incorrect +... | +LL | | foo +LL | | } + | |_____^ expected `&mut _`, found fn item + | + = note: expected mutable reference `&mut _` + found fn item `fn() -> F {foo}` +note: method defined here + --> $DIR/self-coercion-errors.rs:12:8 + | +LL | fn by_mut_ref(&mut self) -> i32 { 2 } + | ^^^^^^^^^^ --------- +help: consider mutably borrowing here + | +LL | &mut foo + | ++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:43:49 + | +LL | reuse Trait::{by_value, by_mut_ref, by_ref} { + | _________________________________________------__^ + | | | + | | arguments to this function are incorrect +... | +LL | | foo +LL | | } + | |_____^ expected `&_`, found fn item + | + = note: expected reference `&_` + found fn item `fn() -> F {foo}` +note: method defined here + --> $DIR/self-coercion-errors.rs:13:8 + | +LL | fn by_ref(&self) -> i32 { 3 } + | ^^^^^^ ----- +help: consider borrowing here + | +LL | &foo + | + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:84:22 + | +LL | reuse Trait::* { &mut self.0 } + | - ^^^^^^^^^^^ expected `Box<_>`, found `&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box<_>` + found mutable reference `&mut F` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +note: method defined here + --> $DIR/self-coercion-errors.rs:14:8 + | +LL | fn r#box(self: Box) -> i32 { 4 } + | ^^^^^ ---- +help: store this in the heap by calling `Box::new` + | +LL | reuse Trait::* { Box::new(&mut self.0) } + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:84:22 + | +LL | reuse Trait::* { &mut self.0 } + | - ^^^^^^^^^^^ expected `Arc<_>`, found `&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Arc<_>` + found mutable reference `&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:15:8 + | +LL | fn arc(self: Arc) -> i32 { 5 } + | ^^^ ---- +help: call `Into::into` on this expression to convert `&mut F` into `Arc<_>` + | +LL | reuse Trait::* { (&mut self.0).into() } + | + ++++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:84:22 + | +LL | reuse Trait::* { &mut self.0 } + | - ^^^^^^^^^^^ expected `Rc<_>`, found `&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Rc<_>` + found mutable reference `&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:16:8 + | +LL | fn rc(self: Rc) -> i32 { 6 } + | ^^ ---- +help: call `Into::into` on this expression to convert `&mut F` into `Rc<_>` + | +LL | reuse Trait::* { (&mut self.0).into() } + | + ++++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:84:22 + | +LL | reuse Trait::* { &mut self.0 } + | - ^^^^^^^^^^^ expected `Pin>`, found `&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found mutable reference `&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:17:8 + | +LL | fn pin_box(self: Pin>) -> i32 { 7 } + | ^^^^^^^ ---- +help: you need to pin and box this expression + | +LL | reuse Trait::* { Box::pin(&mut self.0) } + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:84:22 + | +LL | reuse Trait::* { &mut self.0 } + | - ^^^^^^^^^^^ expected `Pin>`, found `&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found mutable reference `&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:18:8 + | +LL | fn pin_rc(self: Pin>) -> i32 { 8 } + | ^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:84:22 + | +LL | reuse Trait::* { &mut self.0 } + | - ^^^^^^^^^^^ expected `Pin>`, found `&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found mutable reference `&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:19:8 + | +LL | fn pin_arc(self: Pin>) -> i32 { 9 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:84:22 + | +LL | reuse Trait::* { &mut self.0 } + | - ^^^^^^^^^^^ expected `Box>`, found `&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box>` + found mutable reference `&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:20:8 + | +LL | fn box_box(self: Box>) -> i32 { 10 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:100:22 + | +LL | reuse Trait::* { &self.0 } + | - ^^^^^^^ expected `Box<_>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box<_>` + found reference `&F` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +note: method defined here + --> $DIR/self-coercion-errors.rs:14:8 + | +LL | fn r#box(self: Box) -> i32 { 4 } + | ^^^^^ ---- +help: store this in the heap by calling `Box::new` + | +LL | reuse Trait::* { Box::new(&self.0) } + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:100:22 + | +LL | reuse Trait::* { &self.0 } + | - ^^^^^^^ expected `Arc<_>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Arc<_>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:15:8 + | +LL | fn arc(self: Arc) -> i32 { 5 } + | ^^^ ---- +help: call `Into::into` on this expression to convert `&F` into `Arc<_>` + | +LL | reuse Trait::* { (&self.0).into() } + | + ++++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:100:22 + | +LL | reuse Trait::* { &self.0 } + | - ^^^^^^^ expected `Rc<_>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Rc<_>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:16:8 + | +LL | fn rc(self: Rc) -> i32 { 6 } + | ^^ ---- +help: call `Into::into` on this expression to convert `&F` into `Rc<_>` + | +LL | reuse Trait::* { (&self.0).into() } + | + ++++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:100:22 + | +LL | reuse Trait::* { &self.0 } + | - ^^^^^^^ expected `Pin>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:17:8 + | +LL | fn pin_box(self: Pin>) -> i32 { 7 } + | ^^^^^^^ ---- +help: you need to pin and box this expression + | +LL | reuse Trait::* { Box::pin(&self.0) } + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:100:22 + | +LL | reuse Trait::* { &self.0 } + | - ^^^^^^^ expected `Pin>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:18:8 + | +LL | fn pin_rc(self: Pin>) -> i32 { 8 } + | ^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:100:22 + | +LL | reuse Trait::* { &self.0 } + | - ^^^^^^^ expected `Pin>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:19:8 + | +LL | fn pin_arc(self: Pin>) -> i32 { 9 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:100:22 + | +LL | reuse Trait::* { &self.0 } + | - ^^^^^^^ expected `Box>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:20:8 + | +LL | fn box_box(self: Box>) -> i32 { 10 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:115:22 + | +LL | reuse Trait::* { &&&&self.0 } + | - ^^^^^^^^^^ expected `Box<_>`, found `&&&&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box<_>` + found reference `&&&&F` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +note: method defined here + --> $DIR/self-coercion-errors.rs:14:8 + | +LL | fn r#box(self: Box) -> i32 { 4 } + | ^^^^^ ---- +help: store this in the heap by calling `Box::new` + | +LL | reuse Trait::* { Box::new(&&&&self.0) } + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:115:22 + | +LL | reuse Trait::* { &&&&self.0 } + | - ^^^^^^^^^^ expected `Arc<_>`, found `&&&&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Arc<_>` + found reference `&&&&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:15:8 + | +LL | fn arc(self: Arc) -> i32 { 5 } + | ^^^ ---- +help: call `Into::into` on this expression to convert `&&&&F` into `Arc<_>` + | +LL | reuse Trait::* { (&&&&self.0).into() } + | + ++++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:115:22 + | +LL | reuse Trait::* { &&&&self.0 } + | - ^^^^^^^^^^ expected `Rc<_>`, found `&&&&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Rc<_>` + found reference `&&&&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:16:8 + | +LL | fn rc(self: Rc) -> i32 { 6 } + | ^^ ---- +help: call `Into::into` on this expression to convert `&&&&F` into `Rc<_>` + | +LL | reuse Trait::* { (&&&&self.0).into() } + | + ++++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:115:22 + | +LL | reuse Trait::* { &&&&self.0 } + | - ^^^^^^^^^^ expected `Pin>`, found `&&&&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&&&&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:17:8 + | +LL | fn pin_box(self: Pin>) -> i32 { 7 } + | ^^^^^^^ ---- +help: you need to pin and box this expression + | +LL | reuse Trait::* { Box::pin(&&&&self.0) } + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:115:22 + | +LL | reuse Trait::* { &&&&self.0 } + | - ^^^^^^^^^^ expected `Pin>`, found `&&&&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&&&&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:18:8 + | +LL | fn pin_rc(self: Pin>) -> i32 { 8 } + | ^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:115:22 + | +LL | reuse Trait::* { &&&&self.0 } + | - ^^^^^^^^^^ expected `Pin>`, found `&&&&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&&&&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:19:8 + | +LL | fn pin_arc(self: Pin>) -> i32 { 9 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:115:22 + | +LL | reuse Trait::* { &&&&self.0 } + | - ^^^^^^^^^^ expected `Box>`, found `&&&&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box>` + found reference `&&&&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:20:8 + | +LL | fn box_box(self: Box>) -> i32 { 10 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:130:22 + | +LL | reuse Trait::* { self.0.as_ref() } + | - ^^^^^^^^^^^^^^^ expected `Box<_>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box<_>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:14:8 + | +LL | fn r#box(self: Box) -> i32 { 4 } + | ^^^^^ ---- +help: try removing the method call + | +LL - reuse Trait::* { self.0.as_ref() } +LL + reuse Trait::* { self.0 } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:130:22 + | +LL | reuse Trait::* { self.0.as_ref() } + | - ^^^^^^^^^^^^^^^ expected `Arc<_>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Arc<_>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:15:8 + | +LL | fn arc(self: Arc) -> i32 { 5 } + | ^^^ ---- +help: call `Into::into` on this expression to convert `&F` into `Arc<_>` + | +LL | reuse Trait::* { self.0.as_ref().into() } + | +++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:130:22 + | +LL | reuse Trait::* { self.0.as_ref() } + | - ^^^^^^^^^^^^^^^ expected `Rc<_>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Rc<_>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:16:8 + | +LL | fn rc(self: Rc) -> i32 { 6 } + | ^^ ---- +help: call `Into::into` on this expression to convert `&F` into `Rc<_>` + | +LL | reuse Trait::* { self.0.as_ref().into() } + | +++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:130:22 + | +LL | reuse Trait::* { self.0.as_ref() } + | - ^^^^^^^^^^^^^^^ expected `Pin>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:17:8 + | +LL | fn pin_box(self: Pin>) -> i32 { 7 } + | ^^^^^^^ ---- +help: you need to pin and box this expression + | +LL | reuse Trait::* { Box::pin(self.0.as_ref()) } + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:130:22 + | +LL | reuse Trait::* { self.0.as_ref() } + | - ^^^^^^^^^^^^^^^ expected `Pin>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:18:8 + | +LL | fn pin_rc(self: Pin>) -> i32 { 8 } + | ^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:130:22 + | +LL | reuse Trait::* { self.0.as_ref() } + | - ^^^^^^^^^^^^^^^ expected `Pin>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:19:8 + | +LL | fn pin_arc(self: Pin>) -> i32 { 9 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:130:22 + | +LL | reuse Trait::* { self.0.as_ref() } + | - ^^^^^^^^^^^^^^^ expected `Box>`, found `&F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box>` + found reference `&F` +note: method defined here + --> $DIR/self-coercion-errors.rs:20:8 + | +LL | fn box_box(self: Box>) -> i32 { 10 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:145:22 + | +LL | reuse Trait::* { &mut &mut &mut self.0 } + | - ^^^^^^^^^^^^^^^^^^^^^ expected `Box<_>`, found `&mut &mut &mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box<_>` + found mutable reference `&mut &mut &mut F` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +note: method defined here + --> $DIR/self-coercion-errors.rs:14:8 + | +LL | fn r#box(self: Box) -> i32 { 4 } + | ^^^^^ ---- +help: store this in the heap by calling `Box::new` + | +LL | reuse Trait::* { Box::new(&mut &mut &mut self.0) } + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:145:22 + | +LL | reuse Trait::* { &mut &mut &mut self.0 } + | - ^^^^^^^^^^^^^^^^^^^^^ expected `Arc<_>`, found `&mut &mut &mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Arc<_>` + found mutable reference `&mut &mut &mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:15:8 + | +LL | fn arc(self: Arc) -> i32 { 5 } + | ^^^ ---- +help: call `Into::into` on this expression to convert `&mut &mut &mut F` into `Arc<_>` + | +LL | reuse Trait::* { (&mut &mut &mut self.0).into() } + | + ++++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:145:22 + | +LL | reuse Trait::* { &mut &mut &mut self.0 } + | - ^^^^^^^^^^^^^^^^^^^^^ expected `Rc<_>`, found `&mut &mut &mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Rc<_>` + found mutable reference `&mut &mut &mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:16:8 + | +LL | fn rc(self: Rc) -> i32 { 6 } + | ^^ ---- +help: call `Into::into` on this expression to convert `&mut &mut &mut F` into `Rc<_>` + | +LL | reuse Trait::* { (&mut &mut &mut self.0).into() } + | + ++++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:145:22 + | +LL | reuse Trait::* { &mut &mut &mut self.0 } + | - ^^^^^^^^^^^^^^^^^^^^^ expected `Pin>`, found `&mut &mut &mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found mutable reference `&mut &mut &mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:17:8 + | +LL | fn pin_box(self: Pin>) -> i32 { 7 } + | ^^^^^^^ ---- +help: you need to pin and box this expression + | +LL | reuse Trait::* { Box::pin(&mut &mut &mut self.0) } + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:145:22 + | +LL | reuse Trait::* { &mut &mut &mut self.0 } + | - ^^^^^^^^^^^^^^^^^^^^^ expected `Pin>`, found `&mut &mut &mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found mutable reference `&mut &mut &mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:18:8 + | +LL | fn pin_rc(self: Pin>) -> i32 { 8 } + | ^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:145:22 + | +LL | reuse Trait::* { &mut &mut &mut self.0 } + | - ^^^^^^^^^^^^^^^^^^^^^ expected `Pin>`, found `&mut &mut &mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found mutable reference `&mut &mut &mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:19:8 + | +LL | fn pin_arc(self: Pin>) -> i32 { 9 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:145:22 + | +LL | reuse Trait::* { &mut &mut &mut self.0 } + | - ^^^^^^^^^^^^^^^^^^^^^ expected `Box>`, found `&mut &mut &mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box>` + found mutable reference `&mut &mut &mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:20:8 + | +LL | fn box_box(self: Box>) -> i32 { 10 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:161:22 + | +LL | reuse Trait::* { &&mut self.0 } + | - ^^^^^^^^^^^^ expected `Box<_>`, found `&&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box<_>` + found reference `&&mut F` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +note: method defined here + --> $DIR/self-coercion-errors.rs:14:8 + | +LL | fn r#box(self: Box) -> i32 { 4 } + | ^^^^^ ---- +help: store this in the heap by calling `Box::new` + | +LL | reuse Trait::* { Box::new(&&mut self.0) } + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:161:22 + | +LL | reuse Trait::* { &&mut self.0 } + | - ^^^^^^^^^^^^ expected `Arc<_>`, found `&&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Arc<_>` + found reference `&&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:15:8 + | +LL | fn arc(self: Arc) -> i32 { 5 } + | ^^^ ---- +help: call `Into::into` on this expression to convert `&&mut F` into `Arc<_>` + | +LL | reuse Trait::* { (&&mut self.0).into() } + | + ++++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:161:22 + | +LL | reuse Trait::* { &&mut self.0 } + | - ^^^^^^^^^^^^ expected `Rc<_>`, found `&&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Rc<_>` + found reference `&&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:16:8 + | +LL | fn rc(self: Rc) -> i32 { 6 } + | ^^ ---- +help: call `Into::into` on this expression to convert `&&mut F` into `Rc<_>` + | +LL | reuse Trait::* { (&&mut self.0).into() } + | + ++++++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:161:22 + | +LL | reuse Trait::* { &&mut self.0 } + | - ^^^^^^^^^^^^ expected `Pin>`, found `&&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:17:8 + | +LL | fn pin_box(self: Pin>) -> i32 { 7 } + | ^^^^^^^ ---- +help: you need to pin and box this expression + | +LL | reuse Trait::* { Box::pin(&&mut self.0) } + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:161:22 + | +LL | reuse Trait::* { &&mut self.0 } + | - ^^^^^^^^^^^^ expected `Pin>`, found `&&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:18:8 + | +LL | fn pin_rc(self: Pin>) -> i32 { 8 } + | ^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:161:22 + | +LL | reuse Trait::* { &&mut self.0 } + | - ^^^^^^^^^^^^ expected `Pin>`, found `&&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found reference `&&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:19:8 + | +LL | fn pin_arc(self: Pin>) -> i32 { 9 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:161:22 + | +LL | reuse Trait::* { &&mut self.0 } + | - ^^^^^^^^^^^^ expected `Box>`, found `&&mut F` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box>` + found reference `&&mut F` +note: method defined here + --> $DIR/self-coercion-errors.rs:20:8 + | +LL | fn box_box(self: Box>) -> i32 { 10 } + | ^^^^^^^ ---- + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:178:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Arc<_>`, found `Box` + | | + | arguments to this function are incorrect + | + = note: expected struct `Arc<_>` + found struct `Box` +note: method defined here + --> $DIR/self-coercion-errors.rs:15:8 + | +LL | fn arc(self: Arc) -> i32 { 5 } + | ^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:178:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Rc<_>`, found `Box` + | | + | arguments to this function are incorrect + | + = note: expected struct `Rc<_>` + found struct `Box` +note: method defined here + --> $DIR/self-coercion-errors.rs:16:8 + | +LL | fn rc(self: Rc) -> i32 { 6 } + | ^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:178:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Pin>`, found `Box` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found struct `Box` +note: method defined here + --> $DIR/self-coercion-errors.rs:17:8 + | +LL | fn pin_box(self: Pin>) -> i32 { 7 } + | ^^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:178:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Pin>`, found `Box` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found struct `Box` +note: method defined here + --> $DIR/self-coercion-errors.rs:18:8 + | +LL | fn pin_rc(self: Pin>) -> i32 { 8 } + | ^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:178:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Pin>`, found `Box` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found struct `Box` +note: method defined here + --> $DIR/self-coercion-errors.rs:19:8 + | +LL | fn pin_arc(self: Pin>) -> i32 { 9 } + | ^^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:178:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Box>`, found `Box` + | | + | arguments to this function are incorrect + | +note: there is a field `0` on `Box>` with type `std::ptr::Unique>` but it is private; `0` from `X6` was accessed through auto-deref instead + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: in this struct + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: if this field wasn't private, it would be accessible + | + ::: $DIR/self-coercion-errors.rs:175:8 + | +LL | struct X6(Box); + | -- ------ this is the field that was accessed + | | + | this struct is accessible through auto-deref + = note: expected struct `Box>` + found struct `Box` +note: method defined here + --> $DIR/self-coercion-errors.rs:20:8 + | +LL | fn box_box(self: Box>) -> i32 { 10 } + | ^^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:190:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Arc<_>`, found `Box>>` + | | + | arguments to this function are incorrect + | + = note: expected struct `Arc<_>` + found struct `Box>>` +note: method defined here + --> $DIR/self-coercion-errors.rs:15:8 + | +LL | fn arc(self: Arc) -> i32 { 5 } + | ^^^ ---- +help: consider unboxing the value + | +LL | reuse Trait::* { *self.0 } + | + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:190:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Rc<_>`, found `Box>>` + | | + | arguments to this function are incorrect + | + = note: expected struct `Rc<_>` + found struct `Box>>` +note: method defined here + --> $DIR/self-coercion-errors.rs:16:8 + | +LL | fn rc(self: Rc) -> i32 { 6 } + | ^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:190:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Pin>`, found `Box>>` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found struct `Box>>` +note: method defined here + --> $DIR/self-coercion-errors.rs:17:8 + | +LL | fn pin_box(self: Pin>) -> i32 { 7 } + | ^^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:190:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Pin>`, found `Box>>` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found struct `Box>>` +note: method defined here + --> $DIR/self-coercion-errors.rs:18:8 + | +LL | fn pin_rc(self: Pin>) -> i32 { 8 } + | ^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:190:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Pin>`, found `Box>>` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found struct `Box>>` +note: method defined here + --> $DIR/self-coercion-errors.rs:19:8 + | +LL | fn pin_arc(self: Pin>) -> i32 { 9 } + | ^^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:190:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Box>`, found `Box>>` + | | + | arguments to this function are incorrect + | +note: there is a field `0` on `Box>` with type `std::ptr::Unique>` but it is private; `0` from `X7` was accessed through auto-deref instead + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: in this struct + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: if this field wasn't private, it would be accessible + | + ::: $DIR/self-coercion-errors.rs:187:8 + | +LL | struct X7(Box>>); + | -- ---------------- this is the field that was accessed + | | + | this struct is accessible through auto-deref + = note: expected struct `Box>` + found struct `Box>>` +note: method defined here + --> $DIR/self-coercion-errors.rs:20:8 + | +LL | fn box_box(self: Box>) -> i32 { 10 } + | ^^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:205:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Box<_>`, found `Pin>` + | | + | arguments to this function are incorrect + | +note: there is a field `0` on `Box` with type `std::ptr::Unique` but it is private; `0` from `X8` was accessed through auto-deref instead + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: in this struct + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: if this field wasn't private, it would be accessible + | + ::: $DIR/self-coercion-errors.rs:202:8 + | +LL | struct X8(Pin>); + | -- ----------- this is the field that was accessed + | | + | this struct is accessible through auto-deref + = note: expected struct `Box<_>` + found struct `Pin>` +note: method defined here + --> $DIR/self-coercion-errors.rs:14:8 + | +LL | fn r#box(self: Box) -> i32 { 4 } + | ^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:205:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Arc<_>`, found `Pin>` + | | + | arguments to this function are incorrect + | + = note: expected struct `Arc<_>` + found struct `Pin>` +note: method defined here + --> $DIR/self-coercion-errors.rs:15:8 + | +LL | fn arc(self: Arc) -> i32 { 5 } + | ^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:205:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Rc<_>`, found `Pin>` + | | + | arguments to this function are incorrect + | + = note: expected struct `Rc<_>` + found struct `Pin>` +note: method defined here + --> $DIR/self-coercion-errors.rs:16:8 + | +LL | fn rc(self: Rc) -> i32 { 6 } + | ^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:205:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Pin>`, found `Pin>` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found struct `Pin>` +note: method defined here + --> $DIR/self-coercion-errors.rs:18:8 + | +LL | fn pin_rc(self: Pin>) -> i32 { 8 } + | ^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:205:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Pin>`, found `Pin>` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found struct `Pin>` +note: method defined here + --> $DIR/self-coercion-errors.rs:19:8 + | +LL | fn pin_arc(self: Pin>) -> i32 { 9 } + | ^^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:205:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Box>`, found `Pin>` + | | + | arguments to this function are incorrect + | +note: there is a field `0` on `Box>` with type `std::ptr::Unique>` but it is private; `0` from `X8` was accessed through auto-deref instead + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: in this struct + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: if this field wasn't private, it would be accessible + | + ::: $DIR/self-coercion-errors.rs:202:8 + | +LL | struct X8(Pin>); + | -- ----------- this is the field that was accessed + | | + | this struct is accessible through auto-deref + = note: expected struct `Box>` + found struct `Pin>` +note: method defined here + --> $DIR/self-coercion-errors.rs:20:8 + | +LL | fn box_box(self: Box>) -> i32 { 10 } + | ^^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0277]: the trait bound `OtherStruct: Trait` is not satisfied + --> $DIR/self-coercion-errors.rs:221:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ unsatisfied trait bound + | | + | required by a bound introduced by this call + | +help: the trait `Trait` is not implemented for `OtherStruct` + --> $DIR/self-coercion-errors.rs:217:1 + | +LL | struct OtherStruct; + | ^^^^^^^^^^^^^^^^^^ +help: the trait `Trait` is implemented for `F` + --> $DIR/self-coercion-errors.rs:24:1 + | +LL | impl Trait for F {} + | ^^^^^^^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:221:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `&mut _`, found `OtherStruct` + | | + | arguments to this function are incorrect + | + = note: expected mutable reference `&mut _` + found struct `OtherStruct` +note: method defined here + --> $DIR/self-coercion-errors.rs:12:8 + | +LL | fn by_mut_ref(&mut self) -> i32 { 2 } + | ^^^^^^^^^^ --------- +help: consider mutably borrowing here + | +LL | reuse Trait::* { &mut self.0 } + | ++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:221:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `&_`, found `OtherStruct` + | | + | arguments to this function are incorrect + | + = note: expected reference `&_` + found struct `OtherStruct` +note: method defined here + --> $DIR/self-coercion-errors.rs:13:8 + | +LL | fn by_ref(&self) -> i32 { 3 } + | ^^^^^^ ----- +help: consider borrowing here + | +LL | reuse Trait::* { &self.0 } + | + + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:221:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Box<_>`, found `OtherStruct` + | | + | arguments to this function are incorrect + | +note: there is a field `0` on `Box` with type `std::ptr::Unique` but it is private; `0` from `X9` was accessed through auto-deref instead + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: in this struct + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: if this field wasn't private, it would be accessible + | + ::: $DIR/self-coercion-errors.rs:218:8 + | +LL | struct X9(OtherStruct); + | -- ----------- this is the field that was accessed + | | + | this struct is accessible through auto-deref + = note: expected struct `Box<_>` + found struct `OtherStruct` +note: method defined here + --> $DIR/self-coercion-errors.rs:14:8 + | +LL | fn r#box(self: Box) -> i32 { 4 } + | ^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:221:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Arc<_>`, found `OtherStruct` + | | + | arguments to this function are incorrect + | + = note: expected struct `Arc<_>` + found struct `OtherStruct` +note: method defined here + --> $DIR/self-coercion-errors.rs:15:8 + | +LL | fn arc(self: Arc) -> i32 { 5 } + | ^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:221:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Rc<_>`, found `OtherStruct` + | | + | arguments to this function are incorrect + | + = note: expected struct `Rc<_>` + found struct `OtherStruct` +note: method defined here + --> $DIR/self-coercion-errors.rs:16:8 + | +LL | fn rc(self: Rc) -> i32 { 6 } + | ^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:221:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Pin>`, found `OtherStruct` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found struct `OtherStruct` +note: method defined here + --> $DIR/self-coercion-errors.rs:17:8 + | +LL | fn pin_box(self: Pin>) -> i32 { 7 } + | ^^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:221:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Pin>`, found `OtherStruct` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found struct `OtherStruct` +note: method defined here + --> $DIR/self-coercion-errors.rs:18:8 + | +LL | fn pin_rc(self: Pin>) -> i32 { 8 } + | ^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:221:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Pin>`, found `OtherStruct` + | | + | arguments to this function are incorrect + | + = note: expected struct `Pin>` + found struct `OtherStruct` +note: method defined here + --> $DIR/self-coercion-errors.rs:19:8 + | +LL | fn pin_arc(self: Pin>) -> i32 { 9 } + | ^^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0308]: mismatched types + --> $DIR/self-coercion-errors.rs:221:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ expected `Box>`, found `OtherStruct` + | | + | arguments to this function are incorrect + | +note: there is a field `0` on `Box>` with type `std::ptr::Unique>` but it is private; `0` from `X9` was accessed through auto-deref instead + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: in this struct + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: if this field wasn't private, it would be accessible + | + ::: $DIR/self-coercion-errors.rs:218:8 + | +LL | struct X9(OtherStruct); + | -- ----------- this is the field that was accessed + | | + | this struct is accessible through auto-deref + = note: expected struct `Box>` + found struct `OtherStruct` +note: method defined here + --> $DIR/self-coercion-errors.rs:20:8 + | +LL | fn box_box(self: Box>) -> i32 { 10 } + | ^^^^^^^ ---- +help: consider removing the tuple struct field `0` + | +LL - reuse Trait::* { self.0 } +LL + reuse Trait::* { self } + | + +error[E0507]: cannot move out of a mutable reference + --> $DIR/self-coercion-errors.rs:73:9 + | +LL | reuse Trait::{by_value, by_mut_ref, by_ref} { + | -------- value moved due to this method call +... +LL | &mut x + | ^^^^^^ move occurs because value has type `F`, which does not implement the `Copy` trait + | +note: `Trait::by_value` takes ownership of the receiver `self`, which moves value + --> $DIR/self-coercion-errors.rs:11:17 + | +LL | fn by_value(self) -> i32 { 1 } + | ^^^^ +note: if `F` implemented `Clone`, you could clone the value + --> $DIR/self-coercion-errors.rs:23:1 + | +LL | struct F; + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | &mut x + | ------ you could clone this value + +error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable + --> $DIR/self-coercion-errors.rs:73:9 + | +LL | &mut x + | ^^^^^^ cannot borrow as mutable + | +help: consider changing this to be mutable + | +LL | let mut x = foo(); + | +++ + +error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable + --> $DIR/self-coercion-errors.rs:73:9 + | +LL | &mut x + | ^^^^^^ cannot borrow as mutable + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider changing this to be mutable + | +LL | let mut x = foo(); + | +++ + +error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable + --> $DIR/self-coercion-errors.rs:73:9 + | +LL | &mut x + | ^^^^^^ cannot borrow as mutable + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider changing this to be mutable + | +LL | let mut x = foo(); + | +++ + +error[E0507]: cannot move out of a mutable reference + --> $DIR/self-coercion-errors.rs:84:22 + | +LL | reuse Trait::* { &mut self.0 } + | - ^^^^^^^^^^^ move occurs because value has type `F`, which does not implement the `Copy` trait + | | + | value moved due to this method call + | +note: `Trait::by_value` takes ownership of the receiver `self`, which moves value + --> $DIR/self-coercion-errors.rs:11:17 + | +LL | fn by_value(self) -> i32 { 1 } + | ^^^^ +note: if `F` implemented `Clone`, you could clone the value + --> $DIR/self-coercion-errors.rs:23:1 + | +LL | struct F; + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | reuse Trait::* { &mut self.0 } + | ----------- you could clone this value + +error[E0596]: cannot borrow `self.0` as mutable, as `self` is not declared as mutable + --> $DIR/self-coercion-errors.rs:84:22 + | +LL | reuse Trait::* { &mut self.0 } + | ^^^^^^^^^^^ cannot borrow as mutable + | +help: consider changing this to be mutable + | +LL | reuse Trait::mut * { &mut self.0 } + | +++ + +error[E0596]: cannot borrow `self.0` as mutable, as it is behind a `&` reference + --> $DIR/self-coercion-errors.rs:84:22 + | +LL | reuse Trait::* { &mut self.0 } + | ^^^^^^^^^^^ `self` is a `&` reference, so it cannot be borrowed as mutable + | +help: consider changing this to be a mutable reference + | +LL - reuse Trait::* { &mut self.0 } +LL + reuse Trait::&mut self { &mut self.0 } + | + +error[E0507]: cannot move out of a shared reference + --> $DIR/self-coercion-errors.rs:100:22 + | +LL | reuse Trait::* { &self.0 } + | - ^^^^^^^ move occurs because value has type `F`, which does not implement the `Copy` trait + | | + | value moved due to this method call + | +note: `Trait::by_value` takes ownership of the receiver `self`, which moves value + --> $DIR/self-coercion-errors.rs:11:17 + | +LL | fn by_value(self) -> i32 { 1 } + | ^^^^ +note: if `F` implemented `Clone`, you could clone the value + --> $DIR/self-coercion-errors.rs:23:1 + | +LL | struct F; + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | reuse Trait::* { &self.0 } + | ------- you could clone this value + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/self-coercion-errors.rs:100:22 + | +LL | reuse Trait::* { &self.0 } + | ^^^^^^^ cannot borrow as mutable + +error[E0507]: cannot move out of a shared reference + --> $DIR/self-coercion-errors.rs:115:22 + | +LL | reuse Trait::* { &&&&self.0 } + | - ^^^^^^^^^^ move occurs because value has type `F`, which does not implement the `Copy` trait + | | + | value moved due to this method call + | +note: `Trait::by_value` takes ownership of the receiver `self`, which moves value + --> $DIR/self-coercion-errors.rs:11:17 + | +LL | fn by_value(self) -> i32 { 1 } + | ^^^^ +note: if `F` implemented `Clone`, you could clone the value + --> $DIR/self-coercion-errors.rs:23:1 + | +LL | struct F; + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | reuse Trait::* { &&&&self.0 } + | ---------- you could clone this value + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/self-coercion-errors.rs:115:22 + | +LL | reuse Trait::* { &&&&self.0 } + | ^^^^^^^^^^ cannot borrow as mutable + +error[E0507]: cannot move out of a shared reference + --> $DIR/self-coercion-errors.rs:130:22 + | +LL | reuse Trait::* { self.0.as_ref() } + | - ^^^^^^^^^^^^^^^ move occurs because value has type `F`, which does not implement the `Copy` trait + | | + | value moved due to this method call + | +note: `Trait::by_value` takes ownership of the receiver `self`, which moves value + --> $DIR/self-coercion-errors.rs:11:17 + | +LL | fn by_value(self) -> i32 { 1 } + | ^^^^ +note: if `F` implemented `Clone`, you could clone the value + --> $DIR/self-coercion-errors.rs:23:1 + | +LL | struct F; + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | reuse Trait::* { self.0.as_ref() } + | --------------- you could clone this value + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/self-coercion-errors.rs:130:22 + | +LL | reuse Trait::* { self.0.as_ref() } + | ^^^^^^^^^^^^^^^ cannot borrow as mutable + +error[E0507]: cannot move out of a mutable reference + --> $DIR/self-coercion-errors.rs:145:22 + | +LL | reuse Trait::* { &mut &mut &mut self.0 } + | - ^^^^^^^^^^^^^^^^^^^^^ move occurs because value has type `F`, which does not implement the `Copy` trait + | | + | value moved due to this method call + | +note: `Trait::by_value` takes ownership of the receiver `self`, which moves value + --> $DIR/self-coercion-errors.rs:11:17 + | +LL | fn by_value(self) -> i32 { 1 } + | ^^^^ +note: if `F` implemented `Clone`, you could clone the value + --> $DIR/self-coercion-errors.rs:23:1 + | +LL | struct F; + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | reuse Trait::* { &mut &mut &mut self.0 } + | --------------------- you could clone this value + +error[E0596]: cannot borrow `self.0` as mutable, as `self` is not declared as mutable + --> $DIR/self-coercion-errors.rs:145:32 + | +LL | reuse Trait::* { &mut &mut &mut self.0 } + | ^^^^^^^^^^^ cannot borrow as mutable + | +help: consider changing this to be mutable + | +LL | reuse Trait::mut * { &mut &mut &mut self.0 } + | +++ + +error[E0596]: cannot borrow `self.0` as mutable, as it is behind a `&` reference + --> $DIR/self-coercion-errors.rs:145:32 + | +LL | reuse Trait::* { &mut &mut &mut self.0 } + | ^^^^^^^^^^^ `self` is a `&` reference, so it cannot be borrowed as mutable + | +help: consider changing this to be a mutable reference + | +LL - reuse Trait::* { &mut &mut &mut self.0 } +LL + reuse Trait::&mut self { &mut &mut &mut self.0 } + | + +error[E0507]: cannot move out of a shared reference + --> $DIR/self-coercion-errors.rs:161:22 + | +LL | reuse Trait::* { &&mut self.0 } + | - ^^^^^^^^^^^^ move occurs because value has type `F`, which does not implement the `Copy` trait + | | + | value moved due to this method call + | +note: `Trait::by_value` takes ownership of the receiver `self`, which moves value + --> $DIR/self-coercion-errors.rs:11:17 + | +LL | fn by_value(self) -> i32 { 1 } + | ^^^^ +note: if `F` implemented `Clone`, you could clone the value + --> $DIR/self-coercion-errors.rs:23:1 + | +LL | struct F; + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | reuse Trait::* { &&mut self.0 } + | ------------ you could clone this value + +error[E0596]: cannot borrow `self.0` as mutable, as `self` is not declared as mutable + --> $DIR/self-coercion-errors.rs:161:23 + | +LL | reuse Trait::* { &&mut self.0 } + | ^^^^^^^^^^^ cannot borrow as mutable + | +help: consider changing this to be mutable + | +LL | reuse Trait::mut * { &&mut self.0 } + | +++ + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/self-coercion-errors.rs:161:22 + | +LL | reuse Trait::* { &&mut self.0 } + | ^^^^^^^^^^^^ cannot borrow as mutable + +error[E0596]: cannot borrow `self.0` as mutable, as it is behind a `&` reference + --> $DIR/self-coercion-errors.rs:161:23 + | +LL | reuse Trait::* { &&mut self.0 } + | ^^^^^^^^^^^ `self` is a `&` reference, so it cannot be borrowed as mutable + | +help: consider changing this to be a mutable reference + | +LL - reuse Trait::* { &&mut self.0 } +LL + reuse Trait::&mut self { &&mut self.0 } + | + +error[E0507]: cannot move out of an `Arc` + --> $DIR/self-coercion-errors.rs:190:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ move occurs because value has type `F`, which does not implement the `Copy` trait + | | + | value moved due to this method call + | +note: `Trait::by_value` takes ownership of the receiver `self`, which moves value + --> $DIR/self-coercion-errors.rs:11:17 + | +LL | fn by_value(self) -> i32 { 1 } + | ^^^^ +note: if `F` implemented `Clone`, you could clone the value + --> $DIR/self-coercion-errors.rs:23:1 + | +LL | struct F; + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | reuse Trait::* { self.0 } + | ------ you could clone this value + +error[E0596]: cannot borrow data in an `Arc` as mutable + --> $DIR/self-coercion-errors.rs:190:22 + | +LL | reuse Trait::* { self.0 } + | ^^^^^^ cannot borrow as mutable + | + = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Arc>` + +error[E0507]: cannot move out of an `Arc` + --> $DIR/self-coercion-errors.rs:190:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ move occurs because value has type `Box`, which does not implement the `Copy` trait + | | + | value moved due to this method call + | +note: `Trait::r#box` takes ownership of the receiver `self`, which moves value + --> $DIR/self-coercion-errors.rs:14:14 + | +LL | fn r#box(self: Box) -> i32 { 4 } + | ^^^^ +note: if `F` implemented `Clone`, you could clone the value + --> $DIR/self-coercion-errors.rs:23:1 + | +LL | struct F; + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | reuse Trait::* { self.0 } + | ------ you could clone this value +help: you could `clone` the value and consume it, if the `F: Clone` trait bound could be satisfied + | +LL | reuse Trait::* { as Clone>::clone(&self.0) } + | ++++++++++++++++++++++++++ + +help: consider annotating `F` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct F; + | + +error[E0507]: cannot move out of dereference of `Pin>` + --> $DIR/self-coercion-errors.rs:205:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ move occurs because value has type `F`, which does not implement the `Copy` trait + | | + | value moved due to this method call + | +note: `Trait::by_value` takes ownership of the receiver `self`, which moves value + --> $DIR/self-coercion-errors.rs:11:17 + | +LL | fn by_value(self) -> i32 { 1 } + | ^^^^ +note: if `F` implemented `Clone`, you could clone the value + --> $DIR/self-coercion-errors.rs:23:1 + | +LL | struct F; + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | reuse Trait::* { self.0 } + | ------ you could clone this value + +error[E0596]: cannot borrow data in dereference of `Pin>` as mutable + --> $DIR/self-coercion-errors.rs:205:22 + | +LL | reuse Trait::* { self.0 } + | ^^^^^^ cannot borrow as mutable + | + = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Pin>` + +error[E0507]: cannot move out of dereference of `Pin>` + --> $DIR/self-coercion-errors.rs:205:22 + | +LL | reuse Trait::* { self.0 } + | - ^^^^^^ move occurs because value has type `Pin>`, which does not implement the `Copy` trait + | | + | value moved due to this method call + | +note: `Trait::pin_box` takes ownership of the receiver `self`, which moves value + --> $DIR/self-coercion-errors.rs:17:16 + | +LL | fn pin_box(self: Pin>) -> i32 { 7 } + | ^^^^ +note: if `F` implemented `Clone`, you could clone the value + --> $DIR/self-coercion-errors.rs:23:1 + | +LL | struct F; + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | reuse Trait::* { self.0 } + | ------ you could clone this value +help: you could `clone` the value and consume it, if the `F: Clone` trait bound could be satisfied + | +LL | reuse Trait::* { > as Clone>::clone(&self.0) } + | +++++++++++++++++++++++++++++++ + +help: consider annotating `F` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct F; + | + +error: aborting due to 99 previous errors + +Some errors have detailed explanations: E0277, E0308, E0507, E0596. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/delegation/self-coercion-static-free.rs b/tests/ui/delegation/self-coercion-static-free.rs new file mode 100644 index 0000000000000..f61d4247a1d94 --- /dev/null +++ b/tests/ui/delegation/self-coercion-static-free.rs @@ -0,0 +1,52 @@ +// Test that we do not adjust first argument type to first parameter type +// in delegations to static associated functions (we only do it for methods). +// Also test that we do not adjust first arg. type in delegations to free function. + +#![feature(fn_delegation)] + +pub trait Trait: Sized { + fn static_self() -> F { F } + + fn static_value(_: Self) -> i32 { 1 } + fn static_mut_ref(_: &mut Self) -> i32 { 2 } + fn static_ref(_: &Self) -> i32 { 3 } +} + +#[derive(Default)] +struct F; +impl Trait for F {} + +struct S(F); + +impl Trait for S { + reuse ::{static_value, static_mut_ref, static_ref} { + let _ = self; + S::static_self() + //~^ ERROR: mismatched types + //~| ERROR: mismatched types + } +} + +struct S1(Box>>>>>); + +impl Trait for S1 { + reuse ::{static_value, static_mut_ref, static_ref} { + let _ = self; + S1::static_self() + //~^ ERROR: mismatched types + //~| ERROR: mismatched types + } +} + +mod to_reuse { + use super::Trait; + pub fn value(_: impl Trait) -> i32 { 1 } + pub fn mut_ref(_: &mut impl Trait) -> i32 { 2 } + pub fn r#ref(_: &impl Trait) -> i32 { 3 } +} + +reuse to_reuse::{value, mut_ref, r#ref} { F } +//~^ ERROR: mismatched types +//~| ERROR: mismatched types + +fn main() {} diff --git a/tests/ui/delegation/self-coercion-static-free.stderr b/tests/ui/delegation/self-coercion-static-free.stderr new file mode 100644 index 0000000000000..5f78272815aa5 --- /dev/null +++ b/tests/ui/delegation/self-coercion-static-free.stderr @@ -0,0 +1,87 @@ +error[E0308]: mismatched types + --> $DIR/self-coercion-static-free.rs:24:9 + | +LL | S::static_self() + | ^^^^^^^^^^^^^^^^ expected `&mut F`, found `F` + | +help: consider mutably borrowing here + | +LL | &mut S::static_self() + | ++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-static-free.rs:24:9 + | +LL | S::static_self() + | ^^^^^^^^^^^^^^^^ expected `&F`, found `F` + | +help: consider borrowing here + | +LL | &S::static_self() + | + + +error[E0308]: mismatched types + --> $DIR/self-coercion-static-free.rs:35:9 + | +LL | S1::static_self() + | ^^^^^^^^^^^^^^^^^ expected `&mut F`, found `F` + | +help: consider mutably borrowing here + | +LL | &mut S1::static_self() + | ++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-static-free.rs:35:9 + | +LL | S1::static_self() + | ^^^^^^^^^^^^^^^^^ expected `&F`, found `F` + | +help: consider borrowing here + | +LL | &S1::static_self() + | + + +error[E0308]: mismatched types + --> $DIR/self-coercion-static-free.rs:48:43 + | +LL | reuse to_reuse::{value, mut_ref, r#ref} { F } + | ------- ^ expected `&mut _`, found `F` + | | + | arguments to this function are incorrect + | + = note: expected mutable reference `&mut _` + found struct `F` +note: function defined here + --> $DIR/self-coercion-static-free.rs:44:12 + | +LL | pub fn mut_ref(_: &mut impl Trait) -> i32 { 2 } + | ^^^^^^^ ------------------ +help: consider mutably borrowing here + | +LL | reuse to_reuse::{value, mut_ref, r#ref} { &mut F } + | ++++ + +error[E0308]: mismatched types + --> $DIR/self-coercion-static-free.rs:48:43 + | +LL | reuse to_reuse::{value, mut_ref, r#ref} { F } + | ----- ^ expected `&_`, found `F` + | | + | arguments to this function are incorrect + | + = note: expected reference `&_` + found struct `F` +note: function defined here + --> $DIR/self-coercion-static-free.rs:45:12 + | +LL | pub fn r#ref(_: &impl Trait) -> i32 { 3 } + | ^^^^^ -------------- +help: consider borrowing here + | +LL | reuse to_reuse::{value, mut_ref, r#ref} { &F } + | + + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/delegation/self-coercion.rs b/tests/ui/delegation/self-coercion.rs index e6c71ec1e257b..21b2b0cd2f56b 100644 --- a/tests/ui/delegation/self-coercion.rs +++ b/tests/ui/delegation/self-coercion.rs @@ -2,12 +2,13 @@ #![feature(fn_delegation)] -trait Trait : Sized { +trait Trait: Sized { fn by_value(self) -> i32 { 1 } fn by_mut_ref(&mut self) -> i32 { 2 } fn by_ref(&self) -> i32 { 3 } } +#[derive(Default)] struct F; impl Trait for F {} @@ -17,9 +18,20 @@ impl Trait for S { reuse Trait::{by_value, by_mut_ref, by_ref} { self.0 } } +struct S1(Box>>>>>); + +impl Trait for S1 { + reuse Trait::{by_value, by_mut_ref, by_ref} { self.0 } +} + fn main() { let mut s = S(F); assert_eq!(s.by_ref(), 3); assert_eq!(s.by_mut_ref(), 2); assert_eq!(s.by_value(), 1); + + let mut s = S1(Default::default()); + assert_eq!(s.by_ref(), 3); + assert_eq!(s.by_mut_ref(), 2); + assert_eq!(s.by_value(), 1); } diff --git a/tests/ui/delegation/wrong-lifetime-rib.rs b/tests/ui/delegation/wrong-lifetime-rib.rs index 825ac6a64008a..01645f20bf7b1 100644 --- a/tests/ui/delegation/wrong-lifetime-rib.rs +++ b/tests/ui/delegation/wrong-lifetime-rib.rs @@ -33,7 +33,7 @@ mod ice_156806 { trait X {} impl X { //~ ERROR: expected a type, found a trait - reuse Iterator::fold { //~ ERROR: `()` is not an iterator + reuse Iterator::fold { let _: &X; //~ ERROR: expected a type, found a trait } } diff --git a/tests/ui/delegation/wrong-lifetime-rib.stderr b/tests/ui/delegation/wrong-lifetime-rib.stderr index 07ddc94f7a4ae..0c4499eec192d 100644 --- a/tests/ui/delegation/wrong-lifetime-rib.stderr +++ b/tests/ui/delegation/wrong-lifetime-rib.stderr @@ -66,17 +66,7 @@ help: you can add the `dyn` keyword if you want a trait object LL | let _: &dyn X; | +++ -error[E0599]: `()` is not an iterator - --> $DIR/wrong-lifetime-rib.rs:36:25 - | -LL | reuse Iterator::fold { - | ^^^^ `()` is not an iterator - | - = note: the following trait bounds were not satisfied: - `(): Iterator` - which is required by `&mut (): Iterator` - -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors -Some errors have detailed explanations: E0116, E0223, E0423, E0599, E0782. +Some errors have detailed explanations: E0116, E0223, E0423, E0782. For more information about an error, try `rustc --explain E0116`.