You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if Builder deref'd to CodegenCx to avoid typing bx.cx() everywhere.
Also, since Builder now has to implement all the layout traits itself, we could start writing e.g. layout.field(bx, i) instead of layout.field(bx.cx(), i).
There are probably a few more ergonomics / cleanup things we could do here as well.
I tried to add Deref<Target = Self::CodegenCx> bound to HasCodegen, but I get an error:
(The end of the first line is a reproducable glitch tc_codegen_ssa)
error[E0391]: cycle detected when computing the supertraits of `traits::HasCodegen`tc_codegen_ssa
--> src/librustc_codegen_ssa/traits/mod.rs:88:1
|
88 | pub trait HasCodegen<'tcx>:Backend<'tcx> + ::std::ops::Deref<Target = Self::CodegenCx> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: ...which again requires computing the supertraits of `traits::HasCodegen`, completing the cycle
note: cycle used when computing the supertraits of `traits::type_::ArgTypeMethods`
--> src/librustc_codegen_ssa/traits/type_.rs:186:33
|
186| pub trait ArgTypeMethods<'tcx>:HasCodegen<'tcx> {
| ^^^^^^^^^^^^^^^^
error: aborting due to previous error
It would be nice if
Builder
deref'd toCodegenCx
to avoid typingbx.cx()
everywhere.Also, since
Builder
now has to implement all the layout traits itself, we could start writing e.g.layout.field(bx, i)
instead oflayout.field(bx.cx(), i)
.There are probably a few more ergonomics / cleanup things we could do here as well.
cc @nikomatsakis @sunfishcode @denismerigoux @bjorn3
The text was updated successfully, but these errors were encountered: