File tree 4 files changed +10
-9
lines changed
compiler/rustc_query_system/src
4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -5339,9 +5339,9 @@ dependencies = [
5339
5339
5340
5340
[[package ]]
5341
5341
name = " thin-vec"
5342
- version = " 0.2.12 "
5342
+ version = " 0.2.13 "
5343
5343
source = " registry+https://github.com/rust-lang/crates.io-index"
5344
- checksum = " aac81b6fd6beb5884b0cf3321b8117e6e5d47ecb6fc89f414cfdcca8b2fe2dd8 "
5344
+ checksum = " a38c90d48152c236a3ab59271da4f4ae63d678c5d7ad6b7714d7cb9760be5e4b "
5345
5345
5346
5346
[[package ]]
5347
5347
name = " thiserror"
Original file line number Diff line number Diff line change @@ -891,7 +891,7 @@ impl<D: Deps> DepGraphData<D> {
891
891
insertion for {dep_node:?}"
892
892
) ;
893
893
894
- if ! side_effects. is_empty ( ) {
894
+ if side_effects. maybe_any ( ) {
895
895
qcx. dep_context ( ) . dep_graph ( ) . with_query_deserialization ( || {
896
896
self . emit_side_effects ( qcx, dep_node_index, side_effects)
897
897
} ) ;
Original file line number Diff line number Diff line change @@ -89,10 +89,12 @@ pub struct QuerySideEffects {
89
89
}
90
90
91
91
impl QuerySideEffects {
92
+ /// Returns true if there might be side effects.
92
93
#[ inline]
93
- pub fn is_empty ( & self ) -> bool {
94
- let QuerySideEffects { diagnostics } = self ;
95
- diagnostics. is_empty ( )
94
+ pub fn maybe_any ( & self ) -> bool {
95
+ // Use `has_capacity` so that the destructor for `self.diagnostics` can be skipped
96
+ // if `maybe_any` is known to be false.
97
+ !self . diagnostics . has_capacity ( )
96
98
}
97
99
pub fn append ( & mut self , other : QuerySideEffects ) {
98
100
let QuerySideEffects { diagnostics } = self ;
Original file line number Diff line number Diff line change @@ -531,10 +531,9 @@ where
531
531
532
532
prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
533
533
534
- let diagnostics = diagnostics. into_inner ( ) ;
535
- let side_effects = QuerySideEffects { diagnostics } ;
534
+ let side_effects = QuerySideEffects { diagnostics : diagnostics. into_inner ( ) } ;
536
535
537
- if std:: intrinsics:: unlikely ( ! side_effects. is_empty ( ) ) {
536
+ if std:: intrinsics:: unlikely ( side_effects. maybe_any ( ) ) {
538
537
if query. anon ( ) {
539
538
qcx. store_side_effects_for_anon_node ( dep_node_index, side_effects) ;
540
539
} else {
You can’t perform that action at this time.
0 commit comments