{"action":"created","issue":{"url":"https://api.github.com/repos/dtolnay/syn/issues/507","repository_url":"https://api.github.com/repos/dtolnay/syn","labels_url":"https://api.github.com/repos/dtolnay/syn/issues/507/labels{/name}","comments_url":"https://api.github.com/repos/dtolnay/syn/issues/507/comments","events_url":"https://api.github.com/repos/dtolnay/syn/issues/507/events","html_url":"https://github.com/dtolnay/syn/issues/507","id":364890154,"node_id":"MDU6SXNzdWUzNjQ4OTAxNTQ=","number":507,"title":"equivalent of `$crate` in custom derive paths","user":{"login":"dhardy","id":134893,"node_id":"MDQ6VXNlcjEzNDg5Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/134893?v=4","gravatar_id":"","url":"https://api.github.com/users/dhardy","html_url":"https://github.com/dhardy","followers_url":"https://api.github.com/users/dhardy/followers","following_url":"https://api.github.com/users/dhardy/following{/other_user}","gists_url":"https://api.github.com/users/dhardy/gists{/gist_id}","starred_url":"https://api.github.com/users/dhardy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhardy/subscriptions","organizations_url":"https://api.github.com/users/dhardy/orgs","repos_url":"https://api.github.com/users/dhardy/repos","events_url":"https://api.github.com/users/dhardy/events{/privacy}","received_events_url":"https://api.github.com/users/dhardy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-28T13:31:09Z","updated_at":"2018-09-28T17:50:58Z","closed_at":null,"author_association":"NONE","body":"With declarative macros I can use `$crate` to specify fully-qualified paths in a way that works both in the parent crate and when exported to other crates. Is there an equivalent for procedural macros?\r\n\r\n`::mylib::MyType` doesn't work within `mylib`. Before \"edition 2018\", a workaround like this would probably have been possible, but I don't believe it is any longer:\r\n```rust\r\n// in crate root:\r\nmod mylib {\r\n    pub use super::*;\r\n}\r\n```\r\n\r\nConsidering that these macros must currently be defined in another crate it is of course more complicated; a simple `$crate` would expand to the wrong thing."},"comment":{"url":"https://api.github.com/repos/dtolnay/syn/issues/comments/425515345","html_url":"https://github.com/dtolnay/syn/issues/507#issuecomment-425515345","issue_url":"https://api.github.com/repos/dtolnay/syn/issues/507","id":425515345,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTUxNTM0NQ==","user":{"login":"dtolnay","id":1940490,"node_id":"MDQ6VXNlcjE5NDA0OTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1940490?v=4","gravatar_id":"","url":"https://api.github.com/users/dtolnay","html_url":"https://github.com/dtolnay","followers_url":"https://api.github.com/users/dtolnay/followers","following_url":"https://api.github.com/users/dtolnay/following{/other_user}","gists_url":"https://api.github.com/users/dtolnay/gists{/gist_id}","starred_url":"https://api.github.com/users/dtolnay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtolnay/subscriptions","organizations_url":"https://api.github.com/users/dtolnay/orgs","repos_url":"https://api.github.com/users/dtolnay/repos","events_url":"https://api.github.com/users/dtolnay/events{/privacy}","received_events_url":"https://api.github.com/users/dtolnay/received_events","type":"User","site_admin":false},"created_at":"2018-09-28T17:50:58Z","updated_at":"2018-09-28T17:50:58Z","author_association":"OWNER","body":"You can't refer to items from `mod mylib` in a unified way that works both in downstream crates as well as inside of `mylib`. In 2018, the first segment of a `use` statement always identifies a crate. So within `mylib` it would only work if the procedural macro expands to `use crate::mylib::MyType` while in downstream crates it would only work as `use mylib::MyType`."}}
{"actor":{"display_login":"dtolnay"}}