| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/::Commandrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Command#; |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/; |
| 4 | |
| 5 | // The rustc-cfg strings below are *not* public API. Please let us know by |
| 6 | // opening a GitHub issue if your build environment requires some way to enable |
| 7 | // these cfgs other than by executing our build script. |
| 8 | fn mainrust-analyzer cargo proc-macro-hack 0.5.19 main().() { |
| 9 | let minor = match rustc_minor_versionrust-analyzer cargo proc-macro-hack 0.5.19 rustc_minor_version().() { |
| 10 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(minor) => minor, |
| 11 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return, |
| 12 | }; |
| 13 | |
| 14 | // Function-like procedural macros in expressions, patterns, and statements |
| 15 | // stabilized in Rust 1.45: |
| 16 | // https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html#stabilizing-function-like-procedural-macros-in-expressions-patterns-and-statements |
| 17 | if minor rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]lt().45 { |
| 18 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-cfg=need_proc_macro_hack"); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | fn rustc_minor_versionrust-analyzer cargo proc-macro-hack 0.5.19 rustc_minor_version().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32> { |
| 23 | let rustc = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("RUSTC")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 24 | let output = Commandrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Command#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]new().(rustc).argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--version").outputrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]output().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 25 | let version = strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(&output.stdoutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Output#stdout.).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 26 | let mut pieces = version.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().('.'); |
| 27 | if pieces.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Iterator]next().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("rustc 1") { |
| 28 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 29 | } |
| 30 | pieces.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Iterator]next().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().() |
| 31 | } |