Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

[DONT MERGE] Always take reference when accessing value passed as argument to a macro #714

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

msrd0
Copy link
Contributor

@msrd0 msrd0 commented Aug 6, 2022

This was proposed by @djc to fix #708 - but just blindly taking references does not seem to work

@djc
Copy link
Collaborator

djc commented Aug 9, 2022

Sorry, I don't have much time for this so if you want more help can you comment here with some of the generated code and point out where/why the problem happens?

@msrd0
Copy link
Contributor Author

msrd0 commented Aug 9, 2022

It fails because it cannot compare &str with str (i.e. when the macro argument was already a borrowed string, it becomes a double borrow which cannot be compared to a literal anymore). You can see it in the CI here: https://github.com/djc/askama/runs/7705017639?check_suite_focus=true

@Kijewski Kijewski marked this pull request as draft August 10, 2022 05:29
@Kijewski Kijewski force-pushed the main branch 2 times, most recently from 5633250 to 704f8f1 Compare March 11, 2025 19:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Iterating over elements of an iterator inside a macro moves the inner collection
2 participants