Use integer standard library types from std namespace

The implementation is not required to define these types in the global
namespace.
diff --git a/gen/src/builtin.rs b/gen/src/builtin.rs
index b32443c..1de36e1 100644
--- a/gen/src/builtin.rs
+++ b/gen/src/builtin.rs
@@ -147,7 +147,7 @@
         writeln!(out, "struct operator_new {{");
         writeln!(
             out,
-            "  void *operator()(size_t sz) {{ return ::operator new(sz); }}",
+            "  void *operator()(::std::size_t sz) {{ return ::operator new(sz); }}",
         );
         writeln!(out, "}};");
         out.next_section();
@@ -158,7 +158,7 @@
         );
         writeln!(
             out,
-            "  void *operator()(size_t sz) {{ return T::operator new(sz); }}",
+            "  void *operator()(::std::size_t sz) {{ return T::operator new(sz); }}",
         );
         writeln!(out, "}};");
     }
@@ -187,7 +187,7 @@
         writeln!(out, "  T value;");
         writeln!(
             out,
-            "  void *operator new(size_t sz) {{ return detail::operator_new<T>{{}}(sz); }}",
+            "  void *operator new(::std::size_t sz) {{ return detail::operator_new<T>{{}}(sz); }}",
         );
         writeln!(out, "  MaybeUninit() {{}}");
         writeln!(out, "  ~MaybeUninit() {{}}");
@@ -201,7 +201,7 @@
         out.begin_block(Block::Namespace("repr"));
         writeln!(out, "struct PtrLen final {{");
         writeln!(out, "  void *ptr;");
-        writeln!(out, "  size_t len;");
+        writeln!(out, "  ::std::size_t len;");
         writeln!(out, "}};");
         out.end_block(Block::Namespace("repr"));
     }
@@ -281,7 +281,7 @@
         include.cstddef = true;
         include.type_traits = true;
         out.next_section();
-        writeln!(out, "template <typename T, typename = size_t>");
+        writeln!(out, "template <typename T, typename = ::std::size_t>");
         writeln!(out, "struct is_complete : std::false_type {{}};");
         out.next_section();
         writeln!(out, "template <typename T>");
@@ -338,7 +338,7 @@
         out.begin_block(Block::ExternC);
         writeln!(
             out,
-            "const char *cxxbridge1$exception(const char *, size_t);",
+            "const char *cxxbridge1$exception(const char *, ::std::size_t);",
         );
         out.end_block(Block::ExternC);
     }
diff --git a/gen/src/write.rs b/gen/src/write.rs
index 44978f1..812c324 100644
--- a/gen/src/write.rs
+++ b/gen/src/write.rs
@@ -164,7 +164,7 @@
                 writeln!(out, "template <> struct hash<{}> {{", qualified);
                 writeln!(
                     out,
-                    "  size_t operator()(const {} &self) const noexcept {{",
+                    "  ::std::size_t operator()(const {} &self) const noexcept {{",
                     qualified,
                 );
                 let link_name = mangle::operator(&strct.name, "hash");
@@ -473,7 +473,7 @@
         let link_name = mangle::operator(&strct.name, "hash");
         writeln!(
             out,
-            "size_t {}(const {} &) noexcept;",
+            "::std::size_t {}(const {} &) noexcept;",
             link_name, strct.name.cxx,
         );
     }
@@ -1165,15 +1165,15 @@
     match atom {
         Bool => write!(out, "bool"),
         Char => write!(out, "char"),
-        U8 => write!(out, "uint8_t"),
-        U16 => write!(out, "uint16_t"),
-        U32 => write!(out, "uint32_t"),
-        U64 => write!(out, "uint64_t"),
-        Usize => write!(out, "size_t"),
-        I8 => write!(out, "int8_t"),
-        I16 => write!(out, "int16_t"),
-        I32 => write!(out, "int32_t"),
-        I64 => write!(out, "int64_t"),
+        U8 => write!(out, "::std::uint8_t"),
+        U16 => write!(out, "::std::uint16_t"),
+        U32 => write!(out, "::std::uint32_t"),
+        U64 => write!(out, "::std::uint64_t"),
+        Usize => write!(out, "::std::size_t"),
+        I8 => write!(out, "::std::int8_t"),
+        I16 => write!(out, "::std::int16_t"),
+        I32 => write!(out, "::std::int32_t"),
+        I64 => write!(out, "::std::int64_t"),
         Isize => write!(out, "::rust::isize"),
         F32 => write!(out, "float"),
         F64 => write!(out, "double"),
@@ -1384,12 +1384,12 @@
     );
     writeln!(
         out,
-        "size_t cxxbridge1$rust_vec${}$len(const ::rust::Vec<{}> *ptr) noexcept;",
+        "::std::size_t cxxbridge1$rust_vec${}$len(const ::rust::Vec<{}> *ptr) noexcept;",
         instance, inner,
     );
     writeln!(
         out,
-        "size_t cxxbridge1$rust_vec${}$capacity(const ::rust::Vec<{}> *ptr) noexcept;",
+        "::std::size_t cxxbridge1$rust_vec${}$capacity(const ::rust::Vec<{}> *ptr) noexcept;",
         instance, inner,
     );
     writeln!(
@@ -1399,17 +1399,17 @@
     );
     writeln!(
         out,
-        "void cxxbridge1$rust_vec${}$reserve_total(::rust::Vec<{}> *ptr, size_t cap) noexcept;",
+        "void cxxbridge1$rust_vec${}$reserve_total(::rust::Vec<{}> *ptr, ::std::size_t cap) noexcept;",
         instance, inner,
     );
     writeln!(
         out,
-        "void cxxbridge1$rust_vec${}$set_len(::rust::Vec<{}> *ptr, size_t len) noexcept;",
+        "void cxxbridge1$rust_vec${}$set_len(::rust::Vec<{}> *ptr, ::std::size_t len) noexcept;",
         instance, inner,
     );
     writeln!(
         out,
-        "size_t cxxbridge1$rust_vec${}$stride() noexcept;",
+        "::std::size_t cxxbridge1$rust_vec${}$stride() noexcept;",
         instance,
     );
     writeln!(out, "#endif // CXXBRIDGE1_RUST_VEC_{}", instance);
@@ -1460,12 +1460,20 @@
     writeln!(out, "}}");
 
     writeln!(out, "template <>");
-    writeln!(out, "size_t Vec<{}>::size() const noexcept {{", inner);
+    writeln!(
+        out,
+        "::std::size_t Vec<{}>::size() const noexcept {{",
+        inner,
+    );
     writeln!(out, "  return cxxbridge1$rust_vec${}$len(this);", instance);
     writeln!(out, "}}");
 
     writeln!(out, "template <>");
-    writeln!(out, "size_t Vec<{}>::capacity() const noexcept {{", inner);
+    writeln!(
+        out,
+        "::std::size_t Vec<{}>::capacity() const noexcept {{",
+        inner,
+    );
     writeln!(
         out,
         "  return cxxbridge1$rust_vec${}$capacity(this);",
@@ -1481,7 +1489,7 @@
     writeln!(out, "template <>");
     writeln!(
         out,
-        "void Vec<{}>::reserve_total(size_t cap) noexcept {{",
+        "void Vec<{}>::reserve_total(::std::size_t cap) noexcept {{",
         inner,
     );
     writeln!(
@@ -1492,7 +1500,11 @@
     writeln!(out, "}}");
 
     writeln!(out, "template <>");
-    writeln!(out, "void Vec<{}>::set_len(size_t len) noexcept {{", inner);
+    writeln!(
+        out,
+        "void Vec<{}>::set_len(::std::size_t len) noexcept {{",
+        inner,
+    );
     writeln!(
         out,
         "  return cxxbridge1$rust_vec${}$set_len(this, len);",
@@ -1501,7 +1513,7 @@
     writeln!(out, "}}");
 
     writeln!(out, "template <>");
-    writeln!(out, "size_t Vec<{}>::stride() noexcept {{", inner);
+    writeln!(out, "::std::size_t Vec<{}>::stride() noexcept {{", inner);
     writeln!(out, "  return cxxbridge1$rust_vec${}$stride();", instance);
     writeln!(out, "}}");
 }
@@ -1716,14 +1728,14 @@
     writeln!(out, "#define CXXBRIDGE1_VECTOR_{}", instance);
     writeln!(
         out,
-        "size_t cxxbridge1$std$vector${}$size(const ::std::vector<{}> &s) noexcept {{",
+        "::std::size_t cxxbridge1$std$vector${}$size(const ::std::vector<{}> &s) noexcept {{",
         instance, inner,
     );
     writeln!(out, "  return s.size();");
     writeln!(out, "}}");
     writeln!(
         out,
-        "const {} *cxxbridge1$std$vector${}$get_unchecked(const ::std::vector<{}> &s, size_t pos) noexcept {{",
+        "const {} *cxxbridge1$std$vector${}$get_unchecked(const ::std::vector<{}> &s, ::std::size_t pos) noexcept {{",
         inner, instance, inner,
     );
     writeln!(out, "  return &s[pos];");
diff --git a/include/cxx.h b/include/cxx.h
index 227b3fc..f41dde7 100644
--- a/include/cxx.h
+++ b/include/cxx.h
@@ -41,7 +41,7 @@
 
   String(const std::string &);
   String(const char *);
-  String(const char *, size_t);
+  String(const char *, std::size_t);
 
   String &operator=(const String &) noexcept;
   String &operator=(String &&) noexcept;
@@ -50,8 +50,8 @@
 
   // Note: no null terminator.
   const char *data() const noexcept;
-  size_t size() const noexcept;
-  size_t length() const noexcept;
+  std::size_t size() const noexcept;
+  std::size_t length() const noexcept;
 
   using iterator = char *;
   iterator begin() noexcept;
@@ -75,7 +75,7 @@
 
 private:
   // Size and alignment statically verified by rust_string.rs.
-  std::array<uintptr_t, 3> repr;
+  std::array<std::uintptr_t, 3> repr;
 };
 #endif // CXXBRIDGE1_RUST_STRING
 
@@ -87,7 +87,7 @@
   Str(const String &) noexcept;
   Str(const std::string &);
   Str(const char *);
-  Str(const char *, size_t);
+  Str(const char *, std::size_t);
 
   Str &operator=(const Str &) noexcept = default;
 
@@ -95,8 +95,8 @@
 
   // Note: no null terminator.
   const char *data() const noexcept;
-  size_t size() const noexcept;
-  size_t length() const noexcept;
+  std::size_t size() const noexcept;
+  std::size_t length() const noexcept;
 
   // Important in order for System V ABI to pass in registers.
   Str(const Str &) noexcept = default;
@@ -121,7 +121,7 @@
   // Not necessarily ABI compatible with &str. Codegen will translate to
   // cxx::rust_str::RustStr which matches this layout.
   const char *ptr;
-  size_t len;
+  std::size_t len;
 };
 #endif // CXXBRIDGE1_RUST_STR
 
@@ -145,14 +145,14 @@
     : private detail::copy_assignable_if<std::is_const<T>::value> {
 public:
   Slice() noexcept;
-  Slice(T *, size_t count) noexcept;
+  Slice(T *, std::size_t count) noexcept;
 
   Slice &operator=(const Slice<T> &) noexcept = default;
   Slice &operator=(Slice<T> &&) noexcept = default;
 
   T *data() const noexcept;
-  size_t size() const noexcept;
-  size_t length() const noexcept;
+  std::size_t size() const noexcept;
+  std::size_t length() const noexcept;
 
   // Important in order for System V ABI to pass in registers.
   Slice(const Slice<T> &) noexcept = default;
@@ -167,13 +167,13 @@
   // Not necessarily ABI compatible with &[T]. Codegen will translate to
   // cxx::rust_slice::RustSlice which matches this layout.
   T *ptr;
-  size_t len;
+  std::size_t len;
 };
 
 template <typename T>
 class Slice<T>::iterator final {
 public:
-  using difference_type = ptrdiff_t;
+  using difference_type = std::ptrdiff_t;
   using value_type = T;
   using pointer = typename std::add_pointer<T>::type;
   using reference = typename std::add_lvalue_reference<T>::type;
@@ -252,23 +252,23 @@
   Vec &operator=(Vec &&) noexcept;
   Vec &operator=(const Vec &);
 
-  size_t size() const noexcept;
+  std::size_t size() const noexcept;
   bool empty() const noexcept;
   const T *data() const noexcept;
   T *data() noexcept;
-  size_t capacity() const noexcept;
+  std::size_t capacity() const noexcept;
 
-  const T &operator[](size_t n) const noexcept;
-  const T &at(size_t n) const;
+  const T &operator[](std::size_t n) const noexcept;
+  const T &at(std::size_t n) const;
   const T &front() const;
   const T &back() const;
 
-  T &operator[](size_t n) noexcept;
-  T &at(size_t n);
+  T &operator[](std::size_t n) noexcept;
+  T &at(std::size_t n);
   T &front();
   T &back();
 
-  void reserve(size_t new_cap);
+  void reserve(std::size_t new_cap);
   void push_back(const T &value);
   void push_back(T &&value);
   template <typename... Args>
@@ -288,13 +288,13 @@
   Vec(unsafe_bitcopy_t, const Vec &) noexcept;
 
 private:
-  static size_t stride() noexcept;
-  void reserve_total(size_t cap) noexcept;
-  void set_len(size_t len) noexcept;
+  static std::size_t stride() noexcept;
+  void reserve_total(std::size_t cap) noexcept;
+  void set_len(std::size_t len) noexcept;
   void drop() noexcept;
 
   // Size and alignment statically verified by rust_vec.rs.
-  std::array<uintptr_t, 3> repr;
+  std::array<std::uintptr_t, 3> repr;
 };
 
 template <typename T>
@@ -302,7 +302,7 @@
 public:
   using iterator_category = std::random_access_iterator_tag;
   using value_type = T;
-  using difference_type = ptrdiff_t;
+  using difference_type = std::ptrdiff_t;
   using pointer = typename std::add_pointer<T>::type;
   using reference = typename std::add_lvalue_reference<T>::type;
 
@@ -332,7 +332,7 @@
   friend class Vec;
   friend class Vec<typename std::remove_const<T>::type>;
   void *pos;
-  size_t stride;
+  std::size_t stride;
 };
 #endif // CXXBRIDGE1_RUST_VEC
 
@@ -371,7 +371,7 @@
   Error() noexcept = default;
   friend impl<Error>;
   const char *msg;
-  size_t len;
+  std::size_t len;
 };
 #endif // CXXBRIDGE1_RUST_ERROR
 
@@ -419,15 +419,15 @@
 template <typename T>
 struct IsRelocatable;
 
-using u8 = uint8_t;
-using u16 = uint16_t;
-using u32 = uint32_t;
-using u64 = uint64_t;
-using usize = size_t; // see static asserts in cxx.cc
-using i8 = int8_t;
-using i16 = int16_t;
-using i32 = int32_t;
-using i64 = int64_t;
+using u8 = std::uint8_t;
+using u16 = std::uint16_t;
+using u32 = std::uint32_t;
+using u64 = std::uint64_t;
+using usize = std::size_t; // see static asserts in cxx.cc
+using i8 = std::int8_t;
+using i16 = std::int16_t;
+using i32 = std::int32_t;
+using i64 = std::int64_t;
 using f32 = float;
 using f64 = double;
 
@@ -483,9 +483,9 @@
 #define CXXBRIDGE1_RUST_STR
 inline const char *Str::data() const noexcept { return this->ptr; }
 
-inline size_t Str::size() const noexcept { return this->len; }
+inline std::size_t Str::size() const noexcept { return this->len; }
 
-inline size_t Str::length() const noexcept { return this->len; }
+inline std::size_t Str::length() const noexcept { return this->len; }
 #endif // CXXBRIDGE1_RUST_STR
 
 #ifndef CXXBRIDGE1_RUST_SLICE
@@ -494,7 +494,7 @@
 Slice<T>::Slice() noexcept : ptr(reinterpret_cast<T *>(alignof(T))), len(0) {}
 
 template <typename T>
-Slice<T>::Slice(T *s, size_t count) noexcept : ptr(s), len(count) {}
+Slice<T>::Slice(T *s, std::size_t count) noexcept : ptr(s), len(count) {}
 
 template <typename T>
 T *Slice<T>::data() const noexcept {
@@ -502,12 +502,12 @@
 }
 
 template <typename T>
-size_t Slice<T>::size() const noexcept {
+std::size_t Slice<T>::size() const noexcept {
   return this->len;
 }
 
 template <typename T>
-size_t Slice<T>::length() const noexcept {
+std::size_t Slice<T>::length() const noexcept {
   return this->len;
 }
 
@@ -735,13 +735,13 @@
 }
 
 template <typename T>
-const T &Vec<T>::operator[](size_t n) const noexcept {
+const T &Vec<T>::operator[](std::size_t n) const noexcept {
   auto data = reinterpret_cast<const char *>(this->data());
   return *reinterpret_cast<const T *>(data + n * this->stride());
 }
 
 template <typename T>
-const T &Vec<T>::at(size_t n) const {
+const T &Vec<T>::at(std::size_t n) const {
   if (n >= this->size()) {
     panic<std::out_of_range>("rust::Vec index out of range");
   }
@@ -759,13 +759,13 @@
 }
 
 template <typename T>
-T &Vec<T>::operator[](size_t n) noexcept {
+T &Vec<T>::operator[](std::size_t n) noexcept {
   auto data = reinterpret_cast<char *>(this->data());
   return *reinterpret_cast<T *>(data + n * this->stride());
 }
 
 template <typename T>
-T &Vec<T>::at(size_t n) {
+T &Vec<T>::at(std::size_t n) {
   if (n >= this->size()) {
     panic<std::out_of_range>("rust::Vec index out of range");
   }
@@ -783,7 +783,7 @@
 }
 
 template <typename T>
-void Vec<T>::reserve(size_t new_cap) {
+void Vec<T>::reserve(std::size_t new_cap) {
   this->reserve_total(new_cap);
 }
 
diff --git a/src/cxx.cc b/src/cxx.cc
index a11ba12..776663e 100644
--- a/src/cxx.cc
+++ b/src/cxx.cc
@@ -10,8 +10,8 @@
 #include <vector>
 
 extern "C" {
-void cxxbridge1$cxx_string$init(std::string *s, const uint8_t *ptr,
-                                size_t len) noexcept {
+void cxxbridge1$cxx_string$init(std::string *s, const std::uint8_t *ptr,
+                                std::size_t len) noexcept {
   new (s) std::string(reinterpret_cast<const char *>(ptr), len);
 }
 
@@ -24,12 +24,12 @@
   return s.data();
 }
 
-size_t cxxbridge1$cxx_string$length(const std::string &s) noexcept {
+std::size_t cxxbridge1$cxx_string$length(const std::string &s) noexcept {
   return s.length();
 }
 
-void cxxbridge1$cxx_string$push(std::string &s, const uint8_t *ptr,
-                                size_t len) noexcept {
+void cxxbridge1$cxx_string$push(std::string &s, const std::uint8_t *ptr,
+                                std::size_t len) noexcept {
   s.append(reinterpret_cast<const char *>(ptr), len);
 }
 
@@ -38,13 +38,13 @@
 void cxxbridge1$string$clone(rust::String *self,
                              const rust::String &other) noexcept;
 bool cxxbridge1$string$from(rust::String *self, const char *ptr,
-                            size_t len) noexcept;
+                            std::size_t len) noexcept;
 void cxxbridge1$string$drop(rust::String *self) noexcept;
 const char *cxxbridge1$string$ptr(const rust::String *self) noexcept;
-size_t cxxbridge1$string$len(const rust::String *self) noexcept;
+std::size_t cxxbridge1$string$len(const rust::String *self) noexcept;
 
 // rust::Str
-bool cxxbridge1$str$valid(const char *ptr, size_t len) noexcept;
+bool cxxbridge1$str$valid(const char *ptr, std::size_t len) noexcept;
 } // extern "C"
 
 namespace rust {
@@ -74,7 +74,7 @@
 
 String::~String() noexcept { cxxbridge1$string$drop(this); }
 
-static void initString(String *self, const char *s, size_t len) {
+static void initString(String *self, const char *s, std::size_t len) {
   if (!cxxbridge1$string$from(self, s, len)) {
     panic<std::invalid_argument>("data for rust::String is not utf-8");
   }
@@ -87,7 +87,7 @@
   initString(this, s, std::strlen(s));
 }
 
-String::String(const char *s, size_t len) {
+String::String(const char *s, std::size_t len) {
   assert(s != nullptr || len == 0);
   initString(this,
              s == nullptr && len == 0 ? reinterpret_cast<const char *>(1) : s,
@@ -119,9 +119,13 @@
   return cxxbridge1$string$ptr(this);
 }
 
-size_t String::size() const noexcept { return cxxbridge1$string$len(this); }
+std::size_t String::size() const noexcept {
+  return cxxbridge1$string$len(this);
+}
 
-size_t String::length() const noexcept { return cxxbridge1$string$len(this); }
+std::size_t String::length() const noexcept {
+  return cxxbridge1$string$len(this);
+}
 
 String::iterator String::begin() noexcept {
   return const_cast<char *>(this->data());
@@ -177,7 +181,7 @@
 
 Str::Str(const String &s) noexcept : ptr(s.data()), len(s.length()) {}
 
-static void initStr(const char *ptr, size_t len) {
+static void initStr(const char *ptr, std::size_t len) {
   if (!cxxbridge1$str$valid(ptr, len)) {
     panic<std::invalid_argument>("data for rust::Str is not utf-8");
   }
@@ -192,7 +196,7 @@
   initStr(this->ptr, this->len);
 }
 
-Str::Str(const char *s, size_t len)
+Str::Str(const char *s, std::size_t len)
     : ptr(s == nullptr && len == 0 ? reinterpret_cast<const char *>(1) : s),
       len(len) {
   assert(s != nullptr || len == 0);
@@ -258,12 +262,13 @@
 // same here and these assertions are just here to explicitly document that.
 // *Note that no assumption is made about C++ name mangling of signatures
 // containing these types, not here nor anywhere in CXX.*
-static_assert(sizeof(size_t) == sizeof(uintptr_t), "unsupported size_t size");
-static_assert(alignof(size_t) == alignof(uintptr_t),
+static_assert(sizeof(std::size_t) == sizeof(std::uintptr_t),
+              "unsupported size_t size");
+static_assert(alignof(std::size_t) == alignof(std::uintptr_t),
               "unsupported size_t alignment");
-static_assert(sizeof(rust::isize) == sizeof(intptr_t),
+static_assert(sizeof(rust::isize) == sizeof(std::intptr_t),
               "unsupported ssize_t size");
-static_assert(alignof(rust::isize) == alignof(intptr_t),
+static_assert(alignof(rust::isize) == alignof(std::intptr_t),
               "unsupported ssize_t alignment");
 
 static_assert(std::is_trivially_copy_constructible<Str>::value,
@@ -272,40 +277,44 @@
               "trivial operator=(const Str &)");
 static_assert(std::is_trivially_destructible<Str>::value, "trivial ~Str()");
 
-static_assert(std::is_trivially_copy_constructible<Slice<const uint8_t>>::value,
-              "trivial Slice(const Slice &)");
-static_assert(std::is_trivially_move_constructible<Slice<const uint8_t>>::value,
-              "trivial Slice(Slice &&)");
-static_assert(std::is_trivially_copy_assignable<Slice<const uint8_t>>::value,
-              "trivial Slice::operator=(const Slice &) for const slices");
-static_assert(std::is_trivially_move_assignable<Slice<const uint8_t>>::value,
-              "trivial Slice::operator=(Slice &&)");
-static_assert(std::is_trivially_destructible<Slice<const uint8_t>>::value,
-              "trivial ~Slice()");
-
-static_assert(std::is_trivially_copy_constructible<Slice<uint8_t>>::value,
-              "trivial Slice(const Slice &)");
-static_assert(std::is_trivially_move_constructible<Slice<uint8_t>>::value,
-              "trivial Slice(Slice &&)");
-static_assert(!std::is_copy_assignable<Slice<uint8_t>>::value,
-              "delete Slice::operator=(const Slice &) for mut slices");
-static_assert(std::is_trivially_move_assignable<Slice<uint8_t>>::value,
-              "trivial Slice::operator=(Slice &&)");
-static_assert(std::is_trivially_destructible<Slice<uint8_t>>::value,
-              "trivial ~Slice()");
-
-static_assert(std::is_same<Vec<uint8_t>::const_iterator,
-                           Vec<const uint8_t>::iterator>::value,
-              "Vec<T>::const_iterator == Vec<const T>::iterator");
-static_assert(std::is_same<Vec<const uint8_t>::const_iterator,
-                           Vec<const uint8_t>::iterator>::value,
-              "Vec<const T>::const_iterator == Vec<const T>::iterator");
 static_assert(
-    !std::is_same<Vec<uint8_t>::const_iterator, Vec<uint8_t>::iterator>::value,
-    "Vec<T>::const_iterator != Vec<T>::iterator");
+    std::is_trivially_copy_constructible<Slice<const std::uint8_t>>::value,
+    "trivial Slice(const Slice &)");
+static_assert(
+    std::is_trivially_move_constructible<Slice<const std::uint8_t>>::value,
+    "trivial Slice(Slice &&)");
+static_assert(
+    std::is_trivially_copy_assignable<Slice<const std::uint8_t>>::value,
+    "trivial Slice::operator=(const Slice &) for const slices");
+static_assert(
+    std::is_trivially_move_assignable<Slice<const std::uint8_t>>::value,
+    "trivial Slice::operator=(Slice &&)");
+static_assert(std::is_trivially_destructible<Slice<const std::uint8_t>>::value,
+              "trivial ~Slice()");
+
+static_assert(std::is_trivially_copy_constructible<Slice<std::uint8_t>>::value,
+              "trivial Slice(const Slice &)");
+static_assert(std::is_trivially_move_constructible<Slice<std::uint8_t>>::value,
+              "trivial Slice(Slice &&)");
+static_assert(!std::is_copy_assignable<Slice<std::uint8_t>>::value,
+              "delete Slice::operator=(const Slice &) for mut slices");
+static_assert(std::is_trivially_move_assignable<Slice<std::uint8_t>>::value,
+              "trivial Slice::operator=(Slice &&)");
+static_assert(std::is_trivially_destructible<Slice<std::uint8_t>>::value,
+              "trivial ~Slice()");
+
+static_assert(std::is_same<Vec<std::uint8_t>::const_iterator,
+                           Vec<const std::uint8_t>::iterator>::value,
+              "Vec<T>::const_iterator == Vec<const T>::iterator");
+static_assert(std::is_same<Vec<const std::uint8_t>::const_iterator,
+                           Vec<const std::uint8_t>::iterator>::value,
+              "Vec<const T>::const_iterator == Vec<const T>::iterator");
+static_assert(!std::is_same<Vec<std::uint8_t>::const_iterator,
+                            Vec<std::uint8_t>::iterator>::value,
+              "Vec<T>::const_iterator != Vec<T>::iterator");
 
 extern "C" {
-const char *cxxbridge1$error(const char *ptr, size_t len) {
+const char *cxxbridge1$error(const char *ptr, std::size_t len) {
   char *copy = new char[len];
   std::strncpy(copy, ptr, len);
   return copy;
@@ -384,7 +393,7 @@
 } // extern "C"
 
 namespace {
-const size_t kMaxExpectedWordsInString = 8;
+const std::size_t kMaxExpectedWordsInString = 8;
 static_assert(alignof(std::string) <= alignof(void *),
               "unexpectedly large std::string alignment");
 static_assert(sizeof(std::string) <= kMaxExpectedWordsInString * sizeof(void *),
@@ -392,12 +401,12 @@
 } // namespace
 
 #define STD_VECTOR_OPS(RUST_TYPE, CXX_TYPE)                                    \
-  size_t cxxbridge1$std$vector$##RUST_TYPE##$size(                             \
+  std::size_t cxxbridge1$std$vector$##RUST_TYPE##$size(                        \
       const std::vector<CXX_TYPE> &s) noexcept {                               \
     return s.size();                                                           \
   }                                                                            \
   const CXX_TYPE *cxxbridge1$std$vector$##RUST_TYPE##$get_unchecked(           \
-      const std::vector<CXX_TYPE> &s, size_t pos) noexcept {                   \
+      const std::vector<CXX_TYPE> &s, std::size_t pos) noexcept {              \
     return &s[pos];                                                            \
   }                                                                            \
   void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$null(                    \
@@ -429,17 +438,17 @@
       rust::Vec<CXX_TYPE> *ptr) noexcept;                                      \
   void cxxbridge1$rust_vec$##RUST_TYPE##$drop(                                 \
       rust::Vec<CXX_TYPE> *ptr) noexcept;                                      \
-  size_t cxxbridge1$rust_vec$##RUST_TYPE##$len(                                \
+  std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$len(                           \
       const rust::Vec<CXX_TYPE> *ptr) noexcept;                                \
-  size_t cxxbridge1$rust_vec$##RUST_TYPE##$capacity(                           \
+  std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$capacity(                      \
       const rust::Vec<CXX_TYPE> *ptr) noexcept;                                \
   const CXX_TYPE *cxxbridge1$rust_vec$##RUST_TYPE##$data(                      \
       const rust::Vec<CXX_TYPE> *ptr) noexcept;                                \
   void cxxbridge1$rust_vec$##RUST_TYPE##$reserve_total(                        \
-      rust::Vec<CXX_TYPE> *ptr, size_t cap) noexcept;                          \
+      rust::Vec<CXX_TYPE> *ptr, std::size_t cap) noexcept;                     \
   void cxxbridge1$rust_vec$##RUST_TYPE##$set_len(rust::Vec<CXX_TYPE> *ptr,     \
-                                                 size_t len) noexcept;         \
-  size_t cxxbridge1$rust_vec$##RUST_TYPE##$stride() noexcept;
+                                                 std::size_t len) noexcept;    \
+  std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$stride() noexcept;
 
 #define RUST_VEC_OPS(RUST_TYPE, CXX_TYPE)                                      \
   template <>                                                                  \
@@ -451,11 +460,11 @@
     return cxxbridge1$rust_vec$##RUST_TYPE##$drop(this);                       \
   }                                                                            \
   template <>                                                                  \
-  size_t Vec<CXX_TYPE>::size() const noexcept {                                \
+  std::size_t Vec<CXX_TYPE>::size() const noexcept {                           \
     return cxxbridge1$rust_vec$##RUST_TYPE##$len(this);                        \
   }                                                                            \
   template <>                                                                  \
-  size_t Vec<CXX_TYPE>::capacity() const noexcept {                            \
+  std::size_t Vec<CXX_TYPE>::capacity() const noexcept {                       \
     return cxxbridge1$rust_vec$##RUST_TYPE##$capacity(this);                   \
   }                                                                            \
   template <>                                                                  \
@@ -463,15 +472,15 @@
     return cxxbridge1$rust_vec$##RUST_TYPE##$data(this);                       \
   }                                                                            \
   template <>                                                                  \
-  void Vec<CXX_TYPE>::reserve_total(size_t cap) noexcept {                     \
+  void Vec<CXX_TYPE>::reserve_total(std::size_t cap) noexcept {                \
     cxxbridge1$rust_vec$##RUST_TYPE##$reserve_total(this, cap);                \
   }                                                                            \
   template <>                                                                  \
-  void Vec<CXX_TYPE>::set_len(size_t len) noexcept {                           \
+  void Vec<CXX_TYPE>::set_len(std::size_t len) noexcept {                      \
     cxxbridge1$rust_vec$##RUST_TYPE##$set_len(this, len);                      \
   }                                                                            \
   template <>                                                                  \
-  size_t Vec<CXX_TYPE>::stride() noexcept {                                    \
+  std::size_t Vec<CXX_TYPE>::stride() noexcept {                               \
     return cxxbridge1$rust_vec$##RUST_TYPE##$stride();                         \
   }
 
@@ -505,20 +514,20 @@
 
 // Usize and isize are the same type as one of the below.
 #define FOR_EACH_NUMERIC(MACRO)                                                \
-  MACRO(u8, uint8_t)                                                           \
-  MACRO(u16, uint16_t)                                                         \
-  MACRO(u32, uint32_t)                                                         \
-  MACRO(u64, uint64_t)                                                         \
-  MACRO(i8, int8_t)                                                            \
-  MACRO(i16, int16_t)                                                          \
-  MACRO(i32, int32_t)                                                          \
-  MACRO(i64, int64_t)                                                          \
+  MACRO(u8, std::uint8_t)                                                      \
+  MACRO(u16, std::uint16_t)                                                    \
+  MACRO(u32, std::uint32_t)                                                    \
+  MACRO(u64, std::uint64_t)                                                    \
+  MACRO(i8, std::int8_t)                                                       \
+  MACRO(i16, std::int16_t)                                                     \
+  MACRO(i32, std::int32_t)                                                     \
+  MACRO(i64, std::int64_t)                                                     \
   MACRO(f32, float)                                                            \
   MACRO(f64, double)
 
 #define FOR_EACH_STD_VECTOR(MACRO)                                             \
   FOR_EACH_NUMERIC(MACRO)                                                      \
-  MACRO(usize, size_t)                                                         \
+  MACRO(usize, std::size_t)                                                    \
   MACRO(isize, rust::isize)                                                    \
   MACRO(string, std::string)
 
@@ -530,7 +539,7 @@
 
 #define FOR_EACH_SHARED_PTR(MACRO)                                             \
   FOR_EACH_NUMERIC(MACRO)                                                      \
-  MACRO(usize, size_t)                                                         \
+  MACRO(usize, std::size_t)                                                    \
   MACRO(isize, rust::isize)                                                    \
   MACRO(string, std::string)