| 1 | #![allow(clippy::uninlined_format_args)] |
| 2 | |
| 3 | 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/; |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#; |
| 5 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/; |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#; |
| 7 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/; |
| 8 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#; |
| 9 | 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/::{selfrust-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#, Stdiorust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Stdio#}; |
| 10 | 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/; |
| 11 | |
| 12 | fn mainrust-analyzer cargo anyhow 1.0.103 main().() { |
| 13 | if cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(feature = "std") { |
| 14 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rerun-if-changed=src/nightly.rs"); |
| 15 | |
| 16 | let error_generic_member_access; |
| 17 | let consider_rustc_bootstrap; |
| 18 | if compile_proberust-analyzer cargo anyhow 1.0.103 compile_probe().(false) { |
| 19 | // This is a nightly or dev compiler, so it supports unstable |
| 20 | // features regardless of RUSTC_BOOTSTRAP. No need to rerun build |
| 21 | // script if RUSTC_BOOTSTRAP is changed. |
| 22 | error_generic_member_access = true; |
| 23 | consider_rustc_bootstrap = false; |
| 24 | } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(rustc_bootstrap) = 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_BOOTSTRAP") { |
| 25 | if compile_proberust-analyzer cargo anyhow 1.0.103 compile_probe().(true) { |
| 26 | // This is a stable or beta compiler for which the user has set |
| 27 | // RUSTC_BOOTSTRAP to turn on unstable features. Rerun build |
| 28 | // script if they change it. |
| 29 | error_generic_member_access = true; |
| 30 | consider_rustc_bootstrap = true; |
| 31 | } else if rustc_bootstrap rust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString][`PartialEq<&str>`]eq().==rust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString][`PartialEq<&str>`]eq(). rust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString][`PartialEq<&str>`]eq()."1" { |
| 32 | // This compiler does not support the generic member access API |
| 33 | // in the form that anyhow expects. No need to pay attention to |
| 34 | // RUSTC_BOOTSTRAP. |
| 35 | error_generic_member_access = false; |
| 36 | consider_rustc_bootstrap = false; |
| 37 | } else { |
| 38 | // This is a stable or beta compiler for which RUSTC_BOOTSTRAP |
| 39 | // is set to restrict the use of unstable features by this |
| 40 | // crate. |
| 41 | error_generic_member_access = false; |
| 42 | consider_rustc_bootstrap = true; |
| 43 | } |
| 44 | } else { |
| 45 | // Without RUSTC_BOOTSTRAP, this compiler does not support the |
| 46 | // generic member access API in the form that anyhow expects, but |
| 47 | // try again if the user turns on unstable features. |
| 48 | error_generic_member_access = false; |
| 49 | consider_rustc_bootstrap = true; |
| 50 | } |
| 51 | |
| 52 | if error_generic_member_access { |
| 53 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-cfg=error_generic_member_access"); |
| 54 | } |
| 55 | |
| 56 | if consider_rustc_bootstrap { |
| 57 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP"); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(rustc) = rustc_minor_versionrust-analyzer cargo anyhow 1.0.103 rustc_minor_version().() else { |
| 62 | return; |
| 63 | }; |
| 64 | |
| 65 | if rustc rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().80 { |
| 66 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-check-cfg=cfg(anyhow_build_probe)"); |
| 67 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-check-cfg=cfg(anyhow_nightly_testing)"); |
| 68 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-check-cfg=cfg(anyhow_no_clippy_format_args)"); |
| 69 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-check-cfg=cfg(anyhow_no_core_error)"); |
| 70 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-check-cfg=cfg(error_generic_member_access)"); |
| 71 | } |
| 72 | |
| 73 | if rustc 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().81 { |
| 74 | // core::error::Error |
| 75 | // https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#coreerrorerror |
| 76 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-cfg=anyhow_no_core_error"); |
| 77 | } |
| 78 | |
| 79 | if rustc 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().85 { |
| 80 | // #[clippy::format_args] |
| 81 | // https://doc.rust-lang.org/1.85.1/clippy/attribs.html#clippyformat_args |
| 82 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-cfg=anyhow_no_clippy_format_args"); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | fn compile_proberust-analyzer cargo anyhow 1.0.103 compile_probe().(rustc_bootstrap: bool) -> bool { |
| 87 | if 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_STAGE").is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 88 | // We are running inside rustc bootstrap. This is a highly non-standard |
| 89 | // environment with issues such as: |
| 90 | // |
| 91 | // https://github.com/rust-lang/cargo/issues/11138 |
| 92 | // https://github.com/rust-lang/rust/issues/114839 |
| 93 | // |
| 94 | // Let's just not use nightly features here. |
| 95 | return false; |
| 96 | } |
| 97 | |
| 98 | let rustc = cargo_env_varrust-analyzer cargo anyhow 1.0.103 cargo_env_var().("RUSTC"); |
| 99 | let out_dir = cargo_env_varrust-analyzer cargo anyhow 1.0.103 cargo_env_var().("OUT_DIR"); |
| 100 | let out_subdir = Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(&out_dir).joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("probe"); |
| 101 | let probefile = Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("src").joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("nightly.rs"); |
| 102 | |
| 103 | if let Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::create_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/create_dir().(&out_subdir) { |
| 104 | if err.kindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]kind().() 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().ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::AlreadyExistsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#AlreadyExists# { |
| 105 | eprintlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/eprintln!!("Failed to create {}: {}", out_subdir.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().(), err); |
| 106 | processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/::exitrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/exit().(1); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | let rustc_wrapper = 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_WRAPPER").filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]filter().(|wrapper| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().wrapper.is_emptyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]is_empty().()); |
| 111 | let rustc_workspace_wrapper = |
| 112 | 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_WORKSPACE_WRAPPER").filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]filter().(|wrapper| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().wrapper.is_emptyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]is_empty().()); |
| 113 | let mut rustc = rustc_wrapper |
| 114 | .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][IntoIterator]into_iter().() |
| 115 | .chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(rustc_workspace_wrapper) |
| 116 | .chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().(rustc)); |
| 117 | let mut cmd = 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.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/chain/impl#[`Chain<A, B>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()); |
| 118 | cmd.argsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]args().(rustc); |
| 119 | |
| 120 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().rustc_bootstrap { |
| 121 | cmd.env_removerust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]env_remove().("RUSTC_BOOTSTRAP"); |
| 122 | } |
| 123 | |
| 124 | cmd.stderrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]stderr().(Stdiorust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Stdio#::nullrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Stdio]null().()) |
| 125 | .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--cfg=anyhow_build_probe") |
| 126 | .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--edition=2018") |
| 127 | .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--crate-name=anyhow") |
| 128 | .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--crate-type=lib") |
| 129 | .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--cap-lints=allow") |
| 130 | .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--emit=dep-info,metadata") |
| 131 | .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--out-dir") |
| 132 | .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().(&out_subdir) |
| 133 | .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().(probefile); |
| 134 | |
| 135 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(target) = 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().("TARGET") { |
| 136 | cmd.argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--target").argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().(target); |
| 137 | } |
| 138 | |
| 139 | // If Cargo wants to set RUSTFLAGS, use that. |
| 140 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rustflags) = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("CARGO_ENCODED_RUSTFLAGS") { |
| 141 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().rustflags.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() { |
| 142 | for arg in rustflags.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().('\x1f') { |
| 143 | cmd.argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().(arg); |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | let success = match cmd.statusrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]status().() { |
| 149 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(status) => status.successrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[ExitStatus]success().(), |
| 150 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => false, |
| 151 | }; |
| 152 | |
| 153 | // Clean up to avoid leaving nondeterministic absolute paths in the dep-info |
| 154 | // file in OUT_DIR, which causes nonreproducible builds in build systems |
| 155 | // that treat the entire OUT_DIR as an artifact. |
| 156 | if let Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::remove_dir_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/remove_dir_all().(&out_subdir) { |
| 157 | // libc::ENOTEMPTY |
| 158 | // Some filesystems (NFSv3) have timing issues under load where '.nfs*' |
| 159 | // dummy files can continue to get created for a short period after the |
| 160 | // probe command completes, breaking remove_dir_all. |
| 161 | // To be replaced with ErrorKind::DirectoryNotEmpty (Rust 1.83+). |
| 162 | const ENOTEMPTYrust-analyzer cargo anyhow 1.0.103 ENOTEMPTY.: i32 = 39; |
| 163 | |
| 164 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(err.kindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]kind().() rust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[ErrorKind][`PartialEq<Self>`]eq().==rust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[ErrorKind][`PartialEq<Self>`]eq(). rust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[ErrorKind][`PartialEq<Self>`]eq().ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::NotFoundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#NotFound# |
| 165 | || (cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(target_os = "linux") && err.raw_os_errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]raw_os_error().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ENOTEMPTYrust-analyzer cargo anyhow 1.0.103 ENOTEMPTY.))) |
| 166 | { |
| 167 | eprintlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/eprintln!!("Failed to clean up {}: {}", out_subdir.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().(), err); |
| 168 | processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/::exitrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/exit().(1); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | success |
| 173 | } |
| 174 | |
| 175 | fn rustc_minor_versionrust-analyzer cargo anyhow 1.0.103 rustc_minor_version().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32> { |
| 176 | let rustc = cargo_env_varrust-analyzer cargo anyhow 1.0.103 cargo_env_var().("RUSTC"); |
| 177 | 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().; |
| 178 | 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().; |
| 179 | let mut pieces = version.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().('.'); |
| 180 | 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") { |
| 181 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 182 | } |
| 183 | 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().() |
| 184 | } |
| 185 | |
| 186 | fn cargo_env_varrust-analyzer cargo anyhow 1.0.103 cargo_env_var().(key: &str) -> OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString# { |
| 187 | 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().(key).unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| { |
| 188 | eprintlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/eprintln!!( |
| 189 | "Environment variable ${} is not set during execution of build script", |
| 190 | key, |
| 191 | ); |
| 192 | processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/::exitrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/exit().(1); |
| 193 | }) |
| 194 | } |