Skip to content

Commit

Permalink
chore: fix some typos (#1765)
Browse files Browse the repository at this point in the history
ss2165 authored Dec 11, 2024
1 parent 05e0d32 commit 65a5d1f
Showing 10 changed files with 23 additions and 16 deletions.
7 changes: 7 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -6,4 +6,11 @@ strat = "strat" # common abbreviation for strategy
# some arithmetic op names:
inot = "inot"
fle = "fle"
flt = "flt"
olt = "olt"
OLT = "OLT"
FLT = "FLT"
ine = "ine"
# llvm generic parameters
OT = "OT"
ot = "ot"
2 changes: 1 addition & 1 deletion hugr-cli/tests/validate.rs
Original file line number Diff line number Diff line change
@@ -169,7 +169,7 @@ fn test_no_std(test_hugr_string: String, mut val_cmd: Command) {
val_cmd.write_stdin(test_hugr_string);
val_cmd.arg("-");
val_cmd.arg("--no-std");
// test hugr doesn't have any standard extensions, so this should succceed
// test hugr doesn't have any standard extensions, so this should succeed

val_cmd.assert().success().stderr(contains(VALID_PRINT));
}
4 changes: 2 additions & 2 deletions hugr-llvm/src/emit/func.rs
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ pub use mailbox::{RowMailBox, RowPromise};
/// One of the primary interfaces for implementing codegen extensions.
/// We have methods for:
/// * Converting from hugr [Type]s to LLVM [Type](BasicTypeEnum)s;
/// * Maintaing [MailBox](RowMailBox) for each [Wire] in the [FuncDefn];
/// * Maintaining [MailBox](RowMailBox) for each [Wire] in the [FuncDefn];
/// * Accessing the [CodegenExtsMap];
/// * Accessing an in internal [Builder].
///
@@ -231,7 +231,7 @@ impl<'c, 'a, H: HugrView> EmitFuncContext<'c, 'a, H> {
r
}

/// Returns a [RowMailBox] mapped to thie input wires of `node`. When emitting a node
/// Returns a [RowMailBox] mapped to the input wires of `node`. When emitting a node
/// input values are from this mailbox.
pub fn node_ins_rmb<'hugr, OT: 'hugr>(
&mut self,
2 changes: 1 addition & 1 deletion hugr-llvm/src/emit/ops.rs
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ where
}
}

/// safe because we are guarenteed only one input or output node
/// safe because we are guaranteed only one input or output node
fn take_input(&mut self) -> Result<Vec<BasicValueEnum<'c>>> {
self.inputs
.take()
2 changes: 1 addition & 1 deletion hugr-llvm/src/extension/prelude.rs
Original file line number Diff line number Diff line change
@@ -162,7 +162,7 @@ pub trait PreludeCodegen: Clone {
/// The default implementation emits calls to libc's `printf` and `abort`.
///
/// Note that implementations of `emit_panic` must not emit `unreachable`
/// terminators, that, if appropriate, is the responsibilitiy of the caller.
/// terminators, that, if appropriate, is the responsibility of the caller.
fn emit_panic<H: HugrView>(
&self,
ctx: &mut EmitFuncContext<H>,
2 changes: 1 addition & 1 deletion hugr-llvm/src/test.rs
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ impl<
type MakeCodegenExtsMapBox = Box<dyn MakeCodegenExtsMapFn>;
// We would like to just stor a CodegenExtsMap, but we can't because it's
// lifetime parameter would need to be the lifetime of TestContext, which is
// prohibitted. Instead, we store a factory function as below.
// prohibited. Instead, we store a factory function as below.
pub struct TestContext {
context: Context,
mk_exts: MakeCodegenExtsMapBox,
2 changes: 1 addition & 1 deletion hugr-llvm/src/utils/fat.rs
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ where

/// Create a general `FatNode` from a specific one.
pub fn generalise(self) -> FatNode<'hugr, OpType, H> {
// guaranteed to be valid becasue self is valid
// guaranteed to be valid because self is valid
FatNode {
hugr: self.hugr,
node: self.node,
8 changes: 4 additions & 4 deletions hugr-llvm/src/utils/type_map.rs
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ impl<'a, TM: TypeMapping, F: for<'c> TypeMapFnHelper<'c, TM> + 'a> TypeMappingFn

/// Defines a mapping from [HugrType] to `OutV`;
pub trait TypeMapping {
/// Auxilliary data provided when mapping from a [HugrType].
/// Auxiliary data provided when mapping from a [HugrType].
type InV<'c>: Clone;
/// The target type of the mapping.
type OutV<'c>;
@@ -45,7 +45,7 @@ pub trait TypeMapping {
/// convertible to `OutV` via `func_into_out`.
type FuncOutV<'c>;

/// Returns the result of the mapping on `sum_type`, with auxilliary data
/// Returns the result of the mapping on `sum_type`, with auxiliary data
/// `inv`, and when the result of mapping all fields of all variants is
/// given by `variants`.
fn map_sum_type<'c>(
@@ -55,7 +55,7 @@ pub trait TypeMapping {
variants: impl IntoIterator<Item = Vec<Self::OutV<'c>>>,
) -> Result<Self::SumOutV<'c>>;

/// Returns the result of the mapping on `function_type`, with auxilliary data
/// Returns the result of the mapping on `function_type`, with auxiliary data
/// `inv`, and when the result of mapping all inputs is given by `inputs`
/// and the result of mapping all outputs is given by `outputs`.
fn map_function_type<'c>(
@@ -113,7 +113,7 @@ impl<'a, TM: TypeMapping + 'a> TypeMap<'a, TM> {
}

/// Map `hugr_type` using the [TypeMapping] `TM`, the registered callbacks,
/// and the auxilliary data `inv`.
/// and the auxiliary data `inv`.
pub fn map_type<'c>(&self, hugr_type: &HugrType, inv: TM::InV<'c>) -> Result<TM::OutV<'c>> {
match hugr_type.as_type_enum() {
TypeEnum::Extension(custom_type) => {
2 changes: 1 addition & 1 deletion hugr-model/src/v0/text/print.rs
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ impl<'p, 'a: 'p> PrintContext<'p, 'a> {
result
}

/// Print a sequence of elements that are preferrably laid out together in the same line.
/// Print a sequence of elements that are preferably laid out together in the same line.
#[inline]
fn print_group<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T {
self.print_delimited("", "", 0, f)
8 changes: 4 additions & 4 deletions hugr-passes/src/const_fold.rs
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ impl ConstantFoldPass {
}

/// Specifies any number of external inputs to provide to the Hugr (on root-node
/// in-ports). Each supercedes any previous value on the same in-port.
/// in-ports). Each supersedes any previous value on the same in-port.
pub fn with_inputs(
mut self,
inputs: impl IntoIterator<Item = (impl Into<IncomingPort>, Value)>,
@@ -120,15 +120,15 @@ impl ConstantFoldPass {
})
.collect::<Vec<_>>();

for (n, inport, v) in wires_to_break {
for (n, import, v) in wires_to_break {
let parent = hugr.get_parent(n).unwrap();
let datatype = v.get_type();
// We could try hash-consing identical Consts, but not ATM
let cst = hugr.add_node_with_parent(parent, Const::new(v));
let lcst = hugr.add_node_with_parent(parent, LoadConstant { datatype });
hugr.connect(cst, OutgoingPort::from(0), lcst, IncomingPort::from(0));
hugr.disconnect(n, inport);
hugr.connect(lcst, OutgoingPort::from(0), n, inport);
hugr.disconnect(n, import);
hugr.connect(lcst, OutgoingPort::from(0), n, import);
}
for n in remove_nodes {
hugr.remove_node(n);

0 comments on commit 65a5d1f

Please sign in to comment.