about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-09-17 08:27:26 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-09-17 10:24:43 +1000
commit85a4d2af9031c4715bfba2af25f8b8e9d3eaba15 (patch)
tree3939d79b37b16d0e71b2a769daf0dc2c50069bdc
parent108f8c8164d2f2f8b7d67f6b9b124cd7e81f5c82 (diff)
downloadrust-85a4d2af9031c4715bfba2af25f8b8e9d3eaba15.tar.gz
rust-85a4d2af9031c4715bfba2af25f8b8e9d3eaba15.zip
Tweak and explain the `BuilderMethods`/`CodegenMethods` connection.
-rw-r--r--compiler/rustc_codegen_ssa/src/traits/builder.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs
index c88bd7c82bc..98cb497766a 100644
--- a/compiler/rustc_codegen_ssa/src/traits/builder.rs
+++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs
@@ -17,7 +17,7 @@ use super::debuginfo::DebugInfoBuilderMethods;
 use super::intrinsic::IntrinsicCallBuilderMethods;
 use super::misc::MiscMethods;
 use super::type_::{ArgAbiBuilderMethods, BaseTypeMethods, LayoutTypeMethods};
-use super::{BackendTypes, CodegenMethods, StaticBuilderMethods};
+use super::{CodegenMethods, StaticBuilderMethods};
 use crate::common::{
     AtomicOrdering, AtomicRmwBinOp, IntPredicate, RealPredicate, SynchronizationScope, TypeKind,
 };
@@ -45,8 +45,11 @@ pub trait BuilderMethods<'a, 'tcx>:
     + AsmBuilderMethods<'tcx>
     + StaticBuilderMethods
 {
-    type CodegenCx: CodegenMethods<'tcx>
-        + BackendTypes<
+    // `BackendTypes` is a supertrait of both `CodegenMethods` and
+    // `BuilderMethods`. This bound ensures all impls agree on the associated
+    // types within.
+    type CodegenCx: CodegenMethods<
+            'tcx,
             Value = Self::Value,
             Function = Self::Function,
             BasicBlock = Self::BasicBlock,