summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhiting Zhu <zhitingz@cs.utexas.edu>2017-08-16 21:42:31 -0500
committerZhiting Zhu <zhitingz@cs.utexas.edu>2017-08-16 21:42:31 -0500
commit59d35ffdac4f3ca51083fcb21023db197f208347 (patch)
treee2d2cc4a9d3572aee5341c72bd420e8f67602e99
parent74834c70f50648972e4bb0d48837f180428c1447 (diff)
Fix misleading comments
-rw-r--r--src/ir/analysis/derive_copy.rs4
-rw-r--r--src/ir/analysis/derive_default.rs8
-rw-r--r--src/ir/analysis/has_type_param_in_array.rs8
-rw-r--r--src/ir/context.rs14
4 files changed, 17 insertions, 17 deletions
diff --git a/src/ir/analysis/derive_copy.rs b/src/ir/analysis/derive_copy.rs
index dfd0343c..91acad68 100644
--- a/src/ir/analysis/derive_copy.rs
+++ b/src/ir/analysis/derive_copy.rs
@@ -202,7 +202,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveCopy<'ctx, 'gen> {
// default, the may have an explicit destructor in C++, so we can't
// defer this check just for the union case.
if info.has_destructor(self.ctx) {
- trace!(" comp has destructor which cannot derive copy");
+ trace!(" comp has destructor which cannot derive Copy");
return self.insert(id);
}
@@ -211,7 +211,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveCopy<'ctx, 'gen> {
// NOTE: If there's no template parameters we can derive copy
// unconditionally, since arrays are magical for rustc, and
// __BindgenUnionField always implements copy.
- trace!(" comp can always derive debug if it's a Union and no template parameters");
+ trace!(" comp can always derive Copy if it's a Union and no template parameters");
return ConstrainResult::Same
}
diff --git a/src/ir/analysis/derive_default.rs b/src/ir/analysis/derive_default.rs
index 4c2cad25..dd837f8c 100644
--- a/src/ir/analysis/derive_default.rs
+++ b/src/ir/analysis/derive_default.rs
@@ -36,7 +36,7 @@ pub struct CannotDeriveDefault<'ctx, 'gen>
ctx: &'ctx BindgenContext<'gen>,
// The incremental result of this analysis's computation. Everything in this
- // set cannot derive debug.
+ // set cannot derive default.
cannot_derive_default: HashSet<ItemId>,
// Dependencies saying that if a key ItemId has been inserted into the
@@ -45,7 +45,7 @@ pub struct CannotDeriveDefault<'ctx, 'gen>
//
// This is a subset of the natural IR graph with reversed edges, where we
// only include the edges from the IR graph that can affect whether a type
- // can derive debug or not.
+ // can derive default or not.
dependencies: HashMap<ItemId, Vec<ItemId>>,
}
@@ -53,7 +53,7 @@ impl<'ctx, 'gen> CannotDeriveDefault<'ctx, 'gen> {
fn consider_edge(kind: EdgeKind) -> bool {
match kind {
// These are the only edges that can affect whether a type can derive
- // debug or not.
+ // default or not.
EdgeKind::BaseMember |
EdgeKind::Field |
EdgeKind::TypeReference |
@@ -181,7 +181,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveDefault<'ctx, 'gen> {
}
match *ty.kind() {
- // Handle the simple cases. These can derive debug without further
+ // Handle the simple cases. These can derive Default without further
// information.
TypeKind::Function(..) |
TypeKind::Int(..) |
diff --git a/src/ir/analysis/has_type_param_in_array.rs b/src/ir/analysis/has_type_param_in_array.rs
index b141dd64..3537949f 100644
--- a/src/ir/analysis/has_type_param_in_array.rs
+++ b/src/ir/analysis/has_type_param_in_array.rs
@@ -45,8 +45,8 @@ pub struct HasTypeParameterInArray<'ctx, 'gen>
impl<'ctx, 'gen> HasTypeParameterInArray<'ctx, 'gen> {
fn consider_edge(kind: EdgeKind) -> bool {
match kind {
- // These are the only edges that can affect whether a type can derive
- // debug or not.
+ // These are the only edges that can affect whether a type has type parameter
+ // in array or not.
EdgeKind::BaseMember |
EdgeKind::Field |
EdgeKind::TypeReference |
@@ -119,8 +119,8 @@ impl<'ctx, 'gen> MonotoneFramework for HasTypeParameterInArray<'ctx, 'gen> {
};
match *ty.kind() {
- // Handle the simple cases. These can derive copy without further
- // information.
+ // Handle the simple cases. These cannot have array in type parameter
+ // without further information.
TypeKind::Void |
TypeKind::NullPtr |
TypeKind::Int(..) |
diff --git a/src/ir/context.rs b/src/ir/context.rs
index 6209098b..e0a2a806 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -185,13 +185,13 @@ pub struct BindgenContext<'ctx> {
/// The set of (`ItemId`s of) types that can't derive debug.
///
- /// This is populated when we enter codegen by `compute_can_derive_debug`
+ /// This is populated when we enter codegen by `compute_cannot_derive_debug`
/// and is always `None` before that and `Some` after.
cannot_derive_debug: Option<HashSet<ItemId>>,
/// The set of (`ItemId`s of) types that can't derive default.
///
- /// This is populated when we enter codegen by `compute_can_derive_default`
+ /// This is populated when we enter codegen by `compute_cannot_derive_default`
/// and is always `None` before that and `Some` after.
cannot_derive_default: Option<HashSet<ItemId>>,
@@ -1839,7 +1839,7 @@ impl<'ctx> BindgenContext<'ctx> {
!self.cannot_derive_default.as_ref().unwrap().contains(&id)
}
- /// Compute whether we can derive debug.
+ /// Compute whether we can derive copy.
fn compute_cannot_derive_copy(&mut self) {
assert!(self.cannot_derive_copy.is_none());
self.cannot_derive_copy = Some(analyze::<CannotDeriveCopy>(self));
@@ -1864,7 +1864,7 @@ impl<'ctx> BindgenContext<'ctx> {
!self.cannot_derive_hash.as_ref().unwrap().contains(&id)
}
- /// Compute whether we can derive hash.
+ /// Compute whether we can derive partialeq.
fn compute_cannot_derive_partialeq(&mut self) {
assert!(self.cannot_derive_partialeq.is_none());
if self.options.derive_partialeq {
@@ -1895,19 +1895,19 @@ impl<'ctx> BindgenContext<'ctx> {
!self.cannot_derive_copy.as_ref().unwrap().contains(&id)
}
- /// Compute whether the type has array.
+ /// Compute whether the type has type parameter in array.
fn compute_has_type_param_in_array(&mut self) {
assert!(self.has_type_param_in_array.is_none());
self.has_type_param_in_array = Some(analyze::<HasTypeParameterInArray>(self));
}
- /// Look up whether the item with `id` has array or not.
+ /// Look up whether the item with `id` has type parameter in array or not.
pub fn lookup_item_id_has_type_param_in_array(&self, id: &ItemId) -> bool {
assert!(self.in_codegen_phase(),
"We only compute has array when we enter codegen");
// Look up the computed value for whether the item with `id` has
- // array or not.
+ // type parameter in array or not.
self.has_type_param_in_array.as_ref().unwrap().contains(id)
}
}