diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-07-15 09:20:11 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-07-24 10:45:21 +0000 |
| commit | 61b5e11c47c452ed987295b147783e8bd8e16434 (patch) | |
| tree | dad2fda43e2b880d0056ca3232e99b1314a8a709 /compiler/rustc_trait_selection/src | |
| parent | 08a9ca7c18a30a23a72a43b65be616c9a6a36a5a (diff) | |
| download | rust-61b5e11c47c452ed987295b147783e8bd8e16434.tar.gz rust-61b5e11c47c452ed987295b147783e8bd8e16434.zip | |
Don't use global caches if opaques can be defined
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/mod.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index d6590322caa..02ad361f9f5 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 } |
