Skip to content
This repository was archived by the owner on Oct 6, 2024. It is now read-only.
/pastePublic archive

Support paste in arbitrary name-value attributes - #57

Merged
dtolnay merged 1 commit into
dtolnay:masterfrom
scalexm:attr
Nov 10, 2020
Merged

Support paste in arbitrary name-value attributes#57
dtolnay merged 1 commit into
dtolnay:masterfrom
scalexm:attr

Conversation

@scalexm

@scalexmscalexm commented Nov 1, 2020

Copy link
Copy Markdown
Contributor

Fixes#56.

@scalexm

Copy link
Copy Markdown
ContributorAuthor

Ping @dtolnay, I would like to know whether you like the idea, or if you think this is inappropriate for paste.

@dtolnay

Copy link
Copy Markdown
Owner

I am on board with this. The PR is marked experimental. Are you planning changes or is this ready for review?

@scalexm

Copy link
Copy Markdown
ContributorAuthor

I’ve tested it on my side and it covers my use case, so ready for review. Cc @frol.

@dtolnaydtolnay left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this turns all values in key/value attributes into strings, which is likely to break some macros.

#[proc_macro_attribute]pubfndebug(_args:TokenStream,input:TokenStream) -> TokenStream{println!("{}", input);TokenStream::new()}
paste!{
#[debug]
#[xyz = 123]structS;}
#[xyz = "123"] struct S ;

@scalexm

Copy link
Copy Markdown
ContributorAuthor

I restored the previous behavior which was to have at least two tokens after the = sign.

@dtolnaydtolnay left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dtolnay
dtolnay merged commit 4d04c18 into dtolnay:masterNov 10, 2020
@frol

frol commented Nov 10, 2020

Copy link
Copy Markdown

@scalexm@dtolnay Thank you!

Sign up for freeto 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.

Support paste in cfg feature context

3 participants

@scalexm@dtolnay@frol