Skip to content

Commit c1a53a6

Browse files
committed
Address nit: doc-comments on fields
1 parent a2bab6f commit c1a53a6

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

src/librustc_mir/build/scope.rs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,24 @@ use rustc::middle::const_eval::ConstVal;
9898
use rustc_const_eval::ConstInt;
9999

100100
pub struct Scope<'tcx> {
101-
// the scope-id within the scope_data_vec
101+
/// the scope-id within the scope_data_vec
102102
id: ScopeId,
103103
extent: CodeExtent,
104104
drops: Vec<DropData<'tcx>>,
105105

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.
115119
free: Option<FreeData<'tcx>>,
116120

117121
/// The cached block for the cleanups-on-diverge path. This block
@@ -123,17 +127,21 @@ pub struct Scope<'tcx> {
123127
}
124128

125129
struct DropData<'tcx> {
130+
/// span where drop obligation was incurred (typically where lvalue was declared)
126131
span: Span,
132+
133+
/// lvalue to drop
127134
value: Lvalue<'tcx>,
128-
// NB: per-drop “cache” is necessary for the build_scope_drops function below.
129135

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)
133140
cached_block: Option<BasicBlock>
134141
}
135142

136143
struct FreeData<'tcx> {
144+
/// span where free obligation was incurred
137145
span: Span,
138146

139147
/// Lvalue containing the allocated box.

0 commit comments

Comments
 (0)