Skip to content

Commit 59d35ff

Browse files
committed
Fix misleading comments
1 parent 74834c7 commit 59d35ff

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/ir/analysis/derive_copy.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveCopy<'ctx, 'gen> {
202202
// default, the may have an explicit destructor in C++, so we can't
203203
// defer this check just for the union case.
204204
if info.has_destructor(self.ctx) {
205-
trace!(" comp has destructor which cannot derive copy");
205+
trace!(" comp has destructor which cannot derive Copy");
206206
return self.insert(id);
207207
}
208208

@@ -211,7 +211,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveCopy<'ctx, 'gen> {
211211
// NOTE: If there's no template parameters we can derive copy
212212
// unconditionally, since arrays are magical for rustc, and
213213
// __BindgenUnionField always implements copy.
214-
trace!(" comp can always derive debug if it's a Union and no template parameters");
214+
trace!(" comp can always derive Copy if it's a Union and no template parameters");
215215
return ConstrainResult::Same
216216
}
217217

src/ir/analysis/derive_default.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct CannotDeriveDefault<'ctx, 'gen>
3636
ctx: &'ctx BindgenContext<'gen>,
3737

3838
// The incremental result of this analysis's computation. Everything in this
39-
// set cannot derive debug.
39+
// set cannot derive default.
4040
cannot_derive_default: HashSet<ItemId>,
4141

4242
// Dependencies saying that if a key ItemId has been inserted into the
@@ -45,15 +45,15 @@ pub struct CannotDeriveDefault<'ctx, 'gen>
4545
//
4646
// This is a subset of the natural IR graph with reversed edges, where we
4747
// only include the edges from the IR graph that can affect whether a type
48-
// can derive debug or not.
48+
// can derive default or not.
4949
dependencies: HashMap<ItemId, Vec<ItemId>>,
5050
}
5151

5252
impl<'ctx, 'gen> CannotDeriveDefault<'ctx, 'gen> {
5353
fn consider_edge(kind: EdgeKind) -> bool {
5454
match kind {
5555
// These are the only edges that can affect whether a type can derive
56-
// debug or not.
56+
// default or not.
5757
EdgeKind::BaseMember |
5858
EdgeKind::Field |
5959
EdgeKind::TypeReference |
@@ -181,7 +181,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveDefault<'ctx, 'gen> {
181181
}
182182

183183
match *ty.kind() {
184-
// Handle the simple cases. These can derive debug without further
184+
// Handle the simple cases. These can derive Default without further
185185
// information.
186186
TypeKind::Function(..) |
187187
TypeKind::Int(..) |

src/ir/analysis/has_type_param_in_array.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ pub struct HasTypeParameterInArray<'ctx, 'gen>
4545
impl<'ctx, 'gen> HasTypeParameterInArray<'ctx, 'gen> {
4646
fn consider_edge(kind: EdgeKind) -> bool {
4747
match kind {
48-
// These are the only edges that can affect whether a type can derive
49-
// debug or not.
48+
// These are the only edges that can affect whether a type has type parameter
49+
// in array or not.
5050
EdgeKind::BaseMember |
5151
EdgeKind::Field |
5252
EdgeKind::TypeReference |
@@ -119,8 +119,8 @@ impl<'ctx, 'gen> MonotoneFramework for HasTypeParameterInArray<'ctx, 'gen> {
119119
};
120120

121121
match *ty.kind() {
122-
// Handle the simple cases. These can derive copy without further
123-
// information.
122+
// Handle the simple cases. These cannot have array in type parameter
123+
// without further information.
124124
TypeKind::Void |
125125
TypeKind::NullPtr |
126126
TypeKind::Int(..) |

src/ir/context.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,13 @@ pub struct BindgenContext<'ctx> {
185185

186186
/// The set of (`ItemId`s of) types that can't derive debug.
187187
///
188-
/// This is populated when we enter codegen by `compute_can_derive_debug`
188+
/// This is populated when we enter codegen by `compute_cannot_derive_debug`
189189
/// and is always `None` before that and `Some` after.
190190
cannot_derive_debug: Option<HashSet<ItemId>>,
191191

192192
/// The set of (`ItemId`s of) types that can't derive default.
193193
///
194-
/// This is populated when we enter codegen by `compute_can_derive_default`
194+
/// This is populated when we enter codegen by `compute_cannot_derive_default`
195195
/// and is always `None` before that and `Some` after.
196196
cannot_derive_default: Option<HashSet<ItemId>>,
197197

@@ -1839,7 +1839,7 @@ impl<'ctx> BindgenContext<'ctx> {
18391839
!self.cannot_derive_default.as_ref().unwrap().contains(&id)
18401840
}
18411841

1842-
/// Compute whether we can derive debug.
1842+
/// Compute whether we can derive copy.
18431843
fn compute_cannot_derive_copy(&mut self) {
18441844
assert!(self.cannot_derive_copy.is_none());
18451845
self.cannot_derive_copy = Some(analyze::<CannotDeriveCopy>(self));
@@ -1864,7 +1864,7 @@ impl<'ctx> BindgenContext<'ctx> {
18641864
!self.cannot_derive_hash.as_ref().unwrap().contains(&id)
18651865
}
18661866

1867-
/// Compute whether we can derive hash.
1867+
/// Compute whether we can derive partialeq.
18681868
fn compute_cannot_derive_partialeq(&mut self) {
18691869
assert!(self.cannot_derive_partialeq.is_none());
18701870
if self.options.derive_partialeq {
@@ -1895,19 +1895,19 @@ impl<'ctx> BindgenContext<'ctx> {
18951895
!self.cannot_derive_copy.as_ref().unwrap().contains(&id)
18961896
}
18971897

1898-
/// Compute whether the type has array.
1898+
/// Compute whether the type has type parameter in array.
18991899
fn compute_has_type_param_in_array(&mut self) {
19001900
assert!(self.has_type_param_in_array.is_none());
19011901
self.has_type_param_in_array = Some(analyze::<HasTypeParameterInArray>(self));
19021902
}
19031903

1904-
/// Look up whether the item with `id` has array or not.
1904+
/// Look up whether the item with `id` has type parameter in array or not.
19051905
pub fn lookup_item_id_has_type_param_in_array(&self, id: &ItemId) -> bool {
19061906
assert!(self.in_codegen_phase(),
19071907
"We only compute has array when we enter codegen");
19081908

19091909
// Look up the computed value for whether the item with `id` has
1910-
// array or not.
1910+
// type parameter in array or not.
19111911
self.has_type_param_in_array.as_ref().unwrap().contains(id)
19121912
}
19131913
}

0 commit comments

Comments
 (0)