@@ -4,7 +4,7 @@ use std::collections::HashSet;
44
55use rustc_hir:: def_id:: CRATE_DEF_ID ;
66use rustc_middle:: ty:: { self as mir_ty, TyCtxt } ;
7- use rustc_span:: def_id:: { DefId , LocalDefId } ;
7+ use rustc_span:: def_id:: LocalDefId ;
88
99use crate :: analyze;
1010use crate :: chc;
@@ -23,8 +23,8 @@ use crate::rty::{self, ClauseBuilderExt as _};
2323pub struct Analyzer < ' tcx , ' ctx > {
2424 tcx : TyCtxt < ' tcx > ,
2525 ctx : & ' ctx mut analyze:: Analyzer < ' tcx > ,
26- trusted : HashSet < DefId > ,
27- predicates : HashSet < DefId > ,
26+
27+ skip_analysis : HashSet < LocalDefId > ,
2828}
2929
3030impl < ' tcx , ' ctx > Analyzer < ' tcx , ' ctx > {
@@ -75,17 +75,23 @@ impl<'tcx, 'ctx> Analyzer<'tcx, 'ctx> {
7575
7676 if analyzer. is_annotated_as_trusted ( ) {
7777 assert ! ( analyzer. is_fully_annotated( ) ) ;
78- self . trusted . insert ( local_def_id. to_def_id ( ) ) ;
78+ self . skip_analysis . insert ( local_def_id) ;
7979 }
8080
8181 if analyzer. is_annotated_as_extern_spec_fn ( ) {
8282 assert ! ( analyzer. is_fully_annotated( ) ) ;
83- self . trusted . insert ( local_def_id. to_def_id ( ) ) ;
83+ self . skip_analysis . insert ( local_def_id) ;
84+ }
85+
86+ if analyzer. is_annotated_as_ignored ( ) {
87+ self . skip_analysis . insert ( local_def_id) ;
88+ return ;
8489 }
8590
8691 if analyzer. is_annotated_as_predicate ( ) {
87- self . predicates . insert ( local_def_id. to_def_id ( ) ) ;
8892 analyzer. analyze_predicate_definition ( local_def_id) ;
93+ self . skip_analysis . insert ( local_def_id) ;
94+ return ;
8995 }
9096
9197 use mir_ty:: TypeVisitableExt as _;
@@ -107,14 +113,10 @@ impl<'tcx, 'ctx> Analyzer<'tcx, 'ctx> {
107113 if !self . tcx . def_kind ( * local_def_id) . is_fn_like ( ) {
108114 continue ;
109115 } ;
110- if self . trusted . contains ( & local_def_id. to_def_id ( ) ) {
111- tracing:: info!( ?local_def_id, "trusted" ) ;
112- continue ;
113- }
114- if self . predicates . contains ( & local_def_id. to_def_id ( ) ) {
115- tracing:: info!( ?local_def_id, "predicate" ) ;
116+ if self . skip_analysis . contains ( local_def_id) {
116117 continue ;
117118 }
119+
118120 let Some ( expected) = self . ctx . concrete_def_ty ( local_def_id. to_def_id ( ) ) else {
119121 // when the local_def_id is deferred it would be skipped
120122 continue ;
@@ -221,13 +223,11 @@ impl<'tcx, 'ctx> Analyzer<'tcx, 'ctx> {
221223impl < ' tcx , ' ctx > Analyzer < ' tcx , ' ctx > {
222224 pub fn new ( ctx : & ' ctx mut analyze:: Analyzer < ' tcx > ) -> Self {
223225 let tcx = ctx. tcx ;
224- let trusted = HashSet :: default ( ) ;
225- let predicates = HashSet :: default ( ) ;
226+ let skip_analysis = HashSet :: default ( ) ;
226227 Self {
227228 ctx,
228229 tcx,
229- trusted,
230- predicates,
230+ skip_analysis,
231231 }
232232 }
233233
0 commit comments