Skip to content

Fixed compile errors and warnings on Windows #2646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/bench/benches/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use spacetimedb_testing::modules::{Csharp, Rust};

#[cfg(target_env = "msvc")]
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;
Expand Down
2 changes: 1 addition & 1 deletion crates/bench/benches/special.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::sync::OnceLock;

#[cfg(target_env = "msvc")]
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;
Expand Down
2 changes: 2 additions & 0 deletions crates/core/src/db/relational_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,7 @@ mod tests {
use spacetimedb_sats::buffer::BufReader;
use spacetimedb_sats::product;
use spacetimedb_schema::schema::RowLevelSecuritySchema;
#[cfg(unix)]
use spacetimedb_snapshot::Snapshot;
use spacetimedb_table::read_column::ReadColumn;
use spacetimedb_table::table::RowRef;
Expand Down Expand Up @@ -2710,6 +2711,7 @@ mod tests {
let (dir, repo) = make_snapshot(root.clone(), Identity::ZERO, 0, CompressType::None, true);
stdb.take_snapshot(&repo)?;

#[cfg(unix)]
let total_objects = repo.size_on_disk()?.object_count;
// Another snapshots that will hardlink part of the first one
for i in 0..2 {
Expand Down
9 changes: 5 additions & 4 deletions crates/core/src/worker_metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ use tikv_jemalloc_ctl::{epoch, stats};

use std::sync::Once;
use tokio::{spawn, time::sleep};
#[cfg(not(target_env = "msvc"))]
static SPAWN_JEMALLOC_GUARD: Once = Once::new();
pub fn spawn_jemalloc_stats(node_id: String) {
pub fn spawn_jemalloc_stats(_node_id: String) {
#[cfg(not(target_env = "msvc"))]
SPAWN_JEMALLOC_GUARD.call_once(|| {
spawn(async move {
Expand All @@ -242,17 +243,17 @@ pub fn spawn_jemalloc_stats(node_id: String) {
let allocated = stats::allocated::read().unwrap();
WORKER_METRICS
.jemalloc_allocated_bytes
.with_label_values(&node_id)
.with_label_values(&_node_id)
.set(allocated as i64);
let resident = stats::resident::read().unwrap();
WORKER_METRICS
.jemalloc_resident_bytes
.with_label_values(&node_id)
.with_label_values(&_node_id)
.set(resident as i64);
let active = stats::active::read().unwrap();
WORKER_METRICS
.jemalloc_active_bytes
.with_label_values(&node_id)
.with_label_values(&_node_id)
.set(active as i64);

sleep(Duration::from_secs(10)).await;
Expand Down
3 changes: 2 additions & 1 deletion crates/paths/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,14 @@ impl SpacetimePaths {

#[cfg(test)]
mod tests {
use std::ffi::{OsStr, OsString};
use std::path::Path;

use super::*;

#[cfg(not(windows))]
mod vars {
use super::*;
use std::ffi::{OsStr, OsString};
struct ResetVar<'a>(&'a str, Option<OsString>);
impl Drop for ResetVar<'_> {
fn drop(&mut self) {
Expand Down
6 changes: 3 additions & 3 deletions crates/update/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::process::ExitCode;

pub(crate) fn run_cli(
paths: Option<&SpacetimePaths>,
argv0: Option<&OsStr>,
_argv0: Option<&OsStr>,
args: Vec<OsString>,
) -> anyhow::Result<ExitCode> {
let parse_args = || PartialCliArgs::parse(&args);
Expand Down Expand Up @@ -44,8 +44,8 @@ pub(crate) fn run_cli(
#[cfg(unix)]
{
use std::os::unix::process::CommandExt;
if let Some(argv0) = argv0 {
cmd.arg0(argv0);
if let Some(_argv0) = _argv0 {
cmd.arg0(_argv0);
}
};
let exec_result = exec_replace(&mut cmd).with_context(|| format!("exec failed for {}", cli_path.display()));
Expand Down
Loading