-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE with HRTB and lifetime on subtrait #53943
Comments
trait MyF<'a>: FnOnce() -> &'a () {}
fn test<F>(_: F) where for<'a> F: MyF<'a, Output=&'a ()> {
}
fn main(){
} Note: This bug depends on the need to specify an associate type in the super trait, with a lifetime. Then, in the trait bound |
I'm working on data-parallelism library, heavily inspired by Rayon but focused on describing certain computations on a dataset in an SQL-like manner, somewhat akin to Diesel. One part of this combines HRTBs with associated types. I've bumped into a few issues that have made things a bit tricky ([#30472](rust-lang/rust#30472), [#30867](rust-lang/rust#30867), [#53943](rust-lang/rust#53943), and similar), the hardest to work around however has been that I don't believe it's currently possible to write this: ```rust type Task = for<'a> <B as Abc<&'a A::Item>>::Task; ``` Currently I've resorted to a dummy trait, manually reimplemented on various structs without the reference, such that I can do: ```rust type Task = <B as AbcDummy<A::Item>>::Task; ``` and (horribly) transmute between the two. I'd be very interested to discuss 1) issues I've bumped into combining HRTBs and associated types; 2) how to get rid of this transmute and the dummy trait; 3) any feedback on the library before I publish and promote it, given it's heavily inspired by your work on Rayon! I can do any of the Monday or Friday times listed, though I have a preference for the 16 - 16.30 slots. Again, much appreciation for you doing this, I think it's awesome!
To aid searchability here's the slightly different error from latest nightly. The backtrace is largely identical.
|
The minimum reproducable still ICEs on stable - rustc 1.32.0 (9fda7c2 2019-01-16). |
Closing as fixed on beta & nightly. Thanks wonderful member(s) of the rust community that resolved this! |
I'm using a lifetime parameter on a trait such that I can constrain
Item
tofor <'a> &'a X
. I tried to "encapsulate" the lifetime into a subtrait to avoid other issues and got an ICE on stable, nightly and with/without NLL. I suspect this usage should error but I could be mistaken.(Playground)
The text was updated successfully, but these errors were encountered: