Skip to content

Commit c2b9647

Browse files
committed
Don't use global caches if opaques can be defined
1 parent 0da95bd commit c2b9647

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
14981498
return false;
14991499
}
15001500

1501-
// Avoid using the master cache during coherence and just rely
1501+
// Avoid using the global cache during coherence and just rely
15021502
// on the local cache. This effectively disables caching
15031503
// during coherence. It is really just a simplification to
15041504
// avoid us having to fear that coherence results "pollute"
@@ -1509,6 +1509,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15091509
return false;
15101510
}
15111511

1512+
// Avoid using the global cache when we're defining opaque types.
1513+
if !self.infcx.defining_opaque_types().is_empty() {
1514+
return false;
1515+
}
1516+
15121517
// Otherwise, we can use the global cache.
15131518
true
15141519
}

tests/crashes/119272.rs renamed to tests/ui/auto-traits/opaque_type_candidate_selection.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
//@ known-bug: #119272
1+
//! used to ICE: #119272
2+
3+
//@ check-pass
4+
25
#![feature(type_alias_impl_trait)]
36
mod defining_scope {
47
use super::*;

0 commit comments

Comments
 (0)