Skip to content
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

Explain how it works #6

Closed
vigna opened this issue Aug 8, 2023 · 1 comment
Closed

Explain how it works #6

vigna opened this issue Aug 8, 2023 · 1 comment
Labels
question Further information is requested

Comments

@vigna
Copy link

vigna commented Aug 8, 2023

I think it would be fantastic if you could comment a sample of the generated code in the README and explain why it works. I'm learning a lot from your code but some written explanation would be priceless. :)

@taiki-e
Copy link
Owner

taiki-e commented Aug 8, 2023

As mentioned in the readme, it generates a trait implementation with a condition that will never be true.

For example, in the case of Unpin, the generated code is roughly as follows.

impl Unpin for $ty 
where
    PhantomPinned: Unpin, // PhantomPinned will never be Unpin.
{}

The actual generated code is a bit more complex because of hygiene and to work around the limitations of Rust's type system.

@taiki-e taiki-e added the question Further information is requested label Aug 8, 2023
@taiki-e taiki-e closed this as completed in 55ff1aa Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants