@@ -57,7 +57,7 @@ pub trait NonConstOp<'tcx>: std::fmt::Debug {
5757
5858/// A function call where the callee is a pointer.
5959#[ derive( Debug ) ]
60- pub struct FnCallIndirect ;
60+ pub ( crate ) struct FnCallIndirect ;
6161impl < ' tcx > NonConstOp < ' tcx > for FnCallIndirect {
6262 fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
6363 ccx. dcx ( ) . create_err ( errors:: UnallowedFnPointerCall { span, kind : ccx. const_kind ( ) } )
@@ -66,7 +66,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallIndirect {
6666
6767/// A function call where the callee is not marked as `const`.
6868#[ derive( Debug , Clone , Copy ) ]
69- pub struct FnCallNonConst < ' tcx > {
69+ pub ( crate ) struct FnCallNonConst < ' tcx > {
7070 pub caller : LocalDefId ,
7171 pub callee : DefId ,
7272 pub args : GenericArgsRef < ' tcx > ,
@@ -299,7 +299,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
299299///
300300/// Contains the name of the feature that would allow the use of this function.
301301#[ derive( Debug ) ]
302- pub struct FnCallUnstable ( pub DefId , pub Option < Symbol > ) ;
302+ pub ( crate ) struct FnCallUnstable ( pub DefId , pub Option < Symbol > ) ;
303303
304304impl < ' tcx > NonConstOp < ' tcx > for FnCallUnstable {
305305 fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
@@ -324,7 +324,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable {
324324}
325325
326326#[ derive( Debug ) ]
327- pub struct Coroutine ( pub hir:: CoroutineKind ) ;
327+ pub ( crate ) struct Coroutine ( pub hir:: CoroutineKind ) ;
328328impl < ' tcx > NonConstOp < ' tcx > for Coroutine {
329329 fn status_in_item ( & self , _: & ConstCx < ' _ , ' tcx > ) -> Status {
330330 if let hir:: CoroutineKind :: Desugared (
@@ -356,7 +356,7 @@ impl<'tcx> NonConstOp<'tcx> for Coroutine {
356356}
357357
358358#[ derive( Debug ) ]
359- pub struct HeapAllocation ;
359+ pub ( crate ) struct HeapAllocation ;
360360impl < ' tcx > NonConstOp < ' tcx > for HeapAllocation {
361361 fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
362362 ccx. dcx ( ) . create_err ( errors:: UnallowedHeapAllocations {
@@ -368,15 +368,15 @@ impl<'tcx> NonConstOp<'tcx> for HeapAllocation {
368368}
369369
370370#[ derive( Debug ) ]
371- pub struct InlineAsm ;
371+ pub ( crate ) struct InlineAsm ;
372372impl < ' tcx > NonConstOp < ' tcx > for InlineAsm {
373373 fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
374374 ccx. dcx ( ) . create_err ( errors:: UnallowedInlineAsm { span, kind : ccx. const_kind ( ) } )
375375 }
376376}
377377
378378#[ derive( Debug ) ]
379- pub struct LiveDrop < ' tcx > {
379+ pub ( crate ) struct LiveDrop < ' tcx > {
380380 pub dropped_at : Option < Span > ,
381381 pub dropped_ty : Ty < ' tcx > ,
382382}
@@ -394,7 +394,7 @@ impl<'tcx> NonConstOp<'tcx> for LiveDrop<'tcx> {
394394#[ derive( Debug ) ]
395395/// A borrow of a type that contains an `UnsafeCell` somewhere. The borrow never escapes to
396396/// the final value of the constant.
397- pub struct TransientCellBorrow ;
397+ pub ( crate ) struct TransientCellBorrow ;
398398impl < ' tcx > NonConstOp < ' tcx > for TransientCellBorrow {
399399 fn status_in_item ( & self , _: & ConstCx < ' _ , ' tcx > ) -> Status {
400400 Status :: Unstable ( sym:: const_refs_to_cell)
@@ -410,7 +410,7 @@ impl<'tcx> NonConstOp<'tcx> for TransientCellBorrow {
410410/// A borrow of a type that contains an `UnsafeCell` somewhere. The borrow might escape to
411411/// the final value of the constant, and thus we cannot allow this (for now). We may allow
412412/// it in the future for static items.
413- pub struct CellBorrow ;
413+ pub ( crate ) struct CellBorrow ;
414414impl < ' tcx > NonConstOp < ' tcx > for CellBorrow {
415415 fn importance ( & self ) -> DiagImportance {
416416 // Most likely the code will try to do mutation with these borrows, which
@@ -431,7 +431,7 @@ impl<'tcx> NonConstOp<'tcx> for CellBorrow {
431431/// This op is for `&mut` borrows in the trailing expression of a constant
432432/// which uses the "enclosing scopes rule" to leak its locals into anonymous
433433/// static or const items.
434- pub struct MutBorrow ( pub hir:: BorrowKind ) ;
434+ pub ( crate ) struct MutBorrow ( pub hir:: BorrowKind ) ;
435435
436436impl < ' tcx > NonConstOp < ' tcx > for MutBorrow {
437437 fn status_in_item ( & self , _ccx : & ConstCx < ' _ , ' tcx > ) -> Status {
@@ -461,7 +461,7 @@ impl<'tcx> NonConstOp<'tcx> for MutBorrow {
461461}
462462
463463#[ derive( Debug ) ]
464- pub struct TransientMutBorrow ( pub hir:: BorrowKind ) ;
464+ pub ( crate ) struct TransientMutBorrow ( pub hir:: BorrowKind ) ;
465465
466466impl < ' tcx > NonConstOp < ' tcx > for TransientMutBorrow {
467467 fn status_in_item ( & self , _: & ConstCx < ' _ , ' tcx > ) -> Status {
@@ -484,7 +484,7 @@ impl<'tcx> NonConstOp<'tcx> for TransientMutBorrow {
484484}
485485
486486#[ derive( Debug ) ]
487- pub struct MutDeref ;
487+ pub ( crate ) struct MutDeref ;
488488impl < ' tcx > NonConstOp < ' tcx > for MutDeref {
489489 fn status_in_item ( & self , _: & ConstCx < ' _ , ' tcx > ) -> Status {
490490 Status :: Unstable ( sym:: const_mut_refs)
@@ -505,7 +505,7 @@ impl<'tcx> NonConstOp<'tcx> for MutDeref {
505505
506506/// A call to a `panic()` lang item where the first argument is _not_ a `&str`.
507507#[ derive( Debug ) ]
508- pub struct PanicNonStr ;
508+ pub ( crate ) struct PanicNonStr ;
509509impl < ' tcx > NonConstOp < ' tcx > for PanicNonStr {
510510 fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
511511 ccx. dcx ( ) . create_err ( errors:: PanicNonStrErr { span } )
@@ -516,7 +516,7 @@ impl<'tcx> NonConstOp<'tcx> for PanicNonStr {
516516/// Not currently intended to ever be allowed, even behind a feature gate: operation depends on
517517/// allocation base addresses that are not known at compile-time.
518518#[ derive( Debug ) ]
519- pub struct RawPtrComparison ;
519+ pub ( crate ) struct RawPtrComparison ;
520520impl < ' tcx > NonConstOp < ' tcx > for RawPtrComparison {
521521 fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
522522 // FIXME(const_trait_impl): revert to span_bug?
@@ -525,7 +525,7 @@ impl<'tcx> NonConstOp<'tcx> for RawPtrComparison {
525525}
526526
527527#[ derive( Debug ) ]
528- pub struct RawMutPtrDeref ;
528+ pub ( crate ) struct RawMutPtrDeref ;
529529impl < ' tcx > NonConstOp < ' tcx > for RawMutPtrDeref {
530530 fn status_in_item ( & self , _: & ConstCx < ' _ , ' _ > ) -> Status {
531531 Status :: Unstable ( sym:: const_mut_refs)
@@ -546,7 +546,7 @@ impl<'tcx> NonConstOp<'tcx> for RawMutPtrDeref {
546546/// Not currently intended to ever be allowed, even behind a feature gate: operation depends on
547547/// allocation base addresses that are not known at compile-time.
548548#[ derive( Debug ) ]
549- pub struct RawPtrToIntCast ;
549+ pub ( crate ) struct RawPtrToIntCast ;
550550impl < ' tcx > NonConstOp < ' tcx > for RawPtrToIntCast {
551551 fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
552552 ccx. dcx ( ) . create_err ( errors:: RawPtrToIntErr { span } )
@@ -555,7 +555,7 @@ impl<'tcx> NonConstOp<'tcx> for RawPtrToIntCast {
555555
556556/// An access to a (non-thread-local) `static`.
557557#[ derive( Debug ) ]
558- pub struct StaticAccess ;
558+ pub ( crate ) struct StaticAccess ;
559559impl < ' tcx > NonConstOp < ' tcx > for StaticAccess {
560560 fn status_in_item ( & self , ccx : & ConstCx < ' _ , ' tcx > ) -> Status {
561561 if let hir:: ConstContext :: Static ( _) = ccx. const_kind ( ) {
@@ -582,19 +582,19 @@ impl<'tcx> NonConstOp<'tcx> for StaticAccess {
582582
583583/// An access to a thread-local `static`.
584584#[ derive( Debug ) ]
585- pub struct ThreadLocalAccess ;
585+ pub ( crate ) struct ThreadLocalAccess ;
586586impl < ' tcx > NonConstOp < ' tcx > for ThreadLocalAccess {
587587 fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
588588 ccx. dcx ( ) . create_err ( errors:: ThreadLocalAccessErr { span } )
589589 }
590590}
591591
592592/// Types that cannot appear in the signature or locals of a `const fn`.
593- pub mod mut_ref {
593+ pub ( crate ) mod mut_ref {
594594 use super :: * ;
595595
596596 #[ derive( Debug ) ]
597- pub struct MutRef ( pub mir:: LocalKind ) ;
597+ pub ( crate ) struct MutRef ( pub mir:: LocalKind ) ;
598598 impl < ' tcx > NonConstOp < ' tcx > for MutRef {
599599 fn status_in_item ( & self , _ccx : & ConstCx < ' _ , ' tcx > ) -> Status {
600600 Status :: Unstable ( sym:: const_mut_refs)
0 commit comments