about summary refs log tree commit diff
path: root/library/std/src/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorAlan Egerton <eggyal@gmail.com>2022-06-20 21:10:43 +0100
committerAlan Egerton <eggyal@gmail.com>2022-06-21 17:38:22 +0100
commit6ac6866bec092e0c2a3e0fc4aaf14b015b859a57 (patch)
tree46e46203fac60a5f418cf5db9fc2154a972ab752 /library/std/src/sys/unix/stack_overflow.rs
parent72fd41a8b4d3488c97df3c3c75ddd9951aa3c73f (diff)
downloadrust-6ac6866bec092e0c2a3e0fc4aaf14b015b859a57.tar.gz
rust-6ac6866bec092e0c2a3e0fc4aaf14b015b859a57.zip
Reverse folder hierarchy
#91318 introduced a trait for infallible folders distinct from the fallible version.  For some reason (completely unfathomable to me now that I look at it with fresh eyes), the infallible trait was a supertrait of the fallible one: that is, all fallible folders were required to also be infallible.  Moreover the `Error` associated type was defined on the infallible trait!  It's so absurd that it has me questioning whether I was entirely sane.

This trait reverses the hierarchy, so that the fallible trait is a supertrait of the infallible one: all infallible folders are required to also be fallible (which is a trivial blanket implementation).  This of course makes much more sense!  It also enables the `Error` associated type to sit on the fallible trait, where it sensibly belongs.

There is one downside however: folders expose a `tcx` accessor method.  Since the blanket fallible implementation for infallible folders only has access to a generic `F: TypeFolder`, we need that trait to expose such an accessor to which we can delegate.  Alternatively it's possible to extract that accessor into a separate `HasTcx` trait (or similar) that would then be a supertrait of both the fallible and infallible folder traits: this would ensure that there's only one unambiguous `tcx` method, at the cost of a little additional boilerplate.  If desired, I can submit that as a separate PR.

r? @jackh726
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions