@@ -98,20 +98,24 @@ use rustc::middle::const_eval::ConstVal;
98
98
use rustc_const_eval:: ConstInt ;
99
99
100
100
pub struct Scope < ' tcx > {
101
- // the scope-id within the scope_data_vec
101
+ /// the scope-id within the scope_data_vec
102
102
id : ScopeId ,
103
103
extent : CodeExtent ,
104
104
drops : Vec < DropData < ' tcx > > ,
105
105
106
- // A scope may only have one associated free, because:
107
- // 1. We require a `free` to only be scheduled in the scope of `EXPR` in `box EXPR`;
108
- // 2. It only makes sense to have it translated into the diverge-path.
109
- //
110
- // This kind of drop will be run *after* all the regular drops scheduled onto this scope,
111
- // because drops may have dependencies on the allocated memory.
112
- //
113
- // This is expected to go away once `box EXPR` becomes a sugar for placement protocol and gets
114
- // desugared in some earlier stage.
106
+ /// A scope may only have one associated free, because:
107
+ ///
108
+ /// 1. We require a `free` to only be scheduled in the scope of
109
+ /// `EXPR` in `box EXPR`;
110
+ /// 2. It only makes sense to have it translated into the diverge-path.
111
+ ///
112
+ /// This kind of drop will be run *after* all the regular drops
113
+ /// scheduled onto this scope, because drops may have dependencies
114
+ /// on the allocated memory.
115
+ ///
116
+ /// This is expected to go away once `box EXPR` becomes a sugar
117
+ /// for placement protocol and gets desugared in some earlier
118
+ /// stage.
115
119
free : Option < FreeData < ' tcx > > ,
116
120
117
121
/// The cached block for the cleanups-on-diverge path. This block
@@ -123,17 +127,21 @@ pub struct Scope<'tcx> {
123
127
}
124
128
125
129
struct DropData < ' tcx > {
130
+ /// span where drop obligation was incurred (typically where lvalue was declared)
126
131
span : Span ,
132
+
133
+ /// lvalue to drop
127
134
value : Lvalue < ' tcx > ,
128
- // NB: per-drop “cache” is necessary for the build_scope_drops function below.
129
135
130
- /// The cached block for the cleanups-on-diverge path. This block contains code to run the
131
- /// current drop and all the preceding drops (i.e. those having lower index in Drop’s
132
- /// Scope drop array)
136
+ /// The cached block for the cleanups-on-diverge path. This block
137
+ /// contains code to run the current drop and all the preceding
138
+ /// drops (i.e. those having lower index in Drop’s Scope drop
139
+ /// array)
133
140
cached_block : Option < BasicBlock >
134
141
}
135
142
136
143
struct FreeData < ' tcx > {
144
+ /// span where free obligation was incurred
137
145
span : Span ,
138
146
139
147
/// Lvalue containing the allocated box.
0 commit comments