@@ -57,7 +57,7 @@ pub trait NonConstOp<'tcx>: std::fmt::Debug {
57
57
58
58
/// A function call where the callee is a pointer.
59
59
#[ derive( Debug ) ]
60
- pub struct FnCallIndirect ;
60
+ pub ( crate ) struct FnCallIndirect ;
61
61
impl < ' tcx > NonConstOp < ' tcx > for FnCallIndirect {
62
62
fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
63
63
ccx. dcx ( ) . create_err ( errors:: UnallowedFnPointerCall { span, kind : ccx. const_kind ( ) } )
@@ -66,7 +66,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallIndirect {
66
66
67
67
/// A function call where the callee is not marked as `const`.
68
68
#[ derive( Debug , Clone , Copy ) ]
69
- pub struct FnCallNonConst < ' tcx > {
69
+ pub ( crate ) struct FnCallNonConst < ' tcx > {
70
70
pub caller : LocalDefId ,
71
71
pub callee : DefId ,
72
72
pub args : GenericArgsRef < ' tcx > ,
@@ -299,7 +299,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
299
299
///
300
300
/// Contains the name of the feature that would allow the use of this function.
301
301
#[ derive( Debug ) ]
302
- pub struct FnCallUnstable ( pub DefId , pub Option < Symbol > ) ;
302
+ pub ( crate ) struct FnCallUnstable ( pub DefId , pub Option < Symbol > ) ;
303
303
304
304
impl < ' tcx > NonConstOp < ' tcx > for FnCallUnstable {
305
305
fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
@@ -324,7 +324,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable {
324
324
}
325
325
326
326
#[ derive( Debug ) ]
327
- pub struct Coroutine ( pub hir:: CoroutineKind ) ;
327
+ pub ( crate ) struct Coroutine ( pub hir:: CoroutineKind ) ;
328
328
impl < ' tcx > NonConstOp < ' tcx > for Coroutine {
329
329
fn status_in_item ( & self , _: & ConstCx < ' _ , ' tcx > ) -> Status {
330
330
if let hir:: CoroutineKind :: Desugared (
@@ -356,7 +356,7 @@ impl<'tcx> NonConstOp<'tcx> for Coroutine {
356
356
}
357
357
358
358
#[ derive( Debug ) ]
359
- pub struct HeapAllocation ;
359
+ pub ( crate ) struct HeapAllocation ;
360
360
impl < ' tcx > NonConstOp < ' tcx > for HeapAllocation {
361
361
fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
362
362
ccx. dcx ( ) . create_err ( errors:: UnallowedHeapAllocations {
@@ -368,15 +368,15 @@ impl<'tcx> NonConstOp<'tcx> for HeapAllocation {
368
368
}
369
369
370
370
#[ derive( Debug ) ]
371
- pub struct InlineAsm ;
371
+ pub ( crate ) struct InlineAsm ;
372
372
impl < ' tcx > NonConstOp < ' tcx > for InlineAsm {
373
373
fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
374
374
ccx. dcx ( ) . create_err ( errors:: UnallowedInlineAsm { span, kind : ccx. const_kind ( ) } )
375
375
}
376
376
}
377
377
378
378
#[ derive( Debug ) ]
379
- pub struct LiveDrop < ' tcx > {
379
+ pub ( crate ) struct LiveDrop < ' tcx > {
380
380
pub dropped_at : Option < Span > ,
381
381
pub dropped_ty : Ty < ' tcx > ,
382
382
}
@@ -394,7 +394,7 @@ impl<'tcx> NonConstOp<'tcx> for LiveDrop<'tcx> {
394
394
#[ derive( Debug ) ]
395
395
/// A borrow of a type that contains an `UnsafeCell` somewhere. The borrow never escapes to
396
396
/// the final value of the constant.
397
- pub struct TransientCellBorrow ;
397
+ pub ( crate ) struct TransientCellBorrow ;
398
398
impl < ' tcx > NonConstOp < ' tcx > for TransientCellBorrow {
399
399
fn status_in_item ( & self , _: & ConstCx < ' _ , ' tcx > ) -> Status {
400
400
Status :: Unstable ( sym:: const_refs_to_cell)
@@ -410,7 +410,7 @@ impl<'tcx> NonConstOp<'tcx> for TransientCellBorrow {
410
410
/// A borrow of a type that contains an `UnsafeCell` somewhere. The borrow might escape to
411
411
/// the final value of the constant, and thus we cannot allow this (for now). We may allow
412
412
/// it in the future for static items.
413
- pub struct CellBorrow ;
413
+ pub ( crate ) struct CellBorrow ;
414
414
impl < ' tcx > NonConstOp < ' tcx > for CellBorrow {
415
415
fn importance ( & self ) -> DiagImportance {
416
416
// Most likely the code will try to do mutation with these borrows, which
@@ -431,7 +431,7 @@ impl<'tcx> NonConstOp<'tcx> for CellBorrow {
431
431
/// This op is for `&mut` borrows in the trailing expression of a constant
432
432
/// which uses the "enclosing scopes rule" to leak its locals into anonymous
433
433
/// static or const items.
434
- pub struct MutBorrow ( pub hir:: BorrowKind ) ;
434
+ pub ( crate ) struct MutBorrow ( pub hir:: BorrowKind ) ;
435
435
436
436
impl < ' tcx > NonConstOp < ' tcx > for MutBorrow {
437
437
fn status_in_item ( & self , _ccx : & ConstCx < ' _ , ' tcx > ) -> Status {
@@ -461,7 +461,7 @@ impl<'tcx> NonConstOp<'tcx> for MutBorrow {
461
461
}
462
462
463
463
#[ derive( Debug ) ]
464
- pub struct TransientMutBorrow ( pub hir:: BorrowKind ) ;
464
+ pub ( crate ) struct TransientMutBorrow ( pub hir:: BorrowKind ) ;
465
465
466
466
impl < ' tcx > NonConstOp < ' tcx > for TransientMutBorrow {
467
467
fn status_in_item ( & self , _: & ConstCx < ' _ , ' tcx > ) -> Status {
@@ -484,7 +484,7 @@ impl<'tcx> NonConstOp<'tcx> for TransientMutBorrow {
484
484
}
485
485
486
486
#[ derive( Debug ) ]
487
- pub struct MutDeref ;
487
+ pub ( crate ) struct MutDeref ;
488
488
impl < ' tcx > NonConstOp < ' tcx > for MutDeref {
489
489
fn status_in_item ( & self , _: & ConstCx < ' _ , ' tcx > ) -> Status {
490
490
Status :: Unstable ( sym:: const_mut_refs)
@@ -505,7 +505,7 @@ impl<'tcx> NonConstOp<'tcx> for MutDeref {
505
505
506
506
/// A call to a `panic()` lang item where the first argument is _not_ a `&str`.
507
507
#[ derive( Debug ) ]
508
- pub struct PanicNonStr ;
508
+ pub ( crate ) struct PanicNonStr ;
509
509
impl < ' tcx > NonConstOp < ' tcx > for PanicNonStr {
510
510
fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
511
511
ccx. dcx ( ) . create_err ( errors:: PanicNonStrErr { span } )
@@ -516,7 +516,7 @@ impl<'tcx> NonConstOp<'tcx> for PanicNonStr {
516
516
/// Not currently intended to ever be allowed, even behind a feature gate: operation depends on
517
517
/// allocation base addresses that are not known at compile-time.
518
518
#[ derive( Debug ) ]
519
- pub struct RawPtrComparison ;
519
+ pub ( crate ) struct RawPtrComparison ;
520
520
impl < ' tcx > NonConstOp < ' tcx > for RawPtrComparison {
521
521
fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
522
522
// FIXME(const_trait_impl): revert to span_bug?
@@ -525,7 +525,7 @@ impl<'tcx> NonConstOp<'tcx> for RawPtrComparison {
525
525
}
526
526
527
527
#[ derive( Debug ) ]
528
- pub struct RawMutPtrDeref ;
528
+ pub ( crate ) struct RawMutPtrDeref ;
529
529
impl < ' tcx > NonConstOp < ' tcx > for RawMutPtrDeref {
530
530
fn status_in_item ( & self , _: & ConstCx < ' _ , ' _ > ) -> Status {
531
531
Status :: Unstable ( sym:: const_mut_refs)
@@ -546,7 +546,7 @@ impl<'tcx> NonConstOp<'tcx> for RawMutPtrDeref {
546
546
/// Not currently intended to ever be allowed, even behind a feature gate: operation depends on
547
547
/// allocation base addresses that are not known at compile-time.
548
548
#[ derive( Debug ) ]
549
- pub struct RawPtrToIntCast ;
549
+ pub ( crate ) struct RawPtrToIntCast ;
550
550
impl < ' tcx > NonConstOp < ' tcx > for RawPtrToIntCast {
551
551
fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
552
552
ccx. dcx ( ) . create_err ( errors:: RawPtrToIntErr { span } )
@@ -555,7 +555,7 @@ impl<'tcx> NonConstOp<'tcx> for RawPtrToIntCast {
555
555
556
556
/// An access to a (non-thread-local) `static`.
557
557
#[ derive( Debug ) ]
558
- pub struct StaticAccess ;
558
+ pub ( crate ) struct StaticAccess ;
559
559
impl < ' tcx > NonConstOp < ' tcx > for StaticAccess {
560
560
fn status_in_item ( & self , ccx : & ConstCx < ' _ , ' tcx > ) -> Status {
561
561
if let hir:: ConstContext :: Static ( _) = ccx. const_kind ( ) {
@@ -582,19 +582,19 @@ impl<'tcx> NonConstOp<'tcx> for StaticAccess {
582
582
583
583
/// An access to a thread-local `static`.
584
584
#[ derive( Debug ) ]
585
- pub struct ThreadLocalAccess ;
585
+ pub ( crate ) struct ThreadLocalAccess ;
586
586
impl < ' tcx > NonConstOp < ' tcx > for ThreadLocalAccess {
587
587
fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
588
588
ccx. dcx ( ) . create_err ( errors:: ThreadLocalAccessErr { span } )
589
589
}
590
590
}
591
591
592
592
/// Types that cannot appear in the signature or locals of a `const fn`.
593
- pub mod mut_ref {
593
+ pub ( crate ) mod mut_ref {
594
594
use super :: * ;
595
595
596
596
#[ derive( Debug ) ]
597
- pub struct MutRef ( pub mir:: LocalKind ) ;
597
+ pub ( crate ) struct MutRef ( pub mir:: LocalKind ) ;
598
598
impl < ' tcx > NonConstOp < ' tcx > for MutRef {
599
599
fn status_in_item ( & self , _ccx : & ConstCx < ' _ , ' tcx > ) -> Status {
600
600
Status :: Unstable ( sym:: const_mut_refs)
0 commit comments