update toolchain to nightly-2023-09-28

This commit is contained in:
Marcel Märtens 2023-09-28 16:51:32 +02:00
parent 63b001959e
commit 394c8892bb
27 changed files with 58 additions and 61 deletions

18
Cargo.lock generated
View File

@ -3250,12 +3250,6 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "libm"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
[[package]] [[package]]
name = "libm" name = "libm"
version = "0.2.7" version = "0.2.7"
@ -4005,7 +3999,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"libm 0.2.7", "libm",
] ]
[[package]] [[package]]
@ -4254,13 +4248,13 @@ dependencies = [
] ]
[[package]] [[package]]
name = "packed_simd_2" name = "packed_simd"
version = "0.3.8" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" checksum = "1f9f08af0c877571712e2e3e686ad79efad9657dbf0f7c3c8ba943ff6c38932d"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libm 0.1.4", "num-traits",
] ]
[[package]] [[package]]
@ -7315,7 +7309,7 @@ dependencies = [
"num 0.4.1", "num 0.4.1",
"num-traits", "num-traits",
"ordered-float 3.9.1", "ordered-float 3.9.1",
"packed_simd_2", "packed_simd",
"rand 0.8.5", "rand 0.8.5",
"rand_chacha 0.3.1", "rand_chacha 0.3.1",
"rayon", "rayon",

View File

@ -1,6 +1,7 @@
cargo-features = ["named-profiles","profile-overrides"] cargo-features = ["named-profiles","profile-overrides"]
[workspace] [workspace]
resolver = "2"
members = [ members = [
"common", "common",
"common/assets", "common/assets",

View File

@ -517,7 +517,7 @@ impl SkillSet {
// Perform all mutation inside this branch, to avoid triggering a copy // Perform all mutation inside this branch, to avoid triggering a copy
// on write or flagged storage in cases where this matters. // on write or flagged storage in cases where this matters.
let this_ = to_mut(this_); let this_ = to_mut(this_);
let mut this = this_.borrow_mut(); let this = this_.borrow_mut();
// NOTE: Verified to exist previously when we accessed // NOTE: Verified to exist previously when we accessed
// this.skill_groups (assuming a non-pathological implementation of // this.skill_groups (assuming a non-pathological implementation of
// ToOwned). // ToOwned).

View File

@ -12,9 +12,9 @@
type_alias_impl_trait, type_alias_impl_trait,
extend_one, extend_one,
arbitrary_self_types, arbitrary_self_types,
int_roundings int_roundings,
hash_extract_if
)] )]
#![feature(hash_drain_filter)]
pub use common_assets as assets; pub use common_assets as assets;
pub use uuid; pub use uuid;

View File

@ -1,4 +1,4 @@
#![feature(drain_filter, let_chains)] #![feature(extract_if, let_chains)]
#![allow(clippy::option_map_unit_fn)] #![allow(clippy::option_map_unit_fn)]
mod aura; mod aura;

View File

@ -61,7 +61,7 @@ impl<'a> System<'a> for Sys {
.map(|c| ( .map(|c| (
// Only take inputs and actions from the rider if the mount is not intelligent (TODO: expand the definition of 'intelligent'). // Only take inputs and actions from the rider if the mount is not intelligent (TODO: expand the definition of 'intelligent').
if !matches!(body, Some(Body::Humanoid(_))) { if !matches!(body, Some(Body::Humanoid(_))) {
let actions = c.actions.drain_filter(|action| match action { let actions = c.actions.extract_if(|action| match action {
ControlAction::StartInput { input: i, .. } ControlAction::StartInput { input: i, .. }
| ControlAction::CancelInput(i) => matches!(i, InputKind::Jump | InputKind::Fly | InputKind::Roll), | ControlAction::CancelInput(i) => matches!(i, InputKind::Jump | InputKind::Fly | InputKind::Roll),
_ => false _ => false
@ -151,7 +151,7 @@ impl<'a> System<'a> for Sys {
let inputs = controllers.get_mut(entity).map(|c| { let inputs = controllers.get_mut(entity).map(|c| {
let actions: Vec<_> = c let actions: Vec<_> = c
.actions .actions
.drain_filter(|action| match action { .extract_if(|action| match action {
ControlAction::StartInput { input: i, .. } ControlAction::StartInput { input: i, .. }
| ControlAction::CancelInput(i) => { | ControlAction::CancelInput(i) => {
matches!(i, InputKind::Jump | InputKind::Fly | InputKind::Roll) matches!(i, InputKind::Jump | InputKind::Fly | InputKind::Roll)

View File

@ -222,7 +222,7 @@ impl<'a> PhysicsData<'a> {
} }
// Update PreviousPhysCache // Update PreviousPhysCache
for (_, vel, position, ori, mut phys_cache, collider, scale, cs) in ( for (_, vel, position, ori, phys_cache, collider, scale, cs) in (
&self.read.entities, &self.read.entities,
&self.write.velocities, &self.write.velocities,
&self.write.positions, &self.write.positions,
@ -797,7 +797,7 @@ impl<'a> PhysicsData<'a> {
ori, ori,
body, body,
character_state, character_state,
mut physics_state, physics_state,
pos_vel_ori_defer, pos_vel_ori_defer,
previous_cache, previous_cache,
_, _,

View File

@ -74,7 +74,7 @@ impl<'a> System<'a> for Sys {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
// Attacks // Attacks
'projectile_loop: for (entity, pos, physics, vel, mut projectile) in ( 'projectile_loop: for (entity, pos, physics, vel, projectile) in (
&read_data.entities, &read_data.entities,
&read_data.positions, &read_data.positions,
&read_data.physics_states, &read_data.physics_states,

View File

@ -1,4 +1,3 @@
#![feature(drain_filter)]
//! Network Protocol //! Network Protocol
//! //!
//! a I/O-Free protocol for the veloren network crate. //! a I/O-Free protocol for the veloren network crate.

View File

@ -388,7 +388,8 @@ where
// try to order pending // try to order pending
let mut pending_violated = false; let mut pending_violated = false;
let mut reliable = vec![]; let mut reliable = vec![];
self.pending_reliable_buffers.drain_filter(|(_, buffer)| {
self.pending_reliable_buffers.retain(|(_, buffer)| {
// try to get Sid without touching buffer // try to get Sid without touching buffer
let mut testbuffer = buffer.clone(); let mut testbuffer = buffer.clone();
match ITFrame::read_frame(&mut testbuffer) { match ITFrame::read_frame(&mut testbuffer) {
@ -398,13 +399,13 @@ where
length: _, length: _,
})) => { })) => {
reliable.push((sid, buffer.clone())); reliable.push((sid, buffer.clone()));
true false
}, },
Ok(Some(_)) | Err(_) => { Ok(Some(_)) | Err(_) => {
pending_violated = true; pending_violated = true;
true false
}, },
Ok(None) => false, Ok(None) => true,
} }
}); });

View File

@ -1 +1 @@
nightly-2023-04-20 nightly-2023-09-28

View File

@ -3,13 +3,11 @@
#![deny(clippy::clone_on_ref_ptr)] #![deny(clippy::clone_on_ref_ptr)]
#![feature( #![feature(
box_patterns, box_patterns,
drain_filter,
let_chains, let_chains,
never_type, never_type,
option_zip, option_zip,
unwrap_infallible unwrap_infallible
)] )]
#![feature(hash_drain_filter)]
pub mod automod; pub mod automod;
mod character_creator; mod character_creator;

View File

@ -267,8 +267,8 @@ impl CharacterUpdater {
} }
pub fn process_batch_completion(&mut self, completed_batch_id: u64) { pub fn process_batch_completion(&mut self, completed_batch_id: u64) {
self.pending_database_actions.drain_filter(|_, event| { self.pending_database_actions.retain(|_, event| {
matches!(event, DatabaseAction::Submitted { !matches!(event, DatabaseAction::Submitted {
batch_id, batch_id,
} if completed_batch_id == *batch_id) } if completed_batch_id == *batch_id)
}); });

View File

@ -59,7 +59,7 @@ impl<'a> System<'a> for Sys {
for (pet_entity, owner_pos) in lost_pets.iter() { for (pet_entity, owner_pos) in lost_pets.iter() {
let stay = agn.get(*pet_entity).and_then(|x| x.stay_pos).is_some(); let stay = agn.get(*pet_entity).and_then(|x| x.stay_pos).is_some();
if let Some(mut pet_pos) = positions.get_mut(*pet_entity) && !stay{ if let Some(pet_pos) = positions.get_mut(*pet_entity) && !stay{
// Move the pets to their owner's position // Move the pets to their owner's position
// TODO: Create a teleportation event to handle this instead of // TODO: Create a teleportation event to handle this instead of
// processing the entity position move here // processing the entity position move here

View File

@ -71,7 +71,7 @@ impl<'a> System<'a> for Sys {
// 7. Determine list of regions that are in range and iterate through it // 7. Determine list of regions that are in range and iterate through it
// - check if in hashset (hash calc) if not add it // - check if in hashset (hash calc) if not add it
let mut regions_to_remove = Vec::new(); let mut regions_to_remove = Vec::new();
for (mut subscription, pos, presence, client_entity, client) in ( for (subscription, pos, presence, client_entity, client) in (
&mut subscriptions, &mut subscriptions,
&positions, &positions,
&presences, &presences,

View File

@ -68,7 +68,7 @@ impl<'a> System<'a> for Sys {
.as_mut() .as_mut()
.map(|t| *t += dt.0); .map(|t| *t += dt.0);
for mut floater in hp_floater_list.floaters.iter_mut() { for floater in hp_floater_list.floaters.iter_mut() {
// Increment timer // Increment timer
floater.timer += dt.0; floater.timer += dt.0;
floater.jump_timer += dt.0; floater.jump_timer += dt.0;

View File

@ -4,14 +4,15 @@
#![deny(clippy::clone_on_ref_ptr)] #![deny(clippy::clone_on_ref_ptr)]
#![feature( #![feature(
array_methods, array_methods,
array_zip, extract_if,
drain_filter,
trait_alias, trait_alias,
option_get_or_insert_default, option_get_or_insert_default,
map_try_insert, map_try_insert,
slice_as_chunks, slice_as_chunks,
let_chains, let_chains,
generic_const_exprs generic_const_exprs,
maybe_uninit_uninit_array,
maybe_uninit_array_assume_init
)] )]
#![recursion_limit = "2048"] #![recursion_limit = "2048"]

View File

@ -314,7 +314,7 @@ impl PlayState for MainMenuState {
password, password,
server_address, server_address,
} => { } => {
let mut net_settings = &mut global_state.settings.networking; let net_settings = &mut global_state.settings.networking;
let use_quic = net_settings.use_quic; let use_quic = net_settings.use_quic;
net_settings.username = username.clone(); net_settings.username = username.clone();
net_settings.default_server = server_address.clone(); net_settings.default_server = server_address.clone();

View File

@ -39,7 +39,7 @@ impl Add<Vertex> for Vertex {
fn add(self, other: Self) -> Self::Output { fn add(self, other: Self) -> Self::Output {
Self { Self {
pos: self.pos.zip(other.pos).map(|(a, b)| a + b), pos: [self.pos[0] + other.pos[0], self.pos[1] + other.pos[1], self.pos[2] + other.pos[2]],
} }
} }
} }

View File

@ -22,6 +22,11 @@ pub struct Locals {
pub postprocess_bind: postprocess::BindGroup, pub postprocess_bind: postprocess::BindGroup,
} }
fn arr_zip_map<const N: usize, A, B, C>(a: [A; N], b: [B; N], f: impl Fn(A, B) -> C) -> [C; N] {
let mut b = b.into_iter();
a.map(|a| f(a, b.next().unwrap()))
}
impl Locals { impl Locals {
pub(super) fn new( pub(super) fn new(
device: &wgpu::Device, device: &wgpu::Device,
@ -58,10 +63,9 @@ impl Locals {
); );
let bloom_binds = bloom.map(|bloom| { let bloom_binds = bloom.map(|bloom| {
bloom arr_zip_map(bloom.src_views, bloom.locals, |view, locals| {
.src_views layouts.bloom.bind(device, view, sampler, locals)
.zip(bloom.locals) // zip arrays })
.map(|(view, locals)| layouts.bloom.bind(device, view, sampler, locals))
}); });
Self { Self {
@ -107,10 +111,9 @@ impl Locals {
&self.postprocess, &self.postprocess,
); );
self.bloom_binds = bloom.map(|bloom| { self.bloom_binds = bloom.map(|bloom| {
bloom arr_zip_map(bloom.src_views, bloom.locals, |view, locals| {
.src_views layouts.bloom.bind(device, view, sampler, locals)
.zip(bloom.locals) // zip arrays })
.map(|(view, locals)| layouts.bloom.bind(device, view, sampler, locals))
}); });
} }
} }

View File

@ -648,7 +648,7 @@ impl FigureMgr {
} }
let dt = ecs.fetch::<DeltaTime>().0; let dt = ecs.fetch::<DeltaTime>().0;
let updater = ecs.read_resource::<LazyUpdate>(); let updater = ecs.read_resource::<LazyUpdate>();
for (entity, light_emitter_opt, interpolated, pos, body, mut light_anim) in ( for (entity, light_emitter_opt, interpolated, pos, body, light_anim) in (
&ecs.entities(), &ecs.entities(),
ecs.read_storage::<LightEmitter>().maybe(), ecs.read_storage::<LightEmitter>().maybe(),
ecs.read_storage::<Interpolated>().maybe(), ecs.read_storage::<Interpolated>().maybe(),

View File

@ -250,7 +250,7 @@ pub fn clip_object_by_plane<T: Float + MulAdd<T, T, Output = T> + core::fmt::Deb
tolerance: T, tolerance: T,
) { ) {
let mut intersection_points = Vec::new(); let mut intersection_points = Vec::new();
polys.drain_filter(|points| { polys.retain_mut(|points| {
let len = intersection_points.len(); let len = intersection_points.len();
let outside_first = clip_points_by_plane(points, plane, &mut intersection_points); let outside_first = clip_points_by_plane(points, plane, &mut intersection_points);
// Only remember intersections that are not coplanar with this side; i.e. those // Only remember intersections that are not coplanar with this side; i.e. those
@ -273,7 +273,7 @@ pub fn clip_object_by_plane<T: Float + MulAdd<T, T, Output = T> + core::fmt::Deb
intersection_points.swap(len, len + 1); intersection_points.swap(len, len + 1);
} }
// Remove polygon if it was clipped away // Remove polygon if it was clipped away
points.is_empty() !points.is_empty()
}); });
// Add a polygon of all intersection points with the plane to close out the // Add a polygon of all intersection points with the plane to close out the
// object. // object.

View File

@ -763,9 +763,9 @@ impl Scene {
renderer.update_consts(&mut self.data.lights, lights); renderer.update_consts(&mut self.data.lights, lights);
// Update event lights // Update event lights
self.event_lights.drain_filter(|el| { self.event_lights.retain_mut(|el| {
el.timeout -= dt; el.timeout -= dt;
el.timeout <= 0.0 el.timeout > 0.0
}); });
// Update shadow constants // Update shadow constants

View File

@ -216,7 +216,7 @@ settings_change_from!(Accessibility);
impl SettingsChange { impl SettingsChange {
pub fn process(self, global_state: &mut GlobalState, session_state: &mut SessionState) { pub fn process(self, global_state: &mut GlobalState, session_state: &mut SessionState) {
let mut settings = &mut global_state.settings; let settings = &mut global_state.settings;
match self { match self {
SettingsChange::Audio(audio_change) => { SettingsChange::Audio(audio_change) => {
@ -366,7 +366,7 @@ impl SettingsChange {
}, },
SettingsChange::Gamepad(gamepad_change) => match gamepad_change {}, SettingsChange::Gamepad(gamepad_change) => match gamepad_change {},
SettingsChange::Gameplay(gameplay_change) => { SettingsChange::Gameplay(gameplay_change) => {
let mut window = &mut global_state.window; let window = &mut global_state.window;
match gameplay_change { match gameplay_change {
Gameplay::AdjustMousePan(sensitivity) => { Gameplay::AdjustMousePan(sensitivity) => {
window.pan_sensitivity = sensitivity; window.pan_sensitivity = sensitivity;

View File

@ -34,7 +34,7 @@ tracing = { workspace = true }
rand = { workspace = true } rand = { workspace = true }
rand_chacha = { workspace = true } rand_chacha = { workspace = true }
arr_macro = "0.2.1" arr_macro = "0.2.1"
packed_simd = { package = "packed_simd_2", version = "0.3.8", optional = true } packed_simd = { version = "0.3.9", optional = true }
rayon = { workspace = true } rayon = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
ron = { workspace = true } ron = { workspace = true }

View File

@ -741,7 +741,7 @@ impl Civs {
1 << ((to_next_idx as u8 + 4) % 8); 1 << ((to_next_idx as u8 + 4) % 8);
} }
for loc in path.iter() { for loc in path.iter() {
let mut chunk = ctx.sim.get_mut(loc.0).unwrap(); let chunk = ctx.sim.get_mut(loc.0).unwrap();
let depth = loc.1 * 250.0 - 20.0; let depth = loc.1 * 250.0 - 20.0;
chunk.cave.1.alt = chunk.cave.1.alt =
chunk.alt - depth + ctx.rng.gen_range(-4.0..4.0) * (depth > 10.0) as i32 as f32; chunk.alt - depth + ctx.rng.gen_range(-4.0..4.0) * (depth > 10.0) as i32 as f32;
@ -1408,7 +1408,7 @@ impl Civs {
(1 << (to_prev_idx as u8)) | (1 << (to_next_idx as u8)); (1 << (to_prev_idx as u8)) | (1 << (to_next_idx as u8));
*/ */
if randomize_offset { if randomize_offset {
let mut chunk = ctx.sim.get_mut(locs[1]).unwrap(); let chunk = ctx.sim.get_mut(locs[1]).unwrap();
chunk.path.0.offset = chunk.path.0.offset =
Vec2::new(ctx.rng.gen_range(-16..17), ctx.rng.gen_range(-16..17)); Vec2::new(ctx.rng.gen_range(-16..17), ctx.rng.gen_range(-16..17));
} }

View File

@ -322,7 +322,7 @@ pub fn get_rivers<F: fmt::Debug + Float + Into<f64>, G: Float + Into<f64>>(
let pass_idx = (-indirection_idx) as usize; let pass_idx = (-indirection_idx) as usize;
// NOTE: Must exist since this lake had a downhill in the first place. // NOTE: Must exist since this lake had a downhill in the first place.
let neighbor_pass_idx = downhill[pass_idx] as usize/*downhill_idx*/; let neighbor_pass_idx = downhill[pass_idx] as usize/*downhill_idx*/;
let mut lake_neighbor_pass = &mut rivers[neighbor_pass_idx]; let lake_neighbor_pass = &mut rivers[neighbor_pass_idx];
// We definitely shouldn't have encountered this yet! // We definitely shouldn't have encountered this yet!
debug_assert!(lake_neighbor_pass.velocity == Vec3::zero()); debug_assert!(lake_neighbor_pass.velocity == Vec3::zero());
// TODO: Rethink making the lake neighbor pass always a river or lake, no matter // TODO: Rethink making the lake neighbor pass always a river or lake, no matter
@ -388,7 +388,7 @@ pub fn get_rivers<F: fmt::Debug + Float + Into<f64>, G: Float + Into<f64>>(
river_spline_derivative, river_spline_derivative,
) )
}; };
let mut lake = &mut rivers[chunk_idx]; let lake = &mut rivers[chunk_idx];
lake.spline_derivative = river_spline_derivative; lake.spline_derivative = river_spline_derivative;
lake.river_kind = Some(RiverKind::Lake { lake.river_kind = Some(RiverKind::Lake {
neighbor_pass_pos: neighbor_pass_pos neighbor_pass_pos: neighbor_pass_pos
@ -495,7 +495,7 @@ pub fn get_rivers<F: fmt::Debug + Float + Into<f64>, G: Float + Into<f64>>(
// CONFIG.river_min_height. // CONFIG.river_min_height.
let river = &rivers[chunk_idx]; let river = &rivers[chunk_idx];
let is_river = river.is_river() || width >= 0.5 && height >= CONFIG.river_min_height as f64; let is_river = river.is_river() || width >= 0.5 && height >= CONFIG.river_min_height as f64;
let mut downhill_river = &mut rivers[downhill_idx]; let downhill_river = &mut rivers[downhill_idx];
if is_river { if is_river {
// Provisionally make the downhill chunk a river as well. // Provisionally make the downhill chunk a river as well.
@ -532,7 +532,7 @@ pub fn get_rivers<F: fmt::Debug + Float + Into<f64>, G: Float + Into<f64>>(
velocity.normalize(); velocity.normalize();
velocity *= velocity_magnitude; velocity *= velocity_magnitude;
let mut river = &mut rivers[chunk_idx]; let river = &mut rivers[chunk_idx];
// NOTE: Not trying to do this more cleverly because we want to keep the river's // NOTE: Not trying to do this more cleverly because we want to keep the river's
// neighbors. TODO: Actually put something in the neighbors. // neighbors. TODO: Actually put something in the neighbors.
river.velocity = velocity.map(|e| e as f32); river.velocity = velocity.map(|e| e as f32);