Skip to content

Commit

Permalink
Upgrade MSRV to 1.79-nightly + update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr committed May 18, 2024
1 parent cea74d7 commit 6c31ad6
Show file tree
Hide file tree
Showing 45 changed files with 914 additions and 459 deletions.
662 changes: 330 additions & 332 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions necsim/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ cuda = ["rust-cuda"]
necsim-core-maths = { path = "maths" }
necsim-core-bond = { path = "bond" }

const-type-layout = { version = "0.2.0", features = ["derive"] }
const-type-layout = { version = "0.3.0", features = ["derive"] }
contracts = "0.6.3"
serde = { version = "1.0", default-features = false, features = ["derive"] }

[target.'cfg(target_os = "cuda")'.dependencies]
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "6b53e88", features = ["derive"], optional = true }
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f395253", features = ["derive"], optional = true }

[target.'cfg(not(target_os = "cuda"))'.dependencies]
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "6b53e88", features = ["derive", "host"], optional = true }
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f395253", features = ["derive", "host"], optional = true }
2 changes: 1 addition & 1 deletion necsim/core/bond/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ default = []
[dependencies]
necsim-core-maths = { path = "../maths" }

const-type-layout = { version = "0.2.0", features = ["derive"] }
const-type-layout = { version = "0.3.0", features = ["derive"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }
1 change: 0 additions & 1 deletion necsim/core/bond/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![feature(const_float_bits_conv)]
#![feature(const_float_classify)]
#![feature(const_type_name)]
#![feature(offset_of)]

#[macro_use]
extern crate const_type_layout;
Expand Down
1 change: 1 addition & 0 deletions necsim/core/maths/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![deny(clippy::pedantic)]
#![no_std]
#![allow(internal_features)]
#![feature(core_intrinsics)]

pub trait MathsCore: 'static + Clone + core::fmt::Debug {
Expand Down
1 change: 0 additions & 1 deletion necsim/core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![deny(clippy::pedantic)]
#![no_std]
#![feature(const_type_name)]
#![feature(offset_of)]
#![feature(control_flow_enum)]
#![feature(min_specialization)]

Expand Down
2 changes: 0 additions & 2 deletions necsim/core/src/reporter/null.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use core::u64;

use crate::{impl_report, reporter::Reporter};

#[allow(clippy::module_name_repetitions)]
Expand Down
2 changes: 1 addition & 1 deletion necsim/core/src/reporter/used.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub type Ignored<T> = MaybeUsed<T, False>;

impl<'a, T, B: Boolean> From<&'a T> for &'a MaybeUsed<T, B> {
fn from(inner: &'a T) -> Self {
unsafe { &*(inner as *const T).cast() }
unsafe { &*core::ptr::from_ref(inner).cast() }
}
}

Expand Down
4 changes: 2 additions & 2 deletions necsim/core/src/simulation/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl<
// This is only safe as PartialSimulation's type and layout is a prefix
// subsequence of Self's type and layout
let partial_simulation = unsafe {
&mut *(self as *mut Self)
&mut *core::ptr::from_mut(self)
.cast::<super::partial::active_lineage_sampler::PartialSimulation<
M,
H,
Expand Down Expand Up @@ -213,7 +213,7 @@ impl<
// This is only safe as PartialSimulation's type and layout is a prefix
// subsequence of Self's type and layout
let partial_simulation = unsafe {
&mut *(self as *mut Self).cast::<super::partial::event_sampler::PartialSimulation<
&mut *core::ptr::from_mut(self).cast::<super::partial::event_sampler::PartialSimulation<
M,
H,
G,
Expand Down
4 changes: 2 additions & 2 deletions necsim/core/src/simulation/partial/active_lineage_sampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<
// This is only safe as PartialSimulation's type and layout is a prefix
// subsequence of Self's type and layout
let partial_simulation = unsafe {
&*(self as *const Self).cast::<super::event_sampler::PartialSimulation<
&*core::ptr::from_ref(self).cast::<super::event_sampler::PartialSimulation<
M,
H,
G,
Expand Down Expand Up @@ -87,7 +87,7 @@ impl<
// This is only safe as PartialSimulation's type and layout is a prefix
// subsequence of Self's type and layout
let partial_simulation = unsafe {
&mut *(self as *mut Self).cast::<super::event_sampler::PartialSimulation<
&mut *core::ptr::from_mut(self).cast::<super::event_sampler::PartialSimulation<
M,
H,
G,
Expand Down
2 changes: 1 addition & 1 deletion necsim/core/src/simulation/partial/event_sampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<
// This is only safe as PartialSimulation's type and layout is a prefix
// subsequence of Self's type and layout
let partial_simulation = unsafe {
&mut *(self as *mut Self)
&mut *core::ptr::from_mut(self)
.cast::<super::emigration_exit::PartialSimulation<M, H, G, S>>()
};

Expand Down
6 changes: 3 additions & 3 deletions necsim/impls/cuda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ edition = "2021"
[dependencies]
necsim-core = { path = "../../core", features = ["cuda"] }

const-type-layout = { version = "0.2.0", features = ["derive"] }
const-type-layout = { version = "0.3.0", features = ["derive"] }
contracts = "0.6.3"
serde = { version = "1.0", default-features = false, features = ["derive"] }

[target.'cfg(target_os = "cuda")'.dependencies]
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "6b53e88", features = ["derive"] }
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f395253", features = ["derive"] }

[target.'cfg(not(target_os = "cuda"))'.dependencies]
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "6b53e88", features = ["derive", "host"] }
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f395253", features = ["derive", "host"] }
4 changes: 2 additions & 2 deletions necsim/impls/cuda/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#![deny(clippy::pedantic)]
#![no_std]
#![feature(core_intrinsics)]
#![feature(const_type_name)]
#![feature(offset_of)]
#![cfg_attr(target_os = "cuda", feature(asm_experimental_arch))]
#![cfg_attr(target_os = "cuda", feature(asm_const))]
#![cfg_attr(target_os = "cuda", feature(const_float_bits_conv))]
#![allow(internal_features)]
#![feature(core_intrinsics)]
#![allow(incomplete_features)]
#![feature(specialization)]

Expand Down
8 changes: 4 additions & 4 deletions necsim/impls/no-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ necsim-core-maths = { path = "../../core/maths" }
necsim-core-bond = { path = "../../core/bond" }
necsim-partitioning-core = { path = "../../partitioning/core" }

const-type-layout = { version = "0.2.0", features = ["derive"] }
const-type-layout = { version = "0.3.0", features = ["derive"] }
contracts = "0.6.3"
libm = "0.2"
hashbrown = "0.13"
hashbrown = "0.14"
slab = { version = "0.4", default-features = false, features = [] }
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
log = "0.4"
Expand All @@ -30,7 +30,7 @@ fnv = { version = "1.0", default-features = false, features = [] }
rand_core = "0.6"

[target.'cfg(target_os = "cuda")'.dependencies]
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "6b53e88", features = ["derive"], optional = true }
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f395253", features = ["derive"], optional = true }

[target.'cfg(not(target_os = "cuda"))'.dependencies]
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "6b53e88", features = ["derive", "host"], optional = true }
rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f395253", features = ["derive", "host"], optional = true }
2 changes: 1 addition & 1 deletion necsim/impls/no-std/src/alias/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<E: Copy + PartialEq> AliasMethodSampler<E> {

// Safety: The bucket weights are now probabilities in [0.0; 1.0]
#[allow(non_snake_case)]
let Us = unsafe { core::mem::transmute(Us) };
let Us = unsafe { core::mem::transmute::<Vec<NonNegativeF64>, Vec<ClosedUnitF64>>(Us) };

Self { Us, Es, Ks }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ impl<M: MathsCore, H: Habitat<M>, G: RngCore<M>> InMemoryDispersalSampler<M, H,
}

// Safety: The dispersal weights are now probabilities in [0.0; 1.0]
let cumulative_dispersal = unsafe { core::mem::transmute(cumulative_dispersal) };
let cumulative_dispersal = unsafe {
core::mem::transmute::<Box<[NonNegativeF64]>, Box<[ClosedUnitF64]>>(
cumulative_dispersal,
)
};

InMemoryCumulativeDispersalSampler {
cumulative_dispersal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,3 @@ impl<
> VecType<T> for X
{
}

trait VecArgumentType:
Sub<Self, Output = Self> + Add<Self, Output = Self> + Mul<Self, Output = Self> + Copy
{
}
impl<T: Sub<Self, Output = Self> + Add<Self, Output = Self> + Mul<Self, Output = Self> + Copy>
VecArgumentType for T
{
}
2 changes: 2 additions & 0 deletions necsim/impls/no-std/src/cogs/turnover_rate/in_memory.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(non_local_definitions)] // FIXME: displaydoc

use alloc::boxed::Box;

use r#final::Final;
Expand Down
1 change: 0 additions & 1 deletion necsim/impls/no-std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![feature(iter_advance_by)]
#![feature(extract_if)]
#![feature(const_type_name)]
#![feature(offset_of)]
#![feature(negative_impls)]
#![feature(impl_trait_in_assoc_type)]
#![allow(incomplete_features)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ impl<'l, 'p, R: Reporter, P: LocalPartition<'p, R>> fmt::Debug
for RecordedWaterLevelReporterProxy<'l, 'p, R, P>
{
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
struct EventBufferLen(usize);

impl fmt::Debug for EventBufferLen {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Vec<PackedEvent; {}>", self.0)
}
}

fmt.debug_struct(stringify!(RecordedWaterLevelReporterProxy))
.field("water_level", &self.water_level)
.finish()
Expand Down
2 changes: 1 addition & 1 deletion necsim/impls/std/src/event_log/recorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl EventLogRecorder {
return Err(anyhow::anyhow!("{:?} is a read-only directory.", path));
}

self.directory = path.to_owned();
path.clone_into(&mut self.directory);

Ok(self)
}
Expand Down
3 changes: 1 addition & 2 deletions necsim/partitioning/mpi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ necsim-impls-std = { path = "../../impls/std" }
necsim-partitioning-core = { path = "../../partitioning/core" }

contracts = "0.6.3"
mpi = { git = "https://github.com/juntyr/rsmpi", rev = "ed8c10d", version = "0.6", default-features = false, features = ["derive"] }
mpi = { git = "https://github.com/juntyr/rsmpi", rev = "2988f56", version = "0.8", default-features = false, features = ["derive"] }
thiserror = "1.0"
anyhow = "1.0"
memoffset = "0.8"
serde = "1.0"
serde_state = "0.4"
serde_derive_state = "0.4"
Expand Down
4 changes: 2 additions & 2 deletions necsim/partitioning/mpi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use anyhow::Context;
use humantime_serde::re::humantime::format_duration;
use mpi::{
environment::Universe,
topology::{Communicator, Rank, SystemCommunicator},
topology::{Communicator, Rank, SimpleCommunicator},
Tag,
};
use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer};
Expand Down Expand Up @@ -46,7 +46,7 @@ pub enum MpiLocalPartitionError {

pub struct MpiPartitioning {
universe: ManuallyDrop<Universe>,
world: SystemCommunicator,
world: SimpleCommunicator,
migration_interval: Duration,
progress_interval: Duration,
}
Expand Down
6 changes: 3 additions & 3 deletions necsim/partitioning/mpi/src/partition/parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use mpi::{
datatype::Equivalence,
environment::Universe,
point_to_point::{Destination, Source},
topology::{Communicator, SystemCommunicator},
topology::{Communicator, SimpleCommunicator},
};

use necsim_core::{
Expand All @@ -36,7 +36,7 @@ use crate::{

pub struct MpiParallelPartition<'p, R: Reporter> {
_universe: Universe,
world: SystemCommunicator,
world: SimpleCommunicator,
mpi_local_global_wait: DataOrRequest<'p, (bool, bool), bool>,
mpi_local_remaining: DataOrRequest<'p, u64, u64>,
mpi_migration_buffers: Box<[DataOrRequest<'p, Vec<MigratingLineage>, [MpiMigratingLineage]>]>,
Expand Down Expand Up @@ -261,7 +261,7 @@ impl<'p, R: Reporter> LocalPartition<'p, R> for MpiParallelPartition<'p, R> {
let local_partition_rank = self.get_partition().rank();

let (global_min_time, global_min_rank) =
reduce_lexicographic_min_time_rank(self.world, local_time, local_partition_rank);
reduce_lexicographic_min_time_rank(&self.world, local_time, local_partition_rank);

if global_min_rank == local_partition_rank {
Ok(local_time)
Expand Down
6 changes: 3 additions & 3 deletions necsim/partitioning/mpi/src/partition/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use mpi::{
datatype::Equivalence,
environment::Universe,
point_to_point::{Destination, Source},
topology::{Communicator, SystemCommunicator},
topology::{Communicator, SimpleCommunicator},
};

use necsim_core::{
Expand All @@ -37,7 +37,7 @@ use crate::{

pub struct MpiRootPartition<'p, R: Reporter> {
_universe: Universe,
world: SystemCommunicator,
world: SimpleCommunicator,
mpi_local_global_wait: DataOrRequest<'p, (bool, bool), bool>,
mpi_migration_buffers: Box<[DataOrRequest<'p, Vec<MigratingLineage>, [MpiMigratingLineage]>]>,
migration_buffers: Box<[Vec<MigratingLineage>]>,
Expand Down Expand Up @@ -279,7 +279,7 @@ impl<'p, R: Reporter> LocalPartition<'p, R> for MpiRootPartition<'p, R> {
let local_partition_rank = self.get_partition().rank();

let (global_min_time, global_min_rank) =
reduce_lexicographic_min_time_rank(self.world, local_time, local_partition_rank);
reduce_lexicographic_min_time_rank(&self.world, local_time, local_partition_rank);

if global_min_rank == local_partition_rank {
Ok(local_time)
Expand Down
7 changes: 3 additions & 4 deletions necsim/partitioning/mpi/src/partition/utils.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use std::{
mem::MaybeUninit,
mem::{offset_of, MaybeUninit},
os::raw::{c_int, c_void},
};

use memoffset::offset_of;
use mpi::{
collective::UnsafeUserOperation,
datatype::{Equivalence, UserDatatype},
ffi::MPI_Datatype,
topology::SystemCommunicator,
topology::SimpleCommunicator,
traits::CommunicatorCollectives,
};

Expand All @@ -23,7 +22,7 @@ struct TimeRank {
}

pub fn reduce_lexicographic_min_time_rank(
world: SystemCommunicator,
world: &SimpleCommunicator,
time: PositiveF64,
rank: u32,
) -> (PositiveF64, u32) {
Expand Down
2 changes: 1 addition & 1 deletion necsim/plugins/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ necsim-core = { path = "../../core" }

log = "0.4"
serde = { version = "1.0", features = ["derive"] }
erased-serde = "0.3"
erased-serde = "0.4"

libloading = { version = "0.8", optional = true }
process_path = { version = "0.1", optional = true }
Expand Down
19 changes: 18 additions & 1 deletion necsim/plugins/core/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,24 @@ impl<R: SerializeableReporter> From<R> for UnsafeReporterPlugin {
> = Box::new(reporter);

Self {
reporter: unsafe { std::mem::transmute(boxed_reporter) },
reporter: unsafe {
std::mem::transmute::<
Box<
dyn SerializeableReporter<
ReportDispersal = R::ReportDispersal,
ReportProgress = R::ReportProgress,
ReportSpeciation = R::ReportSpeciation,
>,
>,
Box<
dyn SerializeableReporter<
ReportDispersal = True,
ReportProgress = True,
ReportSpeciation = True,
>,
>,
>(boxed_reporter)
},
filter: ReporterPluginFilter::from_reporter::<R>(),
}
}
Expand Down
6 changes: 3 additions & 3 deletions necsim/plugins/species/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ necsim-plugins-core = { path = "../core", features = ["export"] }

serde = { version = "1.0", features = ["derive"] }
log = { version = "0.4" }
rusqlite = "0.29"
rusqlite = "0.31"
fnv = "1.0"
base32 = "0.4"
base32 = "0.5"
hex = "0.4"
bincode = "1.3"
arrow2 = { version = "0.17", features = ["io_ipc"] }
arrow2 = { version = "0.18", features = ["io_ipc"] }

[dev-dependencies]
rand = "0.8"
Loading

0 comments on commit 6c31ad6

Please sign in to comment.