diff --git a/nac3artiq/src/codegen.rs b/nac3artiq/src/codegen.rs index 68c62321..d5a53b16 100644 --- a/nac3artiq/src/codegen.rs +++ b/nac3artiq/src/codegen.rs @@ -130,7 +130,7 @@ impl<'a> ArtiqCodeGenerator<'a> { /// (possibly indirect) `parallel` block. /// /// * `store_name` - The LLVM value name for the pointer to `end`. `.addr` will be appended to - /// the end of the provided value name. + /// the end of the provided value name. fn timeline_update_end_max( &mut self, ctx: &mut CodeGenContext<'_, '_>, diff --git a/nac3core/src/codegen/builtin_fns.rs b/nac3core/src/codegen/builtin_fns.rs index 0aa89798..9914d81c 100644 --- a/nac3core/src/codegen/builtin_fns.rs +++ b/nac3core/src/codegen/builtin_fns.rs @@ -1076,9 +1076,9 @@ pub fn call_numpy_maximum<'ctx, G: CodeGenerator + ?Sized>( /// * `(arg_ty, arg_val)`: The [`Type`] and llvm value of the input argument. /// * `fn_name`: The name of the function, only used when throwing an error with [`unsupported_type`] /// * `get_ret_elem_type`: A function that takes in the input scalar [`Type`], and returns the function's return scalar [`Type`]. -/// Return a constant [`Type`] here if the return type does not depend on the input type. +/// Return a constant [`Type`] here if the return type does not depend on the input type. /// * `on_scalar`: The function that acts on the scalars of the input. Returns [`Option::None`] -/// if the scalar type & value are faulty and should panic with [`unsupported_type`]. +/// if the scalar type & value are faulty and should panic with [`unsupported_type`]. fn helper_call_numpy_unary_elementwise<'ctx, OnScalarFn, RetElemFn, G>( generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, @@ -1189,9 +1189,9 @@ pub fn call_abs<'ctx, G: CodeGenerator + ?Sized>( /// * `$name:ident`: The identifier of the rust function to be generated. /// * `$fn_name:literal`: To be passed to the `fn_name` parameter of [`helper_call_numpy_unary_elementwise`] /// * `$get_ret_elem_type:expr`: To be passed to the `get_ret_elem_type` parameter of [`helper_call_numpy_unary_elementwise`]. -/// But there is no need to make it a reference. +/// But there is no need to make it a reference. /// * `$on_scalar:expr`: To be passed to the `on_scalar` parameter of [`helper_call_numpy_unary_elementwise`]. -/// But there is no need to make it a reference. +/// But there is no need to make it a reference. macro_rules! create_helper_call_numpy_unary_elementwise { ($name:ident, $fn_name:literal, $get_ret_elem_type:expr, $on_scalar:expr) => { #[allow(clippy::redundant_closure_call)] @@ -1218,7 +1218,7 @@ macro_rules! create_helper_call_numpy_unary_elementwise { /// * `$name:ident`: The identifier of the rust function to be generated. /// * `$fn_name:literal`: To be passed to the `fn_name` parameter of [`helper_call_numpy_unary_elementwise`]. /// * `$on_scalar:expr`: The closure (see below for its type) that acts on float scalar values and returns -/// the boolean results of LLVM type `i1`. The returned `i1` value will be converted into an `i8`. +/// the boolean results of LLVM type `i1`. The returned `i1` value will be converted into an `i8`. /// /// ```ignore /// // Type of `$on_scalar:expr` diff --git a/nac3core/src/codegen/extern_fns.rs b/nac3core/src/codegen/extern_fns.rs index d3f252bd..5bbafd30 100644 --- a/nac3core/src/codegen/extern_fns.rs +++ b/nac3core/src/codegen/extern_fns.rs @@ -13,11 +13,11 @@ use crate::codegen::CodeGenContext; /// * `$extern_fn:literal`: Name of underlying extern function /// /// Optional Arguments: -/// * `$(,$attributes:literal)*)`: Attributes linked with the extern function -/// The default attributes are "mustprogress", "nofree", "nounwind", "willreturn", and "writeonly" -/// These will be used unless other attributes are specified +/// * `$(,$attributes:literal)*)`: Attributes linked with the extern function. +/// The default attributes are "mustprogress", "nofree", "nounwind", "willreturn", and "writeonly". +/// These will be used unless other attributes are specified /// * `$(,$args:ident)*`: Operands of the extern function -/// The data type of these operands will be set to `FloatValue` +/// The data type of these operands will be set to `FloatValue` /// macro_rules! generate_extern_fn { ("unary", $fn_name:ident, $extern_fn:literal) => { diff --git a/nac3core/src/codegen/generator.rs b/nac3core/src/codegen/generator.rs index 6406ba84..e0e89c30 100644 --- a/nac3core/src/codegen/generator.rs +++ b/nac3core/src/codegen/generator.rs @@ -57,8 +57,9 @@ pub trait CodeGenerator { /// - fun: Function signature, definition ID and the substitution key. /// - params: Function parameters. Note that this does not include the object even if the /// function is a class method. + /// /// Note that this function should check if the function is generated in another thread (due to - /// possible race condition), see the default implementation for an example. + /// possible race condition), see the default implementation for an example. fn gen_func_instance<'ctx>( &mut self, ctx: &mut CodeGenContext<'ctx, '_>, diff --git a/nac3core/src/codegen/irrt/mod.rs b/nac3core/src/codegen/irrt/mod.rs index 5866f7ee..53b3aba6 100644 --- a/nac3core/src/codegen/irrt/mod.rs +++ b/nac3core/src/codegen/irrt/mod.rs @@ -568,7 +568,7 @@ pub fn call_j0<'ctx>(ctx: &CodeGenContext<'ctx, '_>, v: FloatValue<'ctx>) -> Flo /// /// * `dims` - An [`ArrayLikeIndexer`] containing the size of each dimension. /// * `range` - The dimension index to begin and end (exclusively) calculating the dimensions for, -/// or [`None`] if starting from the first dimension and ending at the last dimension respectively. +/// or [`None`] if starting from the first dimension and ending at the last dimension respectively. pub fn call_ndarray_calc_size<'ctx, G, Dims>( generator: &G, ctx: &CodeGenContext<'ctx, '_>, @@ -620,7 +620,7 @@ where /// /// * `index` - The index to compute the multidimensional index for. /// * `ndarray` - LLVM pointer to the `NDArray`. This value must be the LLVM representation of an -/// `NDArray`. +/// `NDArray`. pub fn call_ndarray_calc_nd_indices<'ctx, G: CodeGenerator + ?Sized>( generator: &G, ctx: &mut CodeGenContext<'ctx, '_>, @@ -744,7 +744,7 @@ where /// multidimensional index. /// /// * `ndarray` - LLVM pointer to the `NDArray`. This value must be the LLVM representation of an -/// `NDArray`. +/// `NDArray`. /// * `indices` - The multidimensional index to compute the flattened index for. pub fn call_ndarray_flatten_index<'ctx, G, Index>( generator: &mut G, diff --git a/nac3core/src/codegen/llvm_intrinsics.rs b/nac3core/src/codegen/llvm_intrinsics.rs index 6e878715..ade0f917 100644 --- a/nac3core/src/codegen/llvm_intrinsics.rs +++ b/nac3core/src/codegen/llvm_intrinsics.rs @@ -205,8 +205,8 @@ pub fn call_memcpy_generic<'ctx>( /// * `$ctx:ident`: Reference to the current Code Generation Context /// * `$name:ident`: Optional name to be assigned to the llvm build call (Option<&str>) /// * `$llvm_name:literal`: Name of underlying llvm intrinsic function -/// * `$map_fn:ident`: Mapping function to be applied on `BasicValue` (`BasicValue` -> Function Return Type) -/// Use `BasicValueEnum::into_int_value` for Integer return type and `BasicValueEnum::into_float_value` for Float return type +/// * `$map_fn:ident`: Mapping function to be applied on `BasicValue` (`BasicValue` -> Function Return Type). +/// Use `BasicValueEnum::into_int_value` for Integer return type and `BasicValueEnum::into_float_value` for Float return type /// * `$llvm_ty:ident`: Type of first operand /// * `,($val:ident)*`: Comma separated list of operands macro_rules! generate_llvm_intrinsic_fn_body { @@ -222,8 +222,8 @@ macro_rules! generate_llvm_intrinsic_fn_body { /// Arguments: /// * `float/int`: Indicates the return and argument type of the function /// * `$fn_name:ident`: The identifier of the rust function to be generated -/// * `$llvm_name:literal`: Name of underlying llvm intrinsic function -/// Omit "llvm." prefix from the function name i.e. use "ceil" instead of "llvm.ceil" +/// * `$llvm_name:literal`: Name of underlying llvm intrinsic function. +/// Omit "llvm." prefix from the function name i.e. use "ceil" instead of "llvm.ceil" /// * `$val:ident`: The operand for unary operations /// * `$val1:ident`, `$val2:ident`: The operands for binary operations macro_rules! generate_llvm_intrinsic_fn { diff --git a/nac3core/src/codegen/numpy.rs b/nac3core/src/codegen/numpy.rs index ff8c55eb..6c526928 100644 --- a/nac3core/src/codegen/numpy.rs +++ b/nac3core/src/codegen/numpy.rs @@ -1071,15 +1071,15 @@ fn call_ndarray_eye_impl<'ctx, G: CodeGenerator + ?Sized>( /// Copies a slice of an [`NDArrayValue`] to another. /// /// - `dst_arr`: The [`NDArrayValue`] instance of the destination array. The `ndims` and `dim_sz` -/// fields should be populated before calling this function. +/// fields should be populated before calling this function. /// - `dst_slice_ptr`: The [`PointerValue`] to the first element of the currently processing -/// dimensional slice in the destination array. +/// dimensional slice in the destination array. /// - `src_arr`: The [`NDArrayValue`] instance of the source array. /// - `src_slice_ptr`: The [`PointerValue`] to the first element of the currently processing -/// dimensional slice in the source array. +/// dimensional slice in the source array. /// - `dim`: The index of the currently processing dimension. /// - `slices`: List of all slices, with the first element corresponding to the slice applicable to -/// this dimension. The `start`/`stop` values of each slice must be non-negative indices. +/// this dimension. The `start`/`stop` values of each slice must be non-negative indices. fn ndarray_sliced_copyto_impl<'ctx, G: CodeGenerator + ?Sized>( generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, @@ -1184,7 +1184,7 @@ fn ndarray_sliced_copyto_impl<'ctx, G: CodeGenerator + ?Sized>( /// /// * `elem_ty` - The element type of the `NDArray`. /// - `slices`: List of all slices, with the first element corresponding to the slice applicable to -/// this dimension. The `start`/`stop` values of each slice must be positive indices. +/// this dimension. The `start`/`stop` values of each slice must be positive indices. pub fn ndarray_sliced_copy<'ctx, G: CodeGenerator + ?Sized>( generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, @@ -1349,7 +1349,7 @@ where /// /// * `elem_ty` - The element type of the `NDArray`. /// * `res` - The `ndarray` instance to write results into, or [`None`] if the result should be -/// written to a new `ndarray`. +/// written to a new `ndarray`. /// * `value_fn` - Function mapping the two input elements into the result. /// /// # Panic @@ -1436,7 +1436,7 @@ where /// /// * `elem_ty` - The element type of the `NDArray`. /// * `res` - The `ndarray` instance to write results into, or [`None`] if the result should be -/// written to a new `ndarray`. +/// written to a new `ndarray`. pub fn ndarray_matmul_2d<'ctx, G: CodeGenerator>( generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, @@ -2140,11 +2140,11 @@ pub fn ndarray_transpose<'ctx, G: CodeGenerator + ?Sized>( /// /// * `x1` - `NDArray` to reshape. /// * `shape` - The `shape` parameter used to construct the new `NDArray`. -/// Just like numpy, the `shape` argument can be: +/// Just like numpy, the `shape` argument can be: /// 1. A list of `int32`; e.g., `np.reshape(arr, [600, -1, 3])` /// 2. A tuple of `int32`; e.g., `np.reshape(arr, (-1, 800, 3))` /// 3. A scalar `int32`; e.g., `np.reshape(arr, 3)` -/// Note that unlike other generating functions, one of the dimesions in the shape can be negative +/// Note that unlike other generating functions, one of the dimesions in the shape can be negative pub fn ndarray_reshape<'ctx, G: CodeGenerator + ?Sized>( generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, diff --git a/nac3core/src/codegen/stmt.rs b/nac3core/src/codegen/stmt.rs index 92d3d16e..081a5cef 100644 --- a/nac3core/src/codegen/stmt.rs +++ b/nac3core/src/codegen/stmt.rs @@ -619,9 +619,9 @@ pub struct BreakContinueHooks<'ctx> { /// ``` /// /// * `init` - A lambda containing IR statements declaring and initializing loop variables. The -/// return value is a [Clone] value which will be passed to the other lambdas. +/// return value is a [Clone] value which will be passed to the other lambdas. /// * `cond` - A lambda containing IR statements checking whether the loop should continue -/// executing. The result value must be an `i1` indicating if the loop should continue. +/// executing. The result value must be an `i1` indicating if the loop should continue. /// * `body` - A lambda containing IR statements within the loop body. /// * `update` - A lambda containing IR statements updating loop variables. pub fn gen_for_callback<'ctx, 'a, G, I, InitFn, CondFn, BodyFn, UpdateFn>( @@ -704,9 +704,9 @@ where /// ``` /// /// * `init_val` - The initial value of the loop variable. The type of this value will also be used -/// as the type of the loop variable. +/// as the type of the loop variable. /// * `max_val` - A tuple containing the maximum value of the loop variable, and whether the maximum -/// value should be treated as inclusive (as opposed to exclusive). +/// value should be treated as inclusive (as opposed to exclusive). /// * `body` - A lambda containing IR statements within the loop body. /// * `incr_val` - The value to increment the loop variable on each iteration. pub fn gen_for_callback_incrementing<'ctx, 'a, G, BodyFn>( @@ -777,12 +777,12 @@ where /// /// - `is_unsigned`: Whether to treat the values of the `range` as unsigned. /// - `start_fn`: A lambda of IR statements that retrieves the `start` value of the `range`-like -/// iterable. +/// iterable. /// - `stop_fn`: A lambda of IR statements that retrieves the `stop` value of the `range`-like -/// iterable. This value will be extended to the size of `start`. +/// iterable. This value will be extended to the size of `start`. /// - `stop_inclusive`: Whether the stop value should be treated as inclusive. /// - `step_fn`: A lambda of IR statements that retrieves the `step` value of the `range`-like -/// iterable. This value will be extended to the size of `start`. +/// iterable. This value will be extended to the size of `start`. /// - `body_fn`: A lambda of IR statements within the loop body. #[allow(clippy::too_many_arguments)] pub fn gen_for_range_callback<'ctx, 'a, G, StartFn, StopFn, StepFn, BodyFn>( diff --git a/nac3core/src/toplevel/builtins.rs b/nac3core/src/toplevel/builtins.rs index 2fef5eb4..e2325ebb 100644 --- a/nac3core/src/toplevel/builtins.rs +++ b/nac3core/src/toplevel/builtins.rs @@ -112,7 +112,7 @@ pub fn get_exn_constructor( /// * `name`: The name of the implemented NumPy function. /// * `ret_ty`: The return type of this function. /// * `param_ty`: The parameters accepted by this function, represented by a tuple of the -/// [parameter type][Type] and the parameter symbol name. +/// [parameter type][Type] and the parameter symbol name. /// * `codegen_callback`: A lambda generating LLVM IR for the implementation of this function. fn create_fn_by_codegen( unifier: &mut Unifier, @@ -152,7 +152,7 @@ fn create_fn_by_codegen( /// * `name`: The name of the implemented NumPy function. /// * `ret_ty`: The return type of this function. /// * `param_ty`: The parameters accepted by this function, represented by a tuple of the -/// [parameter type][Type] and the parameter symbol name. +/// [parameter type][Type] and the parameter symbol name. /// * `intrinsic_fn`: The fully-qualified name of the LLVM intrinsic function. fn create_fn_by_intrinsic( unifier: &mut Unifier, @@ -214,10 +214,10 @@ fn create_fn_by_intrinsic( /// * `name`: The name of the implemented NumPy function. /// * `ret_ty`: The return type of this function. /// * `param_ty`: The parameters accepted by this function, represented by a tuple of the -/// [parameter type][Type] and the parameter symbol name. +/// [parameter type][Type] and the parameter symbol name. /// * `extern_fn`: The fully-qualified name of the extern function used as the implementation. /// * `attrs`: The list of attributes to apply to this function declaration. Note that `nounwind` is -/// already implied by the C ABI. +/// already implied by the C ABI. fn create_fn_by_extern( unifier: &mut Unifier, var_map: &VarMap, diff --git a/nac3core/src/toplevel/mod.rs b/nac3core/src/toplevel/mod.rs index 7dfd8373..098a2a58 100644 --- a/nac3core/src/toplevel/mod.rs +++ b/nac3core/src/toplevel/mod.rs @@ -130,14 +130,14 @@ pub enum TopLevelDef { /// Function instance to symbol mapping /// /// * Key: String representation of type variable values, sorted by variable ID in ascending - /// order, including type variables associated with the class. + /// order, including type variables associated with the class. /// * Value: Function symbol name. instance_to_symbol: HashMap, /// Function instances to annotated AST mapping /// /// * Key: String representation of type variable values, sorted by variable ID in ascending - /// order, including type variables associated with the class. Excluding rigid type - /// variables. + /// order, including type variables associated with the class. Excluding rigid type + /// variables. /// /// Rigid type variables that would be substituted when the function is instantiated. instance_to_stmt: HashMap, diff --git a/nac3core/src/toplevel/numpy.rs b/nac3core/src/toplevel/numpy.rs index 63f6173d..168658b6 100644 --- a/nac3core/src/toplevel/numpy.rs +++ b/nac3core/src/toplevel/numpy.rs @@ -10,9 +10,9 @@ use itertools::Itertools; /// Creates a `ndarray` [`Type`] with the given type arguments. /// /// * `dtype` - The element type of the `ndarray`, or [`None`] if the type variable is not -/// specialized. +/// specialized. /// * `ndims` - The number of dimensions of the `ndarray`, or [`None`] if the type variable is not -/// specialized. +/// specialized. pub fn make_ndarray_ty( unifier: &mut Unifier, primitives: &PrimitiveStore, @@ -25,9 +25,9 @@ pub fn make_ndarray_ty( /// Substitutes type variables in `ndarray`. /// /// * `dtype` - The element type of the `ndarray`, or [`None`] if the type variable is not -/// specialized. +/// specialized. /// * `ndims` - The number of dimensions of the `ndarray`, or [`None`] if the type variable is not -/// specialized. +/// specialized. pub fn subst_ndarray_tvars( unifier: &mut Unifier, ndarray: Type, diff --git a/nac3core/src/toplevel/type_annotation.rs b/nac3core/src/toplevel/type_annotation.rs index 827f5330..d997f176 100644 --- a/nac3core/src/toplevel/type_annotation.rs +++ b/nac3core/src/toplevel/type_annotation.rs @@ -64,9 +64,9 @@ impl TypeAnnotation { /// Parses an AST expression `expr` into a [`TypeAnnotation`]. /// /// * `locked` - A [`HashMap`] containing the IDs of known definitions, mapped to a [`Vec`] of all -/// generic variables associated with the definition. +/// generic variables associated with the definition. /// * `type_var` - The type variable associated with the type argument currently being parsed. Pass -/// [`None`] when this function is invoked externally. +/// [`None`] when this function is invoked externally. pub fn parse_ast_to_type_annotation_kinds( resolver: &(dyn SymbolResolver + Send + Sync), top_level_defs: &[Arc>], diff --git a/nac3ld/src/dwarf.rs b/nac3ld/src/dwarf.rs index 7e9623d8..e601b210 100644 --- a/nac3ld/src/dwarf.rs +++ b/nac3ld/src/dwarf.rs @@ -238,7 +238,7 @@ impl<'a> EH_Frame<'a> { /// From the [specification](https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html): /// /// > Each CFI record contains a Common Information Entry (CIE) record followed by 1 or more Frame -/// Description Entry (FDE) records. +/// > Description Entry (FDE) records. pub struct CFI_Record<'a> { // It refers to the augmentation data that corresponds to 'R' in the augmentation string fde_pointer_encoding: u8,