@@ -16,7 +16,7 @@ use crate::ty::print::{FmtPrinter, Printer};
16
16
use crate :: ty:: subst:: { Subst , SubstsRef } ;
17
17
use crate :: ty:: {
18
18
self , AdtDef , CanonicalUserTypeAnnotations , Region , Ty , TyCtxt ,
19
- UserTypeAnnotationIndex ,
19
+ UserTypeAnnotationIndex , List ,
20
20
} ;
21
21
22
22
use polonius_engine:: Atom ;
@@ -50,7 +50,7 @@ pub mod traversal;
50
50
pub mod visit;
51
51
52
52
/// Types for locals
53
- type LocalDecls < ' tcx > = IndexVec < Local , LocalDecl < ' tcx > > ;
53
+ pub type LocalDecls < ' tcx > = IndexVec < Local , LocalDecl < ' tcx > > ;
54
54
55
55
pub trait HasLocalDecls < ' tcx > {
56
56
fn local_decls ( & self ) -> & LocalDecls < ' tcx > ;
@@ -3367,3 +3367,41 @@ impl<'tcx> TypeFoldable<'tcx> for Constant<'tcx> {
3367
3367
self . literal . visit_with ( visitor)
3368
3368
}
3369
3369
}
3370
+
3371
+ pub trait CustomIntrinsicMirGen : Sync + Send {
3372
+ /// Codegen a plugin-defined intrinsic. This is intended to be used to
3373
+ /// "return" values based on the monomorphized and erased types of the
3374
+ /// function call. Codegen will codegen the `extra_stmts` and then insert
3375
+ /// an unconditional branch to the exit block.
3376
+ ///
3377
+ /// Consider this to be highly unstable; it will likely change without
3378
+ /// warning. There is also no spec for this, it is 100% implementation
3379
+ /// defined, and may not be implemented at all for some codegen backends.
3380
+ ///
3381
+ /// If the codegen backend is multithreaded, this will be called from
3382
+ /// any number of threads, hence `Sync + Send`.
3383
+ ///
3384
+ /// YOU ARE RESPONSIBLE FOR THE SAFETY OF THE EXTRA STATEMENTS.
3385
+ /// You have been warned. Good luck, have fun.
3386
+ fn mirgen_simple_intrinsic < ' tcx > ( & self ,
3387
+ tcx : TyCtxt < ' tcx > ,
3388
+ instance : ty:: Instance < ' tcx > ,
3389
+ mir : & mut Body < ' tcx > ) ;
3390
+
3391
+ /// The following are used for typeck-ing:
3392
+
3393
+ /// The number of generic parameters expected.
3394
+ fn generic_parameter_count < ' tcx > ( & self , tcx : TyCtxt < ' tcx > ) -> usize ;
3395
+ /// The types of the input args.
3396
+ fn inputs < ' tcx > ( & self , tcx : TyCtxt < ' tcx > ) -> & ' tcx List < Ty < ' tcx > > ;
3397
+ /// The return type.
3398
+ fn output < ' tcx > ( & self , tcx : TyCtxt < ' tcx > ) -> Ty < ' tcx > ;
3399
+ }
3400
+
3401
+ /*impl<'a> HashStable<StableHashingContext<'a>> for dyn CustomIntrinsicMirGen {
3402
+ fn hash_stable<W: StableHasherResult>(&self,
3403
+ _ctx: &mut StableHashingContext<'_>,
3404
+ _hasher: &mut StableHasher<W>) {
3405
+ // TO DO
3406
+ }
3407
+ }*/
0 commit comments