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
Since #10649, macro_rules! macros can return multiple items. But there is no easy way to do so from a syntax extension: the result value must implement MacResult and the appropriate implementation appear to be MacItem, but it can only hold one item.
In servo/servo#3142, I worked around this with a new MacItems (plural) type:
structMacItems{items:SmallVector<Gc<ast::Item>>}implMacItems{fnnew<I:Iterator<Gc<ast::Item>>>(items:I) -> Box<MacResult>{
box MacItems{items: items.collect()}asBox<MacResult>}implMacResultforMacItems{fnmake_items(&self) -> Option<SmallVector<Gc<ast::Item>>>{// FIXME: Implement Clone on SmallVector and use it instead of .iter().collect()Some(self.items.iter().collect())}}
Perhaps this could be added to libsyntax or merged with MacItem.
The text was updated successfully, but these errors were encountered:
…ykril
fix: autocomplete constants inside format strings
Hi! This PR adds autocompletion for constants (including statics) inside format strings and closesrust-lang#16608.
I'm not sure about adding the `constants` field to the `CompletionContext`. It kinda makes sense, since it's in line with the `locals` field, and this way everything looks a bit cleaner, but at the same time does it really need to be there?
Anyway, let me know if anything should/can be changed. :)
Since #10649,
macro_rules!
macros can return multiple items. But there is no easy way to do so from a syntax extension: the result value must implementMacResult
and the appropriate implementation appear to beMacItem
, but it can only hold one item.In servo/servo#3142, I worked around this with a new
MacItems
(plural) type:Perhaps this could be added to libsyntax or merged with
MacItem
.The text was updated successfully, but these errors were encountered: