Skip to content
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

refactor(rust): Allow polars to pass cargo check on windows #18498

Merged
merged 1 commit into from
Sep 2, 2024
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.iml
*.so
*.pyd
*.ipynb
.ENV
.env
Expand Down
13 changes: 10 additions & 3 deletions crates/polars-io/src/mmap.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#[cfg(target_family = "unix")]
use std::collections::btree_map::Entry;
#[cfg(target_family = "unix")]
use std::collections::BTreeMap;
use std::fs::File;
use std::io::{BufReader, Cursor, Read, Seek};
use std::sync::{Arc, Mutex};
use std::sync::Arc;
#[cfg(target_family = "unix")]
use std::sync::Mutex;

use memmap::Mmap;
#[cfg(target_family = "unix")]
use once_cell::sync::Lazy;
use polars_core::config::verbose;
use polars_error::{polars_bail, PolarsResult};
#[cfg(target_family = "unix")]
use polars_error::polars_bail;
use polars_error::PolarsResult;
use polars_utils::mmap::MemSlice;

// Keep track of memory mapped files so we don't write to them while reading
Expand Down Expand Up @@ -60,7 +67,7 @@ impl Drop for MMapSemaphore {
}
}

pub fn ensure_not_mapped(file: &File) -> PolarsResult<()> {
pub fn ensure_not_mapped(#[allow(unused)] file: &File) -> PolarsResult<()> {
#[cfg(target_family = "unix")]
{
use std::os::unix::fs::MetadataExt;
Expand Down
4 changes: 3 additions & 1 deletion crates/polars-python/src/file.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::borrow::Cow;
use std::fs::{self, File};
#[cfg(target_family = "unix")]
use std::fs;
use std::fs::File;
use std::io;
use std::io::{Cursor, ErrorKind, Read, Seek, SeekFrom, Write};
#[cfg(target_family = "unix")]
Expand Down
4 changes: 2 additions & 2 deletions crates/polars-utils/src/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ pub fn prefetch_l2(slice: &[u8]) {
}

/// `madvise()` with `MADV_SEQUENTIAL` on unix systems. This is a no-op on non-unix systems.
pub fn madvise_sequential(slice: &[u8]) {
pub fn madvise_sequential(#[allow(unused)] slice: &[u8]) {
#[cfg(target_family = "unix")]
madvise(slice, libc::MADV_SEQUENTIAL);
}

/// `madvise()` with `MADV_WILLNEED` on unix systems. This is a no-op on non-unix systems.
pub fn madvise_willneed(slice: &[u8]) {
pub fn madvise_willneed(#[allow(unused)] slice: &[u8]) {
#[cfg(target_family = "unix")]
madvise(slice, libc::MADV_WILLNEED);
}
Expand Down