Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

feat(style,doc): added typos-cli workspace configuration (#12827)

Mikhail Katychev2811ee833fac
diff --git a/Cargo.toml b/Cargo.toml
index 539e99d6e3..3feafc5f9b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -696,3 +696,55 @@ debug = "line-tables-only"
inherits = "release"
codegen-units = 1
lto = true
+
+# https://github.com/crate-ci/typos/blob/master/docs/reference.md
+[workspace.metadata.typos.default]
+extend-ignore-re = [
+ "(\\d\\w{2,}|\\w{2,}\\d)", # possible hex encoding
+]
+extend-ignore-words-re = [
+ '^[a-zA-Z]{1,3}$' # ignore words up to length 3
+]
+
+extend-ignore-identifiers-re = [
+ # prologue, main, epilogue
+ "set[pme]",
+]
+
+[workspace.metadata.typos.default.extend-identifiers]
+# Arithmetic Logic Unit
+alu = "alu"
+# Data Source
+datas = "datas"
+# library
+flate2 = "flate2"
+ExpandedOrShrinked = "ExpandedOrShrinked"
+EigthMem = "EigthMem"
+
+[workspace.metadata.typos.default.extend-words]
+# Vector ALU
+valu = "valu"
+# AND Shifted
+ANDS = "ANDS"
+# Posix EACCES error
+ACCES = "ACCES"
+# SHift Left Long
+shll = "shll"
+# elements
+eles = "eles"
+# strategy
+strat = "strat"
+# test
+thre = "thre"
+# gimli definition
+endianity = "endianity"
+# A Low
+alow = "alow"
+aranges = "aranges"
+# literals
+lits = "lits"
+RELA = "RELA"
+fpr = "fpr"
+
+[workspace.metadata.typos.files]
+extend-exclude = [ "docs/js/mermaid*.js", "crates/wasi-nn/**/*.txt", "*.isle" ]
diff --git a/cranelift/codegen/meta/src/shared/settings.rs b/cranelift/codegen/meta/src/shared/settings.rs
index b152b4d462..e8b3eac630 100644
--- a/cranelift/codegen/meta/src/shared/settings.rs
+++ b/cranelift/codegen/meta/src/shared/settings.rs
@@ -92,7 +92,7 @@ pub(crate) fn define() -> SettingGroup {
);
// Note that Cranelift doesn't currently need an is_pie flag, because PIE is
- // just PIC where symbols can't be pre-empted, which can be expressed with the
+ // just PIC where symbols can't be preempted, which can be expressed with the
// `colocated` flag on external functions and global values.
settings.add_bool(
"is_pic",
diff --git a/cranelift/isle/veri/veri_engine/src/annotations.rs b/cranelift/isle/veri/veri_engine/src/annotations.rs
index 6b6c3823f0..f7a70886ac 100644
--- a/cranelift/isle/veri/veri_engine/src/annotations.rs
+++ b/cranelift/isle/veri/veri_engine/src/annotations.rs
@@ -235,7 +235,7 @@ fn spec_op_to_expr(s: &SpecOp, args: &[SpecExpr], pos: &Pos, env: &ParsingEnv) -
args.len() > 1,
"Unexpected number of args for switch operator {pos:?}",
);
- let swith_on = spec_to_expr(&args[0], env);
+ let switch_on = spec_to_expr(&args[0], env);
let arms: Vec<(Expr, Expr)> = args[1..]
.iter()
.map(|a| match a {
@@ -247,7 +247,7 @@ fn spec_op_to_expr(s: &SpecOp, args: &[SpecExpr], pos: &Pos, env: &ParsingEnv) -
_ => unreachable!(),
})
.collect();
- Expr::Switch(Box::new(swith_on), arms)
+ Expr::Switch(Box::new(switch_on), arms)
}
SpecOp::LoadEffect => {
assert_eq!(
diff --git a/cranelift/isle/veri/veri_engine/src/solver.rs b/cranelift/isle/veri/veri_engine/src/solver.rs
index 99e176f728..39dcb9df4a 100644
--- a/cranelift/isle/veri/veri_engine/src/solver.rs
+++ b/cranelift/isle/veri/veri_engine/src/solver.rs
@@ -1218,7 +1218,7 @@ impl SolverCtx {
self.smt.push().unwrap();
for (i, a) in assumptions.iter().enumerate() {
self.smt
- .assert(self.smt.named(format!("assum{i}"), *a))
+ .assert(self.smt.named(format!("assume{i}"), *a))
.unwrap();
}
diff --git a/crates/cranelift/src/func_environ/stack_switching/instructions.rs b/crates/cranelift/src/func_environ/stack_switching/instructions.rs
index c93f695762..9579dd3583 100644
--- a/crates/cranelift/src/func_environ/stack_switching/instructions.rs
+++ b/crates/cranelift/src/func_environ/stack_switching/instructions.rs
@@ -1270,7 +1270,7 @@ pub(crate) fn translate_resume<'a>(
// user-defined handler blocks, based on the handler index
// provided on suspension. Note that we do not jump to the
// handler blocks directly. Instead, each handler block has a
- // corresponding premable block, which we jump to in order to
+ // corresponding preamble block, which we jump to in order to
// reach a particular handler block. The preamble block prepares
// the arguments and continuation object to be passed to the
// actual handler block.
@@ -1546,7 +1546,7 @@ pub(crate) fn translate_resume<'a>(
preamble_blocks
};
- // Dispatch block. All it does is jump to the right premable block based on
+ // Dispatch block. All it does is jump to the right preamble block based on
// the handler index.
{
builder.switch_to_block(dispatch_block);
diff --git a/crates/fuzzing/src/generators/component_async.rs b/crates/fuzzing/src/generators/component_async.rs
index a7dc1ac213..cc4d542ffb 100644
--- a/crates/fuzzing/src/generators/component_async.rs
+++ b/crates/fuzzing/src/generators/component_async.rs
@@ -151,7 +151,7 @@ impl<R, W> HandleStates<R, W> {
#[derive(Default)]
struct HalfStates<T> {
/// All known handles of this type, where they're located, etc.
- handles: IndexMap<u32, (Scope, HalfState, Transferrable)>,
+ handles: IndexMap<u32, (Scope, HalfState, Transferable)>,
/// All handles which can currently be dropped. Handles can't be dropped if
/// they're in use, for example.
@@ -164,12 +164,12 @@ struct HalfStates<T> {
/// All handles which can be transferred somewhere else.
///
- /// Some examples of non-transferrable handles are:
+ /// Some examples of non-transferable handles are:
///
/// * writers
/// * handles with an outstanding read
/// * host-based handles that have been used at least once (FIXME #12090)
- transferrable: IndexSet<u32>,
+ transferable: IndexSet<u32>,
/// Handles currently being read/written to.
///
@@ -187,7 +187,7 @@ enum HalfState {
}
#[derive(Copy, Clone, PartialEq, Debug)]
-enum Transferrable {
+enum Transferable {
Yes,
No,
}
@@ -221,25 +221,25 @@ impl<T> HalfStates<T> {
}
/// Adds a new handle `id` to this set.
- fn insert(&mut self, id: u32, scope: Scope, transferrable: Transferrable) {
+ fn insert(&mut self, id: u32, scope: Scope, transferable: Transferable) {
let prev = self
.handles
- .insert(id, (scope, HalfState::Idle, transferrable));
+ .insert(id, (scope, HalfState::Idle, transferable));
assert!(prev.is_none());
assert!(self.droppable.insert(id));
- if transferrable == Transferrable::Yes {
- self.transferrable.insert(id);
+ if transferable == Transferable::Yes {
+ self.transferable.insert(id);
}
}
/// Removes the handle `id` for closing.
fn remove(&mut self, id: u32) -> Scope {
- let (scope, state, transferrable) = self.handles.swap_remove(&id).unwrap();
+ let (scope, state, transferable) = self.handles.swap_remove(&id).unwrap();
assert!(matches!(state, HalfState::Idle));
self.droppable.swap_remove(&id);
self.ready.swap_remove(&id);
- if transferrable == Transferrable::Yes {
- assert!(self.transferrable.swap_remove(&id));
+ if transferable == Transferable::Yes {
+ assert!(self.transferable.swap_remove(&id));
}
scope
}
@@ -248,25 +248,25 @@ impl<T> HalfStates<T> {
/// lifetime, preventing its transfer. This is used as a workaround for
/// #12090.
fn lock_in_place(&mut self, id: u32) {
- let (_scope, state, transferrable) = self.handles.get_mut(&id).unwrap();
+ let (_scope, state, transferable) = self.handles.get_mut(&id).unwrap();
assert!(matches!(state, HalfState::Idle));
- if matches!(transferrable, Transferrable::Yes) {
- assert!(self.transferrable.swap_remove(&id));
- *transferrable = Transferrable::No;
+ if matches!(transferable, Transferable::Yes) {
+ assert!(self.transferable.swap_remove(&id));
+ *transferable = Transferable::No;
}
}
/// Starts an operation on the handle `id`.
fn start(&mut self, id: u32, cancellable: Cancellable, payload: T) {
- let (_scope, state, transferrable) = self.handles.get_mut(&id).unwrap();
+ let (_scope, state, transferable) = self.handles.get_mut(&id).unwrap();
assert!(matches!(state, HalfState::Idle));
assert!(self.ready.swap_remove(&id));
self.droppable.swap_remove(&id);
*state = HalfState::InUse;
let prev = self.in_use.insert(id, (payload, OpState::Pending));
assert!(prev.is_none());
- if *transferrable == Transferrable::Yes {
- assert!(self.transferrable.swap_remove(&id));
+ if *transferable == Transferable::Yes {
+ assert!(self.transferable.swap_remove(&id));
}
if cancellable == Cancellable::Yes {
assert!(self.cancellable.insert(id));
@@ -276,13 +276,13 @@ impl<T> HalfStates<T> {
/// Completes an operation on `id`, returning the state it was started with
/// along with whether it was dropped.
fn stop(&mut self, id: u32) -> (T, OpState) {
- let (_scope, state, transferrable) = self.handles.get_mut(&id).unwrap();
+ let (_scope, state, transferable) = self.handles.get_mut(&id).unwrap();
assert!(matches!(state, HalfState::InUse));
*state = HalfState::Idle;
let dropped = self.in_use.swap_remove(&id).unwrap();
self.cancellable.swap_remove(&id);
- if *transferrable == Transferrable::Yes {
- assert!(self.transferrable.insert(id));
+ if *transferable == Transferable::Yes {
+ assert!(self.transferable.insert(id));
}
assert!(self.droppable.insert(id));
if dropped.1 != OpState::Dropped {
@@ -374,7 +374,7 @@ impl State {
if self.futures.readers.ready.len() > 0 {
choices.push(Choice::FutureRead);
}
- if self.futures.readers.transferrable.len() > 0 {
+ if self.futures.readers.transferable.len() > 0 {
choices.push(Choice::FutureReaderTransfer);
}
}
@@ -396,7 +396,7 @@ impl State {
// If more work is allowed then streams can be moved around and new
// reads/writes may be started.
if !finish {
- if self.streams.readers.transferrable.len() > 0 {
+ if self.streams.readers.transferable.len() > 0 {
choices.push(Choice::StreamReaderTransfer);
}
if self.streams.readers.ready.len() > 0 {
@@ -483,14 +483,14 @@ impl State {
let scope = *u.choose(Scope::ALL)?;
let id = self.next_id();
commands.push((scope, Command::FutureNew(id)));
- self.futures.readers.insert(id, scope, Transferrable::Yes);
- self.futures.writers.insert(id, scope, Transferrable::No);
+ self.futures.readers.insert(id, scope, Transferable::Yes);
+ self.futures.writers.insert(id, scope, Transferable::No);
// Future writers cannot be dropped without writing.
assert!(self.futures.writers.droppable.swap_remove(&id));
}
Choice::FutureReaderTransfer => {
- let set = &mut self.futures.readers.transferrable;
+ let set = &mut self.futures.readers.transferable;
let i = u.int_in_range(0..=set.len() - 1)?;
let id = *set.get_index(i).unwrap();
let scope = &mut self.futures.readers.handles[&id].0;
@@ -672,11 +672,11 @@ impl State {
let scope = *u.choose(Scope::ALL)?;
let id = self.next_id();
commands.push((scope, Command::StreamNew(id)));
- self.streams.readers.insert(id, scope, Transferrable::Yes);
- self.streams.writers.insert(id, scope, Transferrable::No);
+ self.streams.readers.insert(id, scope, Transferable::Yes);
+ self.streams.writers.insert(id, scope, Transferable::No);
}
Choice::StreamReaderTransfer => {
- let set = &mut self.streams.readers.transferrable;
+ let set = &mut self.streams.readers.transferable;
let i = u.int_in_range(0..=set.len() - 1)?;
let id = *set.get_index(i).unwrap();
let scope = &mut self.streams.readers.handles[&id].0;
diff --git a/crates/wasmtime/src/runtime/func.rs b/crates/wasmtime/src/runtime/func.rs
index 66044e2de3..a00aee377d 100644
--- a/crates/wasmtime/src/runtime/func.rs
+++ b/crates/wasmtime/src/runtime/func.rs
@@ -2158,7 +2158,7 @@ pub struct HostFunc {
ctx: StoreBox<VMArrayCallHostFuncContext>,
/// Whether or not this function was defined with an `async` host function,
- /// meaning that it is only invokable when wasm is itself on a fiber to
+ /// meaning that it is only invocable when wasm is itself on a fiber to
/// support suspension on `Poll::Pending`.
///
/// This is used to propagate to an `InstancePre` and then eventually into a
diff --git a/crates/wasmtime/src/runtime/vm/traphandlers.rs b/crates/wasmtime/src/runtime/vm/traphandlers.rs
index c9f2d80f36..ff95153afa 100644
--- a/crates/wasmtime/src/runtime/vm/traphandlers.rs
+++ b/crates/wasmtime/src/runtime/vm/traphandlers.rs
@@ -740,7 +740,7 @@ impl CallThreadState {
/// called using, for example, the `unwind` function below.
///
/// Note that this is a relatively low-level function and will panic if
- /// mis-used.
+ /// misused.
///
/// # Panics
///
diff --git a/tests/misc_testsuite/issue1809.wast b/tests/misc_testsuite/issue1809.wast
index 1321ff8171..a47ce21919 100644
--- a/tests/misc_testsuite/issue1809.wast
+++ b/tests/misc_testsuite/issue1809.wast
@@ -479,7 +479,7 @@
(i32.store
(i32.const 1048576)
(global.get $__data_efd)))))
- (memory $memory (export "memroy") 17)
+ (memory $memory (export "memory") 17)
(global $g0 (mut i32) (i32.const 1048576))
(global $__data_efd (export "__data_efd") i32 (i32.const 1048580))
(global $__heap_bare (export "__heap_bare") i32 (i32.const 1048580)))