proc-macro2

Latest version: 1.0.92 registry icon
Maintenance score
100
Safety score
100
Popularity score
40
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
1.0.92 0 0 0 0 0
1.0.91 0 0 0 0 0
1.0.90 0 0 0 0 0
1.0.89 0 0 0 0 0
1.0.88 0 0 0 0 0
1.0.87 0 0 0 0 0
1.0.86 0 0 0 0 0
1.0.85 0 0 0 0 0
1.0.84 0 0 0 0 0
1.0.83 0 0 0 0 0
1.0.82 0 0 0 0 0
1.0.81 0 0 0 0 0
1.0.80 0 0 0 0 0
1.0.79 0 0 0 0 0
1.0.78 0 0 0 0 0
1.0.77 0 0 0 0 0
1.0.76 0 0 0 0 0
1.0.75 0 0 0 0 0
1.0.74 0 0 0 0 0
1.0.73 0 0 0 0 0
1.0.72 0 0 0 0 0
1.0.71 0 0 0 0 0
1.0.70 0 0 0 0 0
1.0.69 0 0 0 0 0
1.0.68 0 0 0 0 0
1.0.67 0 0 0 0 0
1.0.66 0 0 0 0 0
1.0.65 0 0 0 0 0
1.0.64 0 0 0 0 0
1.0.63 0 0 0 0 0
1.0.62 0 0 0 0 0
1.0.61 0 0 0 0 0
1.0.60 0 0 0 0 0
1.0.59 0 0 0 0 0
1.0.58 0 0 0 0 0
1.0.57 0 0 0 0 0
1.0.56 0 0 0 0 0
1.0.55 0 0 0 0 0
1.0.54 0 0 0 0 0
1.0.53 0 0 0 0 0
1.0.52 0 0 0 0 0
1.0.51 0 0 0 0 0
1.0.50 0 0 0 0 0
1.0.49 0 0 0 0 0
1.0.48 0 0 0 0 0
1.0.47 0 0 0 0 0
1.0.46 0 0 0 0 0
1.0.45 0 0 0 0 0
1.0.44 0 0 0 0 0
1.0.43 0 0 0 0 0
1.0.42 0 0 0 0 0
1.0.41 0 0 0 0 0
1.0.40 0 0 0 0 0
1.0.39 0 0 0 0 0
1.0.38 0 0 0 0 0
1.0.37 0 0 0 0 0
1.0.36 0 0 0 0 0
1.0.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2 0 0 0 0 0
0.4.1 0 0 0 0 0
0.4.0 0 0 0 0 0
0.3.8 0 0 0 0 0
0.3.7 0 0 0 0 0
0.3.6 0 0 0 0 0
0.3.5 0 0 0 0 0
0.3.4 0 0 0 0 0
0.3.3 0 0 0 0 0
0.3.2 0 0 0 0 0
0.3.1 0 0 0 0 0
0.3.0 0 0 0 0 0
0.2.3 0 0 0 0 0
0.2.2 0 0 0 0 0
0.2.1 0 0 0 0 0
0.2.0 0 0 0 0 0
0.1.10 0 0 0 0 0
0.1.9 0 0 0 0 0
0.1.8 0 0 0 0 0
0.1.7 0 0 0 0 0
0.1.6 0 0 0 0 0
0.1.5 0 0 0 0 0
0.1.4 0 0 0 0 0
0.1.3 0 0 0 0 0
0.1.2 0 0 0 0 0
0.1.1 0 0 0 0 0
0.1.0 0 0 0 0 0

Stability
Latest release:

1.0.92 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant


MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



proc-macro2

github crates.io docs.rs build status

A wrapper around the procedural macro API of the compiler's proc_macro crate. This library serves two purposes:

  • Bring proc-macro-like functionality to other contexts like build.rs and main.rs. Types from proc_macro are entirely specific to procedural macros and cannot ever exist in code outside of a procedural macro. Meanwhile proc_macro2 types may exist anywhere including non-macro code. By developing foundational libraries like syn and quote against proc_macro2 rather than proc_macro, the procedural macro ecosystem becomes easily applicable to many other use cases and we avoid reimplementing non-macro equivalents of those libraries.

  • Make procedural macros unit testable. As a consequence of being specific to procedural macros, nothing that uses proc_macro can be executed from a unit test. In order for helper libraries or components of a macro to be testable in isolation, they must be implemented using proc_macro2.

Usage

[dependencies]
proc-macro2 = "1.0"

The skeleton of a typical procedural macro typically looks like this:

extern crate proc_macro;

#[proc_macro_derive(MyDerive)]
pub fn my_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    let input = proc_macro2::TokenStream::from(input);

    let output: proc_macro2::TokenStream = {
        /* transform input */
    };

    proc_macro::TokenStream::from(output)
}

If parsing with Syn, you'll use parse_macro_input! instead to propagate parse errors correctly back to the compiler when parsing fails.

Unstable features

The default feature set of proc-macro2 tracks the most recent stable compiler API. Functionality in proc_macro that is not yet stable is not exposed by proc-macro2 by default.

To opt into the additional APIs available in the most recent nightly compiler, the procmacro2_semver_exempt config flag must be passed to rustc. We will polyfill those nightly-only APIs back to Rust 1.56.0. As these are unstable APIs that track the nightly compiler, minor versions of proc-macro2 may make breaking changes to them at any time.

RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo build

Note that this must not only be done for your crate, but for any crate that depends on your crate. This infectious nature is intentional, as it serves as a reminder that you are outside of the normal semver guarantees.

Semver exempt methods are marked as such in the proc-macro2 documentation.


License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.