File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -209,6 +209,10 @@ impl<'tcx, 'sess> TranslationCtx<'tcx> {
209209 def_id : DefId ,
210210 ty : Ty < ' tcx > ,
211211 ) -> Option < ( DefId , SubstsRef < ' tcx > ) > {
212+ if util:: is_open_ty_inv ( self . tcx , def_id) {
213+ return None ;
214+ }
215+
212216 debug ! ( "resolving type invariant of {ty:?} in {def_id:?}" ) ;
213217 let param_env = self . param_env ( def_id) ;
214218 let trait_did = self . get_diagnostic_item ( Symbol :: intern ( "creusot_invariant_method" ) ) ?;
Original file line number Diff line number Diff line change @@ -93,6 +93,10 @@ pub(crate) fn is_extern_spec(tcx: TyCtxt, def_id: DefId) -> bool {
9393 get_attr ( tcx. get_attrs_unchecked ( def_id) , & [ "creusot" , "extern_spec" ] ) . is_some ( )
9494}
9595
96+ pub ( crate ) fn is_open_ty_inv ( tcx : TyCtxt , def_id : DefId ) -> bool {
97+ get_attr ( tcx. get_attrs_unchecked ( def_id) , & [ "creusot" , "open_inv" ] ) . is_some ( )
98+ }
99+
96100pub ( crate ) fn is_type_invariant ( tcx : TyCtxt , def_id : DefId ) -> bool {
97101 let Some ( assoc_item) = tcx. opt_associated_item ( def_id) else { return false } ;
98102 let Some ( trait_item_did) = ( match assoc_item. container {
You can’t perform that action at this time.
0 commit comments