提交 175d6a74 编写于 作者: A Alex Crichton

rollup merge of #18332 : jbcrail/fix-comments

......@@ -376,7 +376,7 @@ fn bar( a:int,
-> int
{ }
fn baz( a:int, // shoudl work with a comment here
fn baz( a:int, // should work with a comment here
b:char)
-> int
{ }
......
......@@ -41,10 +41,10 @@
/// the BST strategy.
///
/// A B-Tree instead makes each node contain B-1 to 2B-1 elements in a contiguous array. By doing
/// this, we reduce the number of allocations by a factor of B, and improve cache effeciency in
/// this, we reduce the number of allocations by a factor of B, and improve cache efficiency in
/// searches. However, this does mean that searches will have to do *more* comparisons on average.
/// The precise number of comparisons depends on the node search strategy used. For optimal cache
/// effeciency, one could search the nodes linearly. For optimal comparisons, one could search
/// efficiency, one could search the nodes linearly. For optimal comparisons, one could search
/// the node using binary search. As a compromise, one could also perform a linear search
/// that initially only checks every i<sup>th</sup> element for some choice of i.
///
......
......@@ -53,7 +53,7 @@ pub struct Node<K, V> {
// hard. For now, we accept this cost in the name of correctness and simplicity.
//
// As a compromise, keys and vals could be merged into one Vec<(K, V)>, which would shave
// off 3 words, but possibly hurt our cache effeciency during search, which only cares about
// off 3 words, but possibly hurt our cache efficiency during search, which only cares about
// keys. This would also avoid the Zip we use in our iterator implementations. This is
// probably worth investigating.
//
......@@ -72,7 +72,7 @@ impl<K: Ord, V> Node<K, V> {
/// `GoDown` will be yielded with the index of the subtree the key must lie in.
pub fn search(&self, key: &K) -> SearchResult {
// FIXME(Gankro): Tune when to search linear or binary based on B (and maybe K/V).
// For the B configured as of this writing (B = 6), binary search was *singnificantly*
// For the B configured as of this writing (B = 6), binary search was *significantly*
// worse for uints.
self.search_linear(key)
}
......@@ -375,7 +375,7 @@ unsafe fn handle_underflow_to_right(&mut self, underflowed_child_index: uint) {
}
}
/// Steal! Stealing is roughly analagous to a binary tree rotation.
/// Steal! Stealing is roughly analogous to a binary tree rotation.
/// In this case, we're "rotating" right.
unsafe fn steal_to_left(&mut self, underflowed_child_index: uint) {
// Take the biggest stuff off left
......@@ -387,7 +387,7 @@ unsafe fn steal_to_left(&mut self, underflowed_child_index: uint) {
}
};
// Swap the parent's seperating key-value pair with left's
// Swap the parent's separating key-value pair with left's
self.unsafe_swap(underflowed_child_index - 1, &mut key, &mut val);
// Put them at the start of right
......@@ -402,7 +402,7 @@ unsafe fn steal_to_left(&mut self, underflowed_child_index: uint) {
}
}
/// Steal! Stealing is roughly analagous to a binary tree rotation.
/// Steal! Stealing is roughly analogous to a binary tree rotation.
/// In this case, we're "rotating" left.
unsafe fn steal_to_right(&mut self, underflowed_child_index: uint) {
// Take the smallest stuff off right
......@@ -414,7 +414,7 @@ unsafe fn steal_to_right(&mut self, underflowed_child_index: uint) {
}
};
// Swap the parent's seperating key-value pair with right's
// Swap the parent's separating key-value pair with right's
self.unsafe_swap(underflowed_child_index, &mut key, &mut val);
// Put them at the end of left
......@@ -430,9 +430,9 @@ unsafe fn steal_to_right(&mut self, underflowed_child_index: uint) {
}
/// Merge! Left and right will be smooshed into one node, along with the key-value
/// pair that seperated them in their parent.
/// pair that separated them in their parent.
unsafe fn merge_children(&mut self, left_index: uint) {
// Permanently remove right's index, and the key-value pair that seperates
// Permanently remove right's index, and the key-value pair that separates
// left and right
let (key, val, right) = {
match (self.keys.remove(left_index),
......@@ -448,7 +448,7 @@ unsafe fn merge_children(&mut self, left_index: uint) {
left.absorb(key, val, right);
}
/// Take all the values from right, seperated by the given key and value
/// Take all the values from right, separated by the given key and value
fn absorb(&mut self, key: K, val: V, right: Node<K, V>) {
// Just as a sanity check, make sure we can fit this guy in
debug_assert!(self.len() + right.len() <= self.capacity())
......
......@@ -173,7 +173,7 @@ impl<'a> SeedableRng<&'a [u32]> for ChaChaRng {
fn reseed(&mut self, seed: &'a [u32]) {
// reset state
self.init(&[0u32, ..KEY_WORDS]);
// set key inplace
// set key in place
let key = self.state.slice_mut(4, 4+KEY_WORDS);
for (k, s) in key.iter_mut().zip(seed.iter()) {
*k = *s;
......
......@@ -211,7 +211,7 @@ pub fn select_inherent_impl(&mut self,
// can be applied to particular types. It skips the "confirmation"
// step and hence completely ignores output type parameters.
//
// The result is "true" if the obliation *may* hold and "false" if
// The result is "true" if the obligation *may* hold and "false" if
// we can be sure it does not.
pub fn evaluate_obligation_intercrate(&mut self,
......
......@@ -2117,7 +2117,7 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
deref_owned_pointer(bcx, expr, datum, content_ty)
} else {
// A fat pointer and an opened DST value have the same
// represenation just different types. Since there is no
// representation just different types. Since there is no
// temporary for `*e` here (because it is unsized), we cannot
// emulate the sized object code path for running drop glue and
// free. Instead, we schedule cleanup for `e`, turning it into
......@@ -2142,7 +2142,7 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
// owner (or, in the case of *T, by the user).
DatumBlock::new(bcx, Datum::new(ptr, content_ty, LvalueExpr))
} else {
// A fat pointer and an opened DST value have the same represenation
// A fat pointer and an opened DST value have the same representation
// just different types.
DatumBlock::new(bcx, Datum::new(datum.val,
ty::mk_open(bcx.tcx(), content_ty),
......
......@@ -3619,7 +3619,7 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
// Special case: A unit like struct's constructor must be called without () at the
// end (like `UnitStruct`) which means this is an ExprPath to a DefFn. But in case
// of unit structs this is should not be interpretet as function pointer but as
// of unit structs this is should not be interpreted as function pointer but as
// call to the constructor.
def::DefFn(_, _, true) => RvalueDpsExpr,
......@@ -5423,7 +5423,7 @@ pub fn to_mutbl_lossy(self) -> ast::Mutability {
MutBorrow => ast::MutMutable,
ImmBorrow => ast::MutImmutable,
// We have no type correponding to a unique imm borrow, so
// We have no type corresponding to a unique imm borrow, so
// use `&mut`. It gives all the capabilities of an `&uniq`
// and hence is a safe "over approximation".
UniqueImmBorrow => ast::MutMutable,
......
......@@ -1674,7 +1674,7 @@ fn link_reborrowed_region(rcx: &Rcx,
//
// If mutability was inferred from an upvar, we may be
// forced to revisit this decision later if processing
// another borrow or nested closure ends up coverting the
// another borrow or nested closure ends up converting the
// upvar borrow kind to mutable/unique. Record the
// information needed to perform the recursive link in the
// maybe link map.
......
......@@ -186,7 +186,7 @@ pub fn reserve(&mut self, n: uint) {
/// # Example
///
/// This is a slightly silly example where we define the number's
/// parity as the equivilance class. It is important that the
/// parity as the equivalance class. It is important that the
/// values hash the same, which is why we implement `Hash`.
///
/// ```
......
......@@ -439,7 +439,7 @@ pub enum Stmt_ {
/// Expr with trailing semi-colon (may have any type):
StmtSemi(P<Expr>, NodeId),
/// bool: is there a trailing sem-colon?
/// bool: is there a trailing semi-colon?
StmtMac(Mac, bool),
}
......
......@@ -28,7 +28,7 @@ pub fn main() {
let x: *mut S = &mut S;
// Test we can chnage the mutability from mut to const.
// Test we can change the mutability from mut to const.
let x: &T = &mut S;
let x: *const T = &mut S;
}
......@@ -30,7 +30,7 @@ unsafe fn test_triangle() -> bool {
let ascend = ascend.as_mut_slice();
static ALIGN : uint = 1;
// Checks that `ascend` forms triangle of acending size formed
// Checks that `ascend` forms triangle of ascending size formed
// from pairs of rows (where each pair of rows is equally sized),
// and the elements of the triangle match their row-pair index.
unsafe fn sanity_check(ascend: &[*mut u8]) {
......
......@@ -10,7 +10,7 @@
fn sub_expr() {
// Test for a &[T] => &&[T] coercion in sub-expression position
// (surpisingly, this can cause errors which are not caused by either of:
// (surprisingly, this can cause errors which are not caused by either of:
// `let x = vec.slice_mut(0, 2);`
// `foo(vec.slice_mut(0, 2));` ).
let mut vec: Vec<int> = vec!(1, 2, 3, 4);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册