From 8cdfcc12f7b50abe8cb5bae315365eb614a9de56 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Mon, 15 Jul 2024 09:20:11 +0000 Subject: [PATCH 1/3] Don't use global caches if opaques can be defined --- compiler/rustc_trait_selection/src/traits/select/mod.rs | 8 +++++++- .../auto-traits/opaque_type_candidate_selection.rs} | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) rename tests/{crashes/119272.rs => ui/auto-traits/opaque_type_candidate_selection.rs} (91%) diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 7a93f59f16394..2980cb2755711 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -1498,7 +1498,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { return false; } - // Avoid using the master cache during coherence and just rely + // Avoid using the global cache during coherence and just rely // on the local cache. This effectively disables caching // during coherence. It is really just a simplification to // avoid us having to fear that coherence results "pollute" @@ -1509,6 +1509,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { return false; } + // Avoid using the global cache when we're defining opaque types + // as their hidden type may impact the result of candidate selection. + if !self.infcx.defining_opaque_types().is_empty() { + return false; + } + // Otherwise, we can use the global cache. true } diff --git a/tests/crashes/119272.rs b/tests/ui/auto-traits/opaque_type_candidate_selection.rs similarity index 91% rename from tests/crashes/119272.rs rename to tests/ui/auto-traits/opaque_type_candidate_selection.rs index 02e2cfd09e2f8..d6973b76a6e1e 100644 --- a/tests/crashes/119272.rs +++ b/tests/ui/auto-traits/opaque_type_candidate_selection.rs @@ -1,4 +1,7 @@ -//@ known-bug: #119272 +//! used to ICE: #119272 + +//@ check-pass + #![feature(type_alias_impl_trait)] mod defining_scope { use super::*; From 91bdd4ae21d33d07eabcd6ca29e990ecf122b78c Mon Sep 17 00:00:00 2001 From: Julia Ryan Date: Tue, 16 Jul 2024 11:20:19 -0700 Subject: [PATCH 2/3] Add fuchsia cherry-pick this should fix #126024 --- src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh b/src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh index c806b886dae8f..8a4214edb729b 100755 --- a/src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh +++ b/src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh @@ -29,7 +29,7 @@ KEEP_CHECKOUT= # Gerrit changes from https://fxrev.dev during development (click the "Download" # button on a changelist to see the cherry pick ref). Example: # PICK_REFS=(refs/changes/71/1054071/2 refs/changes/74/1054574/2) -PICK_REFS=() +PICK_REFS=(refs/changes/93/1082793/1) # The commit hash of Fuchsia's integration.git to check out. This controls the # commit hash of fuchsia.git and some other repos in the "monorepo" checkout, in From 221ae5e02621ddcdcb1ff31e492470543857b4f6 Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Tue, 23 Jul 2024 17:13:41 -0400 Subject: [PATCH 3/3] Add another Fuchsia cherry-pick --- src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh b/src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh index 8a4214edb729b..3f4c62f9309a4 100755 --- a/src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh +++ b/src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh @@ -29,7 +29,7 @@ KEEP_CHECKOUT= # Gerrit changes from https://fxrev.dev during development (click the "Download" # button on a changelist to see the cherry pick ref). Example: # PICK_REFS=(refs/changes/71/1054071/2 refs/changes/74/1054574/2) -PICK_REFS=(refs/changes/93/1082793/1) +PICK_REFS=(refs/changes/93/1082793/1 refs/changes/92/1087892/1) # The commit hash of Fuchsia's integration.git to check out. This controls the # commit hash of fuchsia.git and some other repos in the "monorepo" checkout, in