From cc4417ce02a2c5d3ded1392a4fd83b9e586d4768 Mon Sep 17 00:00:00 2001
From: Justin Traglia <jtraglia@pm.me>
Date: Mon, 5 Feb 2024 14:35:17 -0600
Subject: [PATCH] Fix several typos

---
 bindgen-integration/build.rs     |  2 +-
 bindgen/clang.rs                 |  2 +-
 bindgen/codegen/serialize.rs     |  2 +-
 bindgen/ir/annotations.rs        |  2 +-
 bindgen/ir/comp.rs               |  2 +-
 bindgen/ir/context.rs            |  2 +-
 bindgen/ir/item_kind.rs          | 14 +++++++-------
 bindgen/ir/objc.rs               |  4 ++--
 bindgen/ir/ty.rs                 |  6 +++---
 bindgen/lib.rs                   |  2 +-
 bindgen/options/mod.rs           |  6 +++---
 book/src/cpp.md                  |  2 +-
 book/src/non-system-libraries.md |  2 +-
 book/src/objc.md                 |  2 +-
 14 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/bindgen-integration/build.rs b/bindgen-integration/build.rs
index ce4a3200af..7021f865d7 100644
--- a/bindgen-integration/build.rs
+++ b/bindgen-integration/build.rs
@@ -279,7 +279,7 @@ fn setup_wrap_static_fns_test() {
 
     bindings
         .write_to_file(out_rust_file)
-        .expect("Cound not write bindings to the Rust file");
+        .expect("Could not write bindings to the Rust file");
 }
 
 fn main() {
diff --git a/bindgen/clang.rs b/bindgen/clang.rs
index 4a4ed89d69..a9a0ec814f 100644
--- a/bindgen/clang.rs
+++ b/bindgen/clang.rs
@@ -874,7 +874,7 @@ impl Cursor {
         unsafe { clang_getCXXAccessSpecifier(self.x) }
     }
 
-    /// Is the cursor's referrent publically accessible in C++?
+    /// Is the cursor's referent publically accessible in C++?
     ///
     /// Returns true if self.access_specifier() is `CX_CXXPublic` or
     /// `CX_CXXInvalidAccessSpecifier`.
diff --git a/bindgen/codegen/serialize.rs b/bindgen/codegen/serialize.rs
index 9765a8bdf2..7f00f809f4 100644
--- a/bindgen/codegen/serialize.rs
+++ b/bindgen/codegen/serialize.rs
@@ -81,7 +81,7 @@ impl<'a> CSerialize<'a> for Function {
 
         let name = self.name();
 
-        // Function argoments stored as `(name, type_id)` tuples.
+        // Function arguments stored as `(name, type_id)` tuples.
         let args = {
             let mut count = 0;
 
diff --git a/bindgen/ir/annotations.rs b/bindgen/ir/annotations.rs
index d085f5c574..9165f3d39a 100644
--- a/bindgen/ir/annotations.rs
+++ b/bindgen/ir/annotations.rs
@@ -8,7 +8,7 @@ use std::str::FromStr;
 
 use crate::clang;
 
-/// What kind of visibility modifer should be used for a struct or field?
+/// What kind of visibility modifier should be used for a struct or field?
 #[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Clone, Debug)]
 pub enum FieldVisibilityKind {
     /// Fields are marked as private, i.e., struct Foo {bar: bool}
diff --git a/bindgen/ir/comp.rs b/bindgen/ir/comp.rs
index fed6ba8ac8..bd4d016261 100644
--- a/bindgen/ir/comp.rs
+++ b/bindgen/ir/comp.rs
@@ -147,7 +147,7 @@ pub(crate) trait FieldMethods {
     /// If this is a bitfield, how many bits does it need?
     fn bitfield_width(&self) -> Option<u32>;
 
-    /// Is this feild declared public?
+    /// Is this field declared public?
     fn is_public(&self) -> bool;
 
     /// Get the annotations for this field.
diff --git a/bindgen/ir/context.rs b/bindgen/ir/context.rs
index 517d3365b6..f13f34abcd 100644
--- a/bindgen/ir/context.rs
+++ b/bindgen/ir/context.rs
@@ -36,7 +36,7 @@ use std::mem;
 #[derive(Debug, Copy, Clone, Eq, PartialOrd, Ord, Hash)]
 pub(crate) struct ItemId(usize);
 
-/// Declare a newtype around `ItemId` with convesion methods.
+/// Declare a newtype around `ItemId` with conversion methods.
 macro_rules! item_id_newtype {
     (
         $( #[$attr:meta] )*
diff --git a/bindgen/ir/item_kind.rs b/bindgen/ir/item_kind.rs
index e8618498ad..9221b50579 100644
--- a/bindgen/ir/item_kind.rs
+++ b/bindgen/ir/item_kind.rs
@@ -26,7 +26,7 @@ pub(crate) enum ItemKind {
 }
 
 impl ItemKind {
-    /// Get a reference to this `ItemKind`'s underying `Module`, or `None` if it
+    /// Get a reference to this `ItemKind`'s underlying `Module`, or `None` if it
     /// is some other kind.
     pub(crate) fn as_module(&self) -> Option<&Module> {
         match *self {
@@ -50,7 +50,7 @@ impl ItemKind {
         self.as_module().is_some()
     }
 
-    /// Get a reference to this `ItemKind`'s underying `Function`, or `None` if
+    /// Get a reference to this `ItemKind`'s underlying `Function`, or `None` if
     /// it is some other kind.
     pub(crate) fn as_function(&self) -> Option<&Function> {
         match *self {
@@ -64,13 +64,13 @@ impl ItemKind {
         self.as_function().is_some()
     }
 
-    /// Get a reference to this `ItemKind`'s underying `Function`, or panic if
+    /// Get a reference to this `ItemKind`'s underlying `Function`, or panic if
     /// it is some other kind.
     pub(crate) fn expect_function(&self) -> &Function {
         self.as_function().expect("Not a function")
     }
 
-    /// Get a reference to this `ItemKind`'s underying `Type`, or `None` if
+    /// Get a reference to this `ItemKind`'s underlying `Type`, or `None` if
     /// it is some other kind.
     pub(crate) fn as_type(&self) -> Option<&Type> {
         match *self {
@@ -79,7 +79,7 @@ impl ItemKind {
         }
     }
 
-    /// Get a mutable reference to this `ItemKind`'s underying `Type`, or `None`
+    /// Get a mutable reference to this `ItemKind`'s underlying `Type`, or `None`
     /// if it is some other kind.
     pub(crate) fn as_type_mut(&mut self) -> Option<&mut Type> {
         match *self {
@@ -93,13 +93,13 @@ impl ItemKind {
         self.as_type().is_some()
     }
 
-    /// Get a reference to this `ItemKind`'s underying `Type`, or panic if it is
+    /// Get a reference to this `ItemKind`'s underlying `Type`, or panic if it is
     /// some other kind.
     pub(crate) fn expect_type(&self) -> &Type {
         self.as_type().expect("Not a type")
     }
 
-    /// Get a reference to this `ItemKind`'s underying `Var`, or `None` if it is
+    /// Get a reference to this `ItemKind`'s underlying `Var`, or `None` if it is
     /// some other kind.
     pub(crate) fn as_var(&self) -> Option<&Var> {
         match *self {
diff --git a/bindgen/ir/objc.rs b/bindgen/ir/objc.rs
index 93d8b3bfdf..d7f7cc65a6 100644
--- a/bindgen/ir/objc.rs
+++ b/bindgen/ir/objc.rs
@@ -39,7 +39,7 @@ pub(crate) struct ObjCInterface {
     /// The direct parent for this interface.
     pub(crate) parent_class: Option<ItemId>,
 
-    /// List of the methods defined in this interfae
+    /// List of the methods defined in this interface
     methods: Vec<ObjCMethod>,
 
     class_methods: Vec<ObjCMethod>,
@@ -137,7 +137,7 @@ impl ObjCInterface {
                 CXCursor_ObjCClassRef => {
                     if cursor.kind() == CXCursor_ObjCCategoryDecl {
                         // We are actually a category extension, and we found the reference
-                        // to the original interface, so name this interface approriately
+                        // to the original interface, so name this interface appropriately
                         interface.name = c.spelling();
                         interface.category = Some(cursor.spelling());
                     }
diff --git a/bindgen/ir/ty.rs b/bindgen/ir/ty.rs
index b7a429323e..2a24dd0291 100644
--- a/bindgen/ir/ty.rs
+++ b/bindgen/ir/ty.rs
@@ -252,7 +252,7 @@ impl Type {
         Cow::Owned(name)
     }
 
-    /// Get this type's santizied name.
+    /// Get this type's sanitized name.
     pub(crate) fn sanitized_name<'a>(
         &'a self,
         ctx: &BindgenContext,
@@ -498,7 +498,7 @@ fn is_invalid_type_param_invalid_start() {
 }
 
 #[test]
-fn is_invalid_type_param_invalid_remaing() {
+fn is_invalid_type_param_invalid_remaining() {
     let ty = Type::new(Some("foo-".into()), None, TypeKind::TypeParam, false);
     assert!(ty.is_invalid_type_param())
 }
@@ -1092,7 +1092,7 @@ impl Type {
                         Item::from_ty_or_ref(inner, location, None, ctx);
                     if inner_id == potential_id {
                         warn!(
-                            "Generating oqaque type instead of self-referential \
+                            "Generating opaque type instead of self-referential \
                             typedef");
                         // This can happen if we bail out of recursive situations
                         // within the clang parsing.
diff --git a/bindgen/lib.rs b/bindgen/lib.rs
index c4ab11486c..d2e22b9438 100644
--- a/bindgen/lib.rs
+++ b/bindgen/lib.rs
@@ -144,7 +144,7 @@ impl CodegenConfig {
         self.contains(CodegenConfig::VARS)
     }
 
-    /// Returns true if methds should be generated.
+    /// Returns true if methods should be generated.
     pub fn methods(self) -> bool {
         self.contains(CodegenConfig::METHODS)
     }
diff --git a/bindgen/options/mod.rs b/bindgen/options/mod.rs
index 1fc2241615..7a16de4b4d 100644
--- a/bindgen/options/mod.rs
+++ b/bindgen/options/mod.rs
@@ -508,7 +508,7 @@ options! {
     constified_enums: RegexSet {
         methods: {
             regex_option! {
-                /// Mark the given `enum` as a set o integer constants.
+                /// Mark the given `enum` as a set of integer constants.
                 ///
                 /// This is similar to the [`Builder::constified_enum_module`] style, but the
                 /// constants are generated in the current module instead of in a new module.
@@ -1814,7 +1814,7 @@ options! {
         },
         as_args: "--dynamic-loading",
     },
-    /// Whether to equire successful linkage for all routines in a shared library.
+    /// Whether to require successful linkage for all routines in a shared library.
     dynamic_link_require_all: bool {
         methods: {
             /// Set whether to require successful linkage for all routines in a shared library.
@@ -1879,7 +1879,7 @@ options! {
         },
         as_args: "--c-naming",
     },
-    /// Wether to always emit explicit padding fields.
+    /// Whether to always emit explicit padding fields.
     force_explicit_padding: bool {
         methods: {
             /// Set whether to always emit explicit padding fields.
diff --git a/book/src/cpp.md b/book/src/cpp.md
index f5091b355e..9b451b9d35 100644
--- a/book/src/cpp.md
+++ b/book/src/cpp.md
@@ -74,7 +74,7 @@ cannot translate into Rust:
   
 * Many C++ specific aspects of calling conventions. For example in the Itanium abi types that are 
   "[non trivial for the purposes of calls](https://itanium-cxx-abi.github.io/cxx-abi/abi.html#non-trivial)" 
-  should be passed by pointer, even if they are otherwise eligable to be passed in a register.
+  should be passed by pointer, even if they are otherwise eligible to be passed in a register.
   Similarly in both the Itanium and MSVC ABIs such types are returned by "hidden parameter", much like
   large structs in C that would not fit into a register. This also applies to types with any base classes
   in the MSVC ABI (see [x64 calling convention](https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#return-values)).
diff --git a/book/src/non-system-libraries.md b/book/src/non-system-libraries.md
index 1bb19e4d0b..d5d288d101 100644
--- a/book/src/non-system-libraries.md
+++ b/book/src/non-system-libraries.md
@@ -14,7 +14,7 @@ int hello();
 
 Given that the library has not been compiled yet, we need to modify the
 `build.rs` build script to compile the `hello.c` source file into a static
-libary:
+library:
 
 ```rust,ignore
 extern crate bindgen;
diff --git a/book/src/objc.md b/book/src/objc.md
index ce6d756761..ed6f2cb881 100644
--- a/book/src/objc.md
+++ b/book/src/objc.md
@@ -18,7 +18,7 @@ objc::runtime::Object` (the pointer to the objective-c instance). The trait
 `IFoo` is needed to allow for the generated inheritance.
 
 Functions that use or return objective-c pointers of instance `Foo` will return
-`Foo`. The reason this works is beacuse `Foo` represented as `transparent`.
+`Foo`. The reason this works is because `Foo` represented as `transparent`.
 This will be helpful for a lot of objective-c frameworks however there are some
 cases where functions return `instancetype` which is a type alias for `id` so
 an occasional `foo.0` may be required. An example of this would in the UIKit