-
Notifications
You must be signed in to change notification settings - Fork 10
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
Allow variables inheritance in block #264
Allow variables inheritance in block #264
Conversation
a873960
to
b3f8110
Compare
The original discussion was in djc/askama#989. I don't really see a reason why we didn't allow variables to be inherited. Well, fixed now. |
b3f8110
to
07e6216
Compare
rinja_derive/src/generator.rs
Outdated
// `<'b, 'b, ...>`. Except... it doesn't work because `self` still doesn't live long | ||
// enough here for some reason... | ||
MapChain::with_parent(unsafe { | ||
mem::transmute::< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still very unhappy about this. I was able to improve the situation a lot but still get this last error:
error: lifetime may not live long enough
--> rinja_derive/src/generator.rs:1166:13
|
84 | impl<'a, 'b> Generator<'a, 'b> {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
1166 | MapChain::with_parent(&self.locals),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
= help: consider adding the following bound: `'b: 'a`
I pushed my changes here.
I'll try to continue to understand what's wrong. If anyone wants to give it a try though...
Please have a look at my change whether it's okay for you. I won't admit that it took me like 6 hours in total until I came up with a solution I liked. |
4c1a67b
to
5604db8
Compare
Remove inheritance from `MapChain`, and simply open a new scope. Add lifetime to `Generator` and `Heritage` to reference its root context.
5604db8
to
e182022
Compare
So Book build is failing for some reason though? Seems unrelated to this PR. |
(also I cannot approve my own PR haha) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Fixes #246.