File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,14 @@ impl<'tcx> Context for Tables<'tcx> {
4242 Some ( self . crate_item ( self . tcx . entry_fn ( ( ) ) ?. 0 ) )
4343 }
4444
45+ fn all_trait_decls ( & mut self ) -> stable_mir:: TraitDecls {
46+ self . tcx
47+ . traits ( LOCAL_CRATE )
48+ . iter ( )
49+ . map ( |trait_def_id| self . trait_def ( * trait_def_id) )
50+ . collect ( )
51+ }
52+
4553 fn trait_decl ( & mut self , trait_def : & stable_mir:: ty:: TraitDef ) -> stable_mir:: ty:: TraitDecl {
4654 let def_id = self . trait_def_id ( trait_def) ;
4755 let trait_def = self . tcx . trait_def ( def_id) ;
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ pub type DefId = usize;
3232/// A list of crate items.
3333pub type CrateItems = Vec < CrateItem > ;
3434
35+ /// A list of crate items.
36+ pub type TraitDecls = Vec < TraitDef > ;
37+
3538/// Holds information about a crate.
3639#[ derive( Clone , PartialEq , Eq , Debug ) ]
3740pub struct Crate {
@@ -84,6 +87,7 @@ pub trait Context {
8487 /// Retrieve all items of the local crate that have a MIR associated with them.
8588 fn all_local_items ( & mut self ) -> CrateItems ;
8689 fn mir_body ( & mut self , item : & CrateItem ) -> mir:: Body ;
90+ fn all_trait_decls ( & mut self ) -> TraitDecls ;
8791 fn trait_decl ( & mut self , trait_def : & TraitDef ) -> TraitDecl ;
8892 /// Get information about the local crate.
8993 fn local_crate ( & self ) -> Crate ;
You can’t perform that action at this time.
0 commit comments