-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking Issue for proc_macro::ToTokens #130977
Copy link
Copy link
Open
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-proc_macro_quote`#![feature(proc_macro_quote)]``#![feature(proc_macro_quote)]`T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.WG-macrosWorking group: MacrosWorking group: Macros
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-proc_macro_quote`#![feature(proc_macro_quote)]``#![feature(proc_macro_quote)]`T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.WG-macrosWorking group: MacrosWorking group: Macros
Type
Fields
Give feedbackNo fields configured for issues without a type.
Feature gate:
#![feature(proc_macro_totokens)]This is a tracking issue for adding a
ToTokenstrait inproc_macro, which can then be used inproc_macro::quote!. See the ACP for motivation.Public API
This will be similar to
quote::ToTokens. That can be used as a reference for implementation details since it already provides all of these.Steps / History
proc_macro::ToTokensto supportproc_macro::quotelibs-team#431proc_macro: Add a new traitproc_macro::ToTokens#131441proc_macro::quote!: proc_macro: UseToTokenstrait inquotemacro #134693proc_macro::quote!to use these traits: #...Unresolved Questions
ToTokensdoesn't seem quite accurate, but I don't know what would be better (ToTokenStream?ExtendTokenStream? Those seem a bit clunky).impl<T: ToTokens> ToTokensfor T is provided, should to_tokens take self by value rather than by reference so cloning isn't always necessary? (fn to_tokens(self, tokens: &mut TokenStream))Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩