@@ -22,7 +22,6 @@ use rustc_hir::{
22
22
ImplicitSelfKind ,
23
23
} ;
24
24
use rustc_session:: Session ;
25
- use rustc_span:: source_map:: Spanned ;
26
25
use rustc_target:: abi:: { FieldIdx , VariantIdx } ;
27
26
28
27
use polonius_engine:: Atom ;
@@ -61,6 +60,7 @@ pub mod mono;
61
60
pub mod patch;
62
61
pub mod pretty;
63
62
mod query;
63
+ mod required_items;
64
64
mod statement;
65
65
mod syntax;
66
66
pub mod tcx;
@@ -77,6 +77,7 @@ pub use self::pretty::{
77
77
} ;
78
78
pub use consts:: * ;
79
79
use pretty:: pretty_print_const_value;
80
+ pub use required_items:: { MentionedItem , RequiredAndMentionedItems } ;
80
81
pub use statement:: * ;
81
82
pub use syntax:: * ;
82
83
pub use terminator:: * ;
@@ -308,21 +309,6 @@ impl<'tcx> CoroutineInfo<'tcx> {
308
309
}
309
310
}
310
311
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
-
326
312
/// The lowered representation of a single function.
327
313
#[ derive( Clone , TyEncodable , TyDecodable , Debug , HashStable , TypeFoldable , TypeVisitable ) ]
328
314
pub struct Body < ' tcx > {
@@ -384,26 +370,6 @@ pub struct Body<'tcx> {
384
370
/// A span representing this MIR, for error reporting.
385
371
pub span : Span ,
386
372
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
-
407
373
/// Does this body use generic parameters. This is used for the `ConstEvaluatable` check.
408
374
///
409
375
/// Note that this does not actually mean that this body is not computable right now.
@@ -479,8 +445,6 @@ impl<'tcx> Body<'tcx> {
479
445
spread_arg : None ,
480
446
var_debug_info,
481
447
span,
482
- required_consts : Vec :: new ( ) ,
483
- mentioned_items : Vec :: new ( ) ,
484
448
is_polymorphic : false ,
485
449
injection_phase : None ,
486
450
tainted_by_errors,
@@ -509,8 +473,6 @@ impl<'tcx> Body<'tcx> {
509
473
arg_count : 0 ,
510
474
spread_arg : None ,
511
475
span : DUMMY_SP ,
512
- required_consts : Vec :: new ( ) ,
513
- mentioned_items : Vec :: new ( ) ,
514
476
var_debug_info : Vec :: new ( ) ,
515
477
is_polymorphic : false ,
516
478
injection_phase : None ,
0 commit comments