Skip to content

Commit c603b25

Browse files
authored
fix typos (#1016)
The typos were found with the "typos" spell checker.[1] [1]: https://github.com/crate-ci/typos
2 parents 8365d55 + 37ce9d3 commit c603b25

File tree

35 files changed

+49
-49
lines changed

35 files changed

+49
-49
lines changed

analysis/runtime/src/handlers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ macro_rules! hook_fn {
9191
}};
9292
}
9393

94-
/// List of functions we want hooked for the lifetime analyis runtime.
94+
/// List of functions we want hooked for the lifetime analysis runtime.
9595
///
9696
/// For functions in [`HOOK_FUNCTIONS`], the tracing passes
9797
/// the return value of the traced function as the last argument to the trace hook for it.

c2rust-analyze/src/borrowck/type_check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ impl<'tcx> TypeChecker<'tcx, '_> {
368368
if let Some(true) = op.constant().cloned().map(util::is_null_const) {
369369
// Here we relabel `expect_ty` to utilize the permissions it carries
370370
// but substitute the rest of its `Label`s' parts with fresh origins
371-
// Othwerise, this is conceptually similar to labeling the cast target
371+
// Otherwise, this is conceptually similar to labeling the cast target
372372
// `ty`. We would simply do that, but do not have the information necessary
373373
// to set its permissions.
374374
self.relabel_fresh_origins(expect_ty)
@@ -380,7 +380,7 @@ impl<'tcx> TypeChecker<'tcx, '_> {
380380
let op_lty = self.visit_operand(op);
381381
// Here we relabel `expect_ty` to utilize the permissions it carries
382382
// but substitute the rest of its `Label`s' parts with fresh origins
383-
// Othwerise, this is conceptually similar to labeling the cast target
383+
// Otherwise, this is conceptually similar to labeling the cast target
384384
// `ty`. We would simply do that, but do not have the information necessary
385385
// to set its permissions.
386386
let result_lty = self.relabel_fresh_origins(expect_ty);

c2rust-analyze/src/rewrite/apply.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl<S: Sink> Emitter<'_, S> {
258258
/// Emit the text of `rw` into `self.sink`, using `Sink` methods to paste in the expression
259259
/// being rewritten or its subexpressions if needed.
260260
///
261-
/// `prec` is the precedence of the surrounding context. Each operatior is assigned a
261+
/// `prec` is the precedence of the surrounding context. Each operator is assigned a
262262
/// precedence number, where a higher precedence number means the operator binds more tightly.
263263
/// For example, `a + b * c` parses as `a + (b * c)`, not `(a + b) * c`, because `*` binds more
264264
/// tightly than `+`; this means `*` will have a higher precedence number than `+`. Nesting a

c2rust-ast-exporter/src/AstExporter.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1901,7 +1901,7 @@ class TranslateASTVisitor final
19011901
// Unfortunately, if there are two 'extern' variables in different
19021902
// functions that should be the same at link time, Clang groups them.
19031903
// That is unhelpful for us though, since we need to convert them into
1904-
// two seperate `extern` blocks.
1904+
// two separate `extern` blocks.
19051905
if (!VD->isCanonicalDecl() && !VD->isExternC()) {
19061906
// Emit non-canonical decl so we have a placeholder to attach comments to
19071907
std::vector<void *> childIds = {VD->getCanonicalDecl()};
@@ -2201,7 +2201,7 @@ class TranslateASTVisitor final
22012201
cbor_encode_uint(array, bitWidth);
22022202
});
22032203

2204-
// This might be the only occurence of this type in the translation unit
2204+
// This might be the only occurrence of this type in the translation unit
22052205
typeEncoder.VisitQualType(t);
22062206

22072207
return true;

c2rust-refactor/doc/literate/annot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def __init__(self):
217217
self.acc = []
218218

219219
def add(self, span: Span[T]):
220-
'''Add `span` to the result sequnece, merging it with the previous span
220+
'''Add `span` to the result sequence, merging it with the previous span
221221
if it overlaps. In case of overlap, the merged span retains the label
222222
of the first span provided with `add`.'''
223223
if len(self.acc) > 0 and span.start <= self.acc[-1].end:

c2rust-refactor/doc/rewrite.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ rewrite_expr '__x + 1' '11 * __x'
7676
In each case, the expression bound to the `__x` metavariable is substituted
7777
into the right-hand side of the multiplication in the replacement.
7878

79-
## Multiple occurences
79+
## Multiple occurrences
8080

8181
Finally, the same metavariable can appear multiple times in the pattern. In
82-
that case, the pattern matches only if each occurence of the metavariable
82+
that case, the pattern matches only if each occurrence of the metavariable
8383
matches the same expression. For example:
8484

8585
```rust refactor-target hidden

c2rust-refactor/doc/select.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ which `mark_uses` cannot handle.
775775
776776
For purposes of `mark_callers`, a "use" is a function call (`foo::bar()`) or
777777
method call (`x.foo()`) expression where the function or method being called is
778-
one of the marked definitons.
778+
one of the marked definitions.
779779
780780
### `mark_arg_uses`
781781

c2rust-refactor/gen/rewrite.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
5252
The generated `Rewrite` impl will by default try either `equal` or `recursive`
5353
(depending on type kind), then `print`. If one of these strategies is
54-
unavailabe (due to missing impls), it will be skipped. If no strategies are
54+
unavailable (due to missing impls), it will be skipped. If no strategies are
5555
available, code generation raises an error.
5656
5757
For the three built-in strategies:

c2rust-refactor/misc/rustfmt-clean-parens.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ in `c2rust-refactor` would insert unnecessary parentheses around (at least) ever
44
splice point, and this seemed like the easiest way to clean it up. The
55
approach taken here involves some ugly hacks (see the `ExprKind::Paren` case
66
below), so it's probably not suitable for upstreaming in its current form. I
7-
think this patch is now obsolete, thanks to improvemens in the `c2rust-refactor`
7+
think this patch is now obsolete, thanks to improvements in the `c2rust-refactor`
88
rewriter, but I'm leaving a copy here anyway in case it turns out to be useful.
99

1010

c2rust-refactor/scripts/upgrade_ptr_to_ref.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ function Visitor:rewrite_deref_expr(expr, output_slice)
858858
expr:to_method_call("as_ptr", {expr})
859859
end
860860

861-
-- For immut refs we skip the superflous as_ref call,
861+
-- For immut refs we skip the superfluous as_ref call,
862862
-- so we can also skip one of the corresponding derefs
863863
if is_mut or cfg:is_box_any() then
864864
expr:to_unary("Deref", expr)
@@ -1434,7 +1434,7 @@ function Visitor:flat_map_stmt(stmt, walk)
14341434
-- a = a.offset(x);
14351435
--
14361436
-- where "a" is a mutable slice ref. In particular, we're just looking for the
1437-
-- offset assignment here (locals handeled elsewhere). We rewrite it to:
1437+
-- offset assignment here (locals handled elsewhere). We rewrite it to:
14381438
--
14391439
-- {
14401440
-- let tup = a[.unwrap()].split_at_mut(x);

c2rust-refactor/src/analysis/ownership/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ path permissions reflects the transitive nature of access restrictions in Rust:
151151
for example, if a struct field `x.f` has type `&mut T`, but `x` is an immutable
152152
reference (`&S`), then only immutable access is allowed to `*x.f`.
153153

154-
The two additional constraints introduced by assigments are (1) the path
154+
The two additional constraints introduced by assignments are (1) the path
155155
permission of the LHS must be no lower than WRITE, and (2) the path permission
156156
of the RHS must be no lower than the permission of the LHS pointer type.
157157
Constraint (1) prevents writing through a READ pointer, or through any path
@@ -325,7 +325,7 @@ There are four annotation types currently supported by the ownership system.
325325

326326
The `ownership_mono` annotation can appear multiple times on a single
327327
function to provide multiple monomorphic signatures. However, if it appears
328-
at all, monomorphization inference will be completely overriden for the
328+
at all, monomorphization inference will be completely overridden for the
329329
annotated function, and only the provided signatures will be used in callee
330330
argument inference and later transformations.
331331

c2rust-refactor/src/analysis/ownership/constraint.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl<'lty, 'tcx> Perm<'lty> {
191191
}
192192
}
193193

194-
/// Iterater over each atomic (non-`Min`) permission that appears in `self`.
194+
/// Iterator over each atomic (non-`Min`) permission that appears in `self`.
195195
pub fn for_each_atom<F: FnMut(Perm<'lty>)>(&self, callback: &mut F) {
196196
match *self {
197197
Perm::Min(ps) => {
@@ -285,7 +285,7 @@ impl<'lty, 'tcx> ConstraintSet<'lty> {
285285
for &(a, b) in other.less.iter() {
286286
let (a2, b2) = (subst_one(a), subst_one(b));
287287
debug!(
288-
"IMPORT CONSTRANT: {:?} <= {:?} (substituted from {:?} <= {:?})",
288+
"IMPORT CONSTRAINT: {:?} <= {:?} (substituted from {:?} <= {:?})",
289289
a2, b2, a, b
290290
);
291291
self.add(a2, b2);

c2rust-refactor/src/reflect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<'a, 'tcx> Reflector<'a, 'tcx> {
112112
}
113113
}
114114
// `Bound` is "used only when preparing a trait query", so hopefully we never actually
115-
// encouter one.
115+
// encounter one.
116116
Bound(..) => mk().infer_ty(),
117117
// No idea what `Placeholder` is, but it sounds like something rustc-internal.
118118
Placeholder(..) => mk().infer_ty(),

c2rust-refactor/src/transform/externs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ pub fn fix_users(
138138
expect!([e.kind] ExprKind::Call(_, ref mut args) => {
139139
if let Some(ty) = cx.opt_node_type(args[i].id) {
140140
if ty_compare.eq_tys(ty, new_ty) {
141-
// We don't need to conver this type, it already matches
141+
// We don't need to convert this type, it already matches
142142
return;
143143
}
144144
}

c2rust-refactor/src/transform/lifetime_analysis.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl Transform for InstrumentCmd {
5656
}
5757
}
5858

59-
/// List of functions we want hooked for the lifetime analyis runtime (see
59+
/// List of functions we want hooked for the lifetime analysis runtime (see
6060
/// ../../runtime/src/lib.rs for the implementations of these hooks)
6161
const HOOK_FUNCTIONS: &[&'static str] = c2rust_analysis_rt::HOOK_FUNCTIONS;
6262

c2rust-refactor/src/util/cursor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ impl<T> Cursor<T> {
275275

276276
/// Extract the elements between `start` and `end`, transform them using `func`, and insert the
277277
/// results in their place. Afterward, the cursor points past the end of the replacement
278-
/// sequnece.
278+
/// sequence.
279279
pub fn replace_range<F>(&mut self, start: Mark, end: Mark, func: F)
280280
where
281281
F: FnOnce(Vec<T>) -> Vec<T>,

c2rust-refactor/tests/misc/debug_callees.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ fn main() {
2929
S.g(); // Inherent ethod call
3030
S::g(&S); // Inherent method call using type-dependent path
3131
S.h(); // Trait method call
32-
S::h(&S); // Trait method call using type-depedent path (Self)
33-
T::h(&S); // Trait method call using type-depedent path (trait)
32+
S::h(&S); // Trait method call using type-dependent path (Self)
33+
T::h(&S); // Trait method call using type-dependent path (trait)
3434
<S as T>::h(&S); // Trait method call with explicit Self type
3535
FN_PTR(); // Call via (static) function pointer
3636
closure(); // Closure call / overloaded `Fn`

c2rust-transpile/src/c_ast/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ impl TypedAstContext {
310310
}
311311

312312
/// Follow a chain of typedefs and return true iff the last typedef is named
313-
/// `__buitin_va_list` thus naming the type clang uses to represent `va_list`s.
313+
/// `__builtin_va_list` thus naming the type clang uses to represent `va_list`s.
314314
pub fn is_builtin_va_list(&self, typ: CTypeId) -> bool {
315315
match self.index(typ).kind {
316316
CTypeKind::Typedef(decl) => match &self.index(decl).kind {

c2rust-transpile/src/cfg/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ impl<Lbl: Clone + Ord + Hash + Debug, Stmt> Cfg<Lbl, Stmt> {
691691

692692
self.nodes.retain(|lbl, _| visited.contains(lbl));
693693
self.loops.filter_unreachable(&visited);
694-
// TODO mutliple info
694+
// TODO multiple info
695695
}
696696

697697
/// Removes empty blocks whose terminator is just a `Jump` by merging them with the block they
@@ -974,7 +974,7 @@ pub struct DeclStmtStore {
974974
///
975975
/// 1. declare and initialize
976976
/// 2. declare only (and incidentally zero-initialize)
977-
/// 3. intialize only (if the declaration has already been emitted)
977+
/// 3. initialize only (if the declaration has already been emitted)
978978
///
979979
#[derive(Clone, Debug)]
980980
pub struct DeclStmtInfo {

c2rust-transpile/src/cfg/relooper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ impl RelooperState {
308308
(predecessor_map, strict_reachable_from)
309309
};
310310

311-
// Try to match an existing branch point (from the intial C). See `MultipleInfo` for more
311+
// Try to match an existing branch point (from the initial C). See `MultipleInfo` for more
312312
// information on this.
313313
let mut recognized_c_multiple = false;
314314
if let Some(ref multiple_info) = self.multiple_info {

c2rust-transpile/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ fn get_output_path(
529529
ancestor_path: &Path,
530530
build_dir: &Path,
531531
) -> PathBuf {
532-
// When an output file name is not explictly specified, we should convert files
532+
// When an output file name is not explicitly specified, we should convert files
533533
// with dashes to underscores, as they are not allowed in rust file names.
534534
let file_name = input_path
535535
.file_name()

c2rust-transpile/src/translator/literals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl<'c> Translation<'c> {
160160
}
161161
}
162162

163-
/// Convert an initialization list into an expresion. These initialization lists can be
163+
/// Convert an initialization list into an expression. These initialization lists can be
164164
/// used as array literals, struct literals, and union literals in code.
165165
pub fn convert_init_list(
166166
&self,

c2rust-transpile/src/translator/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub struct ExprContext {
108108
decay_ref: DecayRef,
109109
is_bitfield_write: bool,
110110

111-
// We will be refering to the expression by address. In this context we
111+
// We will be referring to the expression by address. In this context we
112112
// can't index arrays because they may legally go out of bounds. We also
113113
// need to explicitly cast function references to fn() so we get their
114114
// address in function pointer literals.
@@ -208,7 +208,7 @@ pub struct FuncContext {
208208
/// The name of the function we're currently translating
209209
name: Option<String>,
210210
/// The name we give to the Rust function argument corresponding
211-
/// to the elipsis in variadic C functions.
211+
/// to the ellipsis in variadic C functions.
212212
va_list_arg_name: Option<String>,
213213
/// The va_list decls that are either `va_start`ed or `va_copy`ed.
214214
va_list_decl_ids: Option<IndexSet<CDeclId>>,
@@ -460,7 +460,7 @@ fn clean_path(mod_names: &RefCell<IndexMap<String, PathBuf>>, path: Option<&path
460460
mod_names.insert(file_path.clone(), path.to_path_buf());
461461
} else {
462462
let mod_path = mod_names.get(&file_path.clone()).unwrap();
463-
// A collision in the module names has occured.
463+
// A collision in the module names has occurred.
464464
// Ex: types.h can be included from
465465
// /usr/include/bits and /usr/include/sys
466466
if mod_path != path {
@@ -557,7 +557,7 @@ pub fn translate(
557557

558558
// Detect case where typedef and struct share the same name.
559559
// In this case the purpose of the typedef was simply to eliminate
560-
// the need for the 'struct' tag when refering to the type name.
560+
// the need for the 'struct' tag when referring to the type name.
561561
Struct {
562562
name: Some(ref target_name),
563563
..
@@ -2097,7 +2097,7 @@ impl<'c> Translation<'c> {
20972097
mk()
20982098
};
20992099

2100-
// Force mutability due to the potential for raw pointers occuring in the type
2100+
// Force mutability due to the potential for raw pointers occurring in the type
21012101
// and because we may be assigning to these variables in the external initializer
21022102
let mut static_def = static_def.span(span).mutbl();
21032103
if has_thread_duration {

c2rust-transpile/src/translator/structs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<'a> Translation<'a> {
212212
let end_bit = platform_bit_offset + bitfield_width;
213213

214214
// Add to the total byte size of the bitfield group only if
215-
// we have not already enountered this byte
215+
// we have not already encountered this byte
216216
for bit in platform_bit_offset..end_bit {
217217
let byte = bit / 8;
218218

@@ -234,7 +234,7 @@ impl<'a> Translation<'a> {
234234
let end_bit = platform_bit_offset + bitfield_width;
235235

236236
// Add to the total byte size of the bitfield group only if
237-
// we have not already enountered this byte
237+
// we have not already encountered this byte
238238
for bit in platform_bit_offset..end_bit {
239239
let byte = bit / 8;
240240

c2rust-transpile/src/translator/variadic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl<'c> Translation<'c> {
228228
}
229229

230230
/// Update the current function context by i) enabling the C variadics feature, ii) naming the
231-
/// Rust function argument that corresponds to the elipsis in the original C function, and iii)
231+
/// Rust function argument that corresponds to the ellipsis in the original C function, and iii)
232232
/// building a list of variable declarations to be translated into `VaListImpl`s. Returns the
233233
/// name of the `VaList` function argument for convenience.
234234
pub fn register_va_decls(&self, body: CStmtId) -> String {

dynamic_instrumentation/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ ${CARGO_TARGET_DIR:-target}/debug/c2rust-instrument --metadata analysis/tests/mi
99
This instruments the binary built from main.rs with dynamic memory tracing, and
1010
outputs the necessary metadata to match up instrumentation points to source code
1111
into `metadata.bc`. We then run the binary, printing output to the
12-
debug console and using the aformentioned metadata file.
12+
debug console and using the aforementioned metadata file.

dynamic_instrumentation/src/instrument.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<'tcx> MutVisitor<'tcx> for RewriteAddressTakenLocals<'tcx> {
166166
&& (is_non_assignment_use || is_assignment_to_local_projection)
167167
// maintain drop semantics for original address-taken local -- the liveness
168168
// properties of its address are not necessarily the same, and dropping
169-
// `(*_y)` is undesireable
169+
// `(*_y)` is undesirable
170170
&& !context.is_drop()
171171
{
172172
// add deref
@@ -231,7 +231,7 @@ impl<'tcx> MutVisitor<'tcx> for RewriteAddressTakenLocals<'tcx> {
231231
}
232232

233233
// when the address-taken local is assigned to for the first time, we know it's active,
234-
// so insert `_y = &raw x` just below that assignment, which is neccessary because
234+
// so insert `_y = &raw x` just below that assignment, which is necessary because
235235
// otherwise the address-taking statement would be taking the address of an uninitialized
236236
// variable. For assignment statements, place `_y = &raw _x` one statement below. For
237237
// terminators with a destination to the address-taken local, or drop and replace

scripts/package.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def _parse_args() -> argparse.Namespace:
220220

221221
subparsers = parser.add_subparsers(dest='subcommand', required=True)
222222

223-
subparsers.add_parser('check', help='Check repo in preperation for publishing')
223+
subparsers.add_parser('check', help='Check repo in preparation for publishing')
224224

225225
subparsers.add_parser('package', help='Package crates')
226226

tests/gotos/src/early_returns.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This shoud translate to straightforward one-armed if's
1+
// This should translate to straightforward one-armed if's
22
int early_returns(int a) {
33
if (a == 2) {
44
return 2;

tests/gotos/src/idiomatic_nested_loops.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This shoud translate to a straightforward `break` with a loop label
1+
// This should translate to a straightforward `break` with a loop label
22
int break_multiple(int x) {
33
/* comment1 */
44

tests/gotos/src/idiomatic_switch.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This shoud translate to a straightforward `match`.
1+
// This should translate to a straightforward `match`.
22
int idiomatic_switch(int x) {
33

44
switch (1 + x) {

tests/gotos/src/label_break_trigger.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This function doesn't do anything interesting, so we aren't checking its
2-
// intputs or outputs. However, it does have interesting control flow, so
2+
// inputs or outputs. However, it does have interesting control flow, so
33
// we do check that we can generate compiling code for it.
44
void triggers_label_break(void) {
55
lbl:

0 commit comments

Comments
 (0)