Skip to content

Commit b204ce3

Browse files
committed
Get rustc version at compile time
1 parent 1414480 commit b204ce3

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
8787
- Fixed some concurrency-related crashes in the renderer by adding a reentrant lock to the immediate context
8888
- Fixed a stack overflow in debug mode by moving global scopes/pipelines to the heap
8989
- When a texture handle is explicitly set to `none`, Alkahest will now properly unset the texture instead of binding the fallback texture
90+
- Bake rustc version as a constant instead of checking it at runtime
9091

9192
## 0.5.0 - 2024-07-24
9293

crates/alkahest-renderer/src/gpu/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use std::{
1010
atomic::{AtomicBool, AtomicI32, AtomicU32, AtomicUsize, Ordering},
1111
Arc,
1212
},
13-
thread::ThreadId,
1413
time::Duration,
1514
};
1615

crates/alkahest/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ paste = "1.0.14"
7070
profiling.workspace = true
7171
puffin_egui = "0.29.0"
7272
reqwest = { version = "0.12.3", features = ["json"] }
73-
rustc_version = "0.4.0"
7473
rustc-hash.workspace = true
7574
semver = "1.0.21"
7675
smallvec.workspace = true
@@ -103,4 +102,5 @@ targets = ["x86_64-pc-windows-gnu"]
103102
targets = ["x86_64-pc-windows-gnu"]
104103

105104
[build-dependencies]
105+
rustc_version = "0.4.0"
106106
winres = "0.1.12"

crates/alkahest/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ fn main() {
2929
println!("cargo:rustc-env=GIT_HASH=unknown-revision");
3030
}
3131

32+
if let Ok(v) = rustc_version::version_meta() {
33+
println!("cargo:rustc-env=RUSTC_VERSION={}", v.semver);
34+
}
35+
3236
if cfg!(target_os = "windows") {
3337
let mut res = winres::WindowsResource::new();
3438
res.set_icon("assets/icon2.ico");

crates/alkahest/src/gui/menu/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,8 @@ impl MenuBar {
134134
ui.separator();
135135
ui.label(format!("Revision {}", consts::GIT_HASH));
136136
ui.label(format!("Built on {}", consts::BUILD_DATE));
137-
if let Ok(v) = rustc_version::version_meta() {
138-
ui.add_space(8.0);
139-
ui.label(format!("rustc {}+{:?}", v.semver, v.channel));
140-
}
137+
ui.add_space(8.0);
138+
ui.label(format!("rustc {}", consts::RUSTC_VERSION));
141139
})
142140
});
143141
})

crates/alkahest/src/util/consts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use glam::Vec4;
44
pub const BUILD_DATE: &str = build_time_utc!("%Y-%m-%d");
55
pub const BUILD_TIMESTAMP: &str = build_time_utc!();
66
pub const GIT_HASH: &str = env!("GIT_HASH");
7+
pub const RUSTC_VERSION: &str = env!("RUSTC_VERSION");
78
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
89
pub const CHANGELOG_MD: &str = include_str!("../../../../CHANGELOG.md");
910

0 commit comments

Comments
 (0)