@@ -22,7 +22,6 @@ use rustc_hir::{
2222 ImplicitSelfKind ,
2323} ;
2424use rustc_session:: Session ;
25- use rustc_span:: source_map:: Spanned ;
2625use rustc_target:: abi:: { FieldIdx , VariantIdx } ;
2726
2827use polonius_engine:: Atom ;
@@ -61,6 +60,7 @@ pub mod mono;
6160pub mod patch;
6261pub mod pretty;
6362mod query;
63+ mod required_items;
6464mod statement;
6565mod syntax;
6666pub mod tcx;
@@ -77,6 +77,7 @@ pub use self::pretty::{
7777} ;
7878pub use consts:: * ;
7979use pretty:: pretty_print_const_value;
80+ pub use required_items:: { MentionedItem , RequiredAndMentionedItems } ;
8081pub use statement:: * ;
8182pub use syntax:: * ;
8283pub use terminator:: * ;
@@ -308,21 +309,6 @@ impl<'tcx> CoroutineInfo<'tcx> {
308309 }
309310}
310311
311- /// Some item that needs to monomorphize successfully for a MIR body to be considered well-formed.
312- #[ derive( Copy , Clone , PartialEq , Eq , Debug , Hash , HashStable , TyEncodable , TyDecodable ) ]
313- #[ derive( TypeFoldable , TypeVisitable ) ]
314- pub enum MentionedItem < ' tcx > {
315- /// A function that gets called. We don't necessarily know its precise type yet, since it can be
316- /// hidden behind a generic.
317- Fn ( Ty < ' tcx > ) ,
318- /// A type that has its drop shim called.
319- Drop ( Ty < ' tcx > ) ,
320- /// Unsizing casts might require vtables, so we have to record them.
321- UnsizeCast { source_ty : Ty < ' tcx > , target_ty : Ty < ' tcx > } ,
322- /// A closure that is coerced to a function pointer.
323- Closure ( Ty < ' tcx > ) ,
324- }
325-
326312/// The lowered representation of a single function.
327313#[ derive( Clone , TyEncodable , TyDecodable , Debug , HashStable , TypeFoldable , TypeVisitable ) ]
328314pub struct Body < ' tcx > {
@@ -384,26 +370,6 @@ pub struct Body<'tcx> {
384370 /// A span representing this MIR, for error reporting.
385371 pub span : Span ,
386372
387- /// Constants that are required to evaluate successfully for this MIR to be well-formed.
388- /// We hold in this field all the constants we are not able to evaluate yet.
389- ///
390- /// This is soundness-critical, we make a guarantee that all consts syntactically mentioned in a
391- /// function have successfully evaluated if the function ever gets executed at runtime.
392- pub required_consts : Vec < ConstOperand < ' tcx > > ,
393-
394- /// Further items that were mentioned in this function and hence *may* become monomorphized,
395- /// depending on optimizations. We use this to avoid optimization-dependent compile errors: the
396- /// collector recursively traverses all "mentioned" items and evaluates all their
397- /// `required_consts`.
398- ///
399- /// This is *not* soundness-critical and the contents of this list are *not* a stable guarantee.
400- /// All that's relevant is that this set is optimization-level-independent, and that it includes
401- /// everything that the collector would consider "used". (For example, we currently compute this
402- /// set after drop elaboration, so some drop calls that can never be reached are not considered
403- /// "mentioned".) See the documentation of `CollectionMode` in
404- /// `compiler/rustc_monomorphize/src/collector.rs` for more context.
405- pub mentioned_items : Vec < Spanned < MentionedItem < ' tcx > > > ,
406-
407373 /// Does this body use generic parameters. This is used for the `ConstEvaluatable` check.
408374 ///
409375 /// Note that this does not actually mean that this body is not computable right now.
@@ -479,8 +445,6 @@ impl<'tcx> Body<'tcx> {
479445 spread_arg : None ,
480446 var_debug_info,
481447 span,
482- required_consts : Vec :: new ( ) ,
483- mentioned_items : Vec :: new ( ) ,
484448 is_polymorphic : false ,
485449 injection_phase : None ,
486450 tainted_by_errors,
@@ -509,8 +473,6 @@ impl<'tcx> Body<'tcx> {
509473 arg_count : 0 ,
510474 spread_arg : None ,
511475 span : DUMMY_SP ,
512- required_consts : Vec :: new ( ) ,
513- mentioned_items : Vec :: new ( ) ,
514476 var_debug_info : Vec :: new ( ) ,
515477 is_polymorphic : false ,
516478 injection_phase : None ,
0 commit comments