-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support crate renaming in proc macros.
See: rust-lang/rust#54363
- Loading branch information
Showing
7 changed files
with
43 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// This is free and unencumbered software released into the public domain. | ||
|
||
use proc_macro2::{Span, TokenStream}; | ||
use proc_macro_crate::{crate_name, FoundCrate}; | ||
use quote::quote; | ||
use syn::Ident; | ||
|
||
pub(crate) fn protoflow_crate() -> TokenStream { | ||
let found_crate = crate_name("protoflow").expect("protoflow is present in `Cargo.toml`"); | ||
match found_crate { | ||
FoundCrate::Itself => quote!(crate), | ||
FoundCrate::Name(name) => { | ||
let ident = Ident::new(&name, Span::call_site()); | ||
quote!(#ident) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
#![no_std] | ||
|
||
#[doc(hidden)] | ||
pub mod prelude; | ||
|
||
mod block; | ||
|