-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Unknown issue "Request textDocument/inlayHint failed" #12768
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
Comments
Without the source code where this is happening, there's not much we can do. It might be #12193 if you're using GATs. |
Sorry about that, the source is non-descriptive, and I cannot make it smaller as the issue is not apparent to me. Here's both:
Source: //! During the year, sows that are set to breed, may have died out. But in reality,
//! these would be replaced with other sows that are allowed to breed, though
//! their breeding time will be shifted.
//!
//! Recording / reporting of this: Unfortunately, this complicates a lot of
//! the breeding events and their annotation; A way to figure out if this
//! has had an effect, would be to count the number of sucessful breeding
//! events with and without replacement, and see if it is closer to the nominal
//! level (e.g. [BreedingCapacity])
//!
use super::animal_group_relation::AnimalGroupMap;
use super::scenario_components::ScenarioIteration;
use super::*;
use crate::scenario_components::ScenarioRng;
use crate::weekly_model::breeding::{
age_dependent_selection_weeks, sample_breeding_event, BreedingSow,
};
use crate::wild_boar_components::WildBoar;
use crate::wild_boar_type::marker_age_groups::{Adult, Juvenile};
use crate::wild_boar_type::marker_sex::Female;
use crate::wild_boar_type::marker_vital_status::{Alive, Dead};
use crate::wild_boar_type::Time;
use crate::weekly_model::weekly_wild_boar_model_toolbox::AgeWeeks;
#[allow(unused_imports)]
use bevy_log::prelude::*;
/// Using the 3.3.3 rule, 3 months, 3 weeks and 3 days.
const GESTATION_TIME_IN_WEEKS: Time = 16;
/// Parameter for whether or not to perform replacement breeding of the missed
/// events that were missed due to general mortality.
#[derive(
Debug, Clone, Copy, derive_new::new, derive_more::From, derive_more::Into, Serialize, Component,
)]
pub struct ReplacementBreeding(pub bool);
/// Amends [BreedingSchedule] with replacement events if breeding sows dies
/// out prior to being able to fulfill their duty.
///
/// This should run after mortality, but since it uses the breeding schedule,
/// then it must run after the breeding schedule as well.
///
///
/// This replacement strategy is tied tightly to [crate::weekly_model::breeding]
/// and thus it is advisable to split the breeding-procedure into parts that
/// may be shared with this, so as to maintain cohesion.
///
///
/// Only replace breeding events for sows dying before week 23.
pub fn update_replacement_events(
mut commands: Commands,
mut scenario_rng: ResMut<ScenarioRng>,
mut breeding_schedule: ResMut<BreedingSchedule>,
scenario_week_counter: Res<WeekCounter>,
recently_dead_breeding_sows: Query<
(Entity, &GroupEntity),
(
With<WildBoar>,
Or<(With<Juvenile>, With<Adult>)>,
Added<Dead>,
With<BreedingSow>,
),
>,
// sows that aren't breeding this season
q_sows: Query<
(Entity, &AgeWeeks, &GroupEntity),
(
With<WildBoar>,
With<Female>,
With<Alive>,
Or<(With<Juvenile>, With<Adult>)>,
Without<BreedingSow>,
),
>,
group_map: Res<AnimalGroupMap>,
q_scenarios: Query<&ReplacementBreeding, With<ScenarioIteration>>,
q_groups: Query<(), With<WildBoarGroup>>,
) {
// take note of any deceased animals before week 23
if scenario_week_counter.week > 23 {
//skip weeks after 23
return;
}
// dbg!(scenario_week_counter.week);
let current_week = scenario_week_counter.week;
// determine which breeding events (and in which groups) that need to be replaced.
let replacement_breeding_events: HashMap<GroupEntity, Vec<(GroupEntity, BreedingEvent)>> =
recently_dead_breeding_sows
.iter()
.filter_map(|(animal_entity, group_entity)| {
let dam_group = *group_entity;
// find out if the replacement-breeding is enabled for this particular
// iteration
let scenario_iteration_entity = group_map.get_outgoing_entity(dam_group.into());
let replacement_breeding = q_scenarios.get(scenario_iteration_entity).unwrap();
if !replacement_breeding.0 {
return None;
}
// determine mating date
let mating_date = current_week + scenario_rng.gen_range(1..=4);
if mating_date > 23 {
return None;
}
// new breeding event..
let new_breeding_date = mating_date + GESTATION_TIME_IN_WEEKS;
let new_breeding_event = sample_breeding_event(scenario_rng.as_mut().as_mut());
// remove replacement event where litter-size zero
new_breeding_event.as_ref()?;
let mut new_breeding_event = new_breeding_event.unwrap();
new_breeding_event.week = new_breeding_date as usize;
Some((dam_group, new_breeding_event))
})
// group by groups, as to determine which groups needs to have their
// breeding events replaced; more than one replacement event may be
// necessary for a given group
.into_group_map_by(|(group_entity, _breeding_event)| *group_entity);
// assign this to a sow that isn't currently breeding...
let new_breeding_events: Vec<(GroupEntity, Entity, BreedingEvent)> = q_sows
.iter()
.filter(|(animal_entity, _age_weeks, group_entity)| {
// only select groups that have replacement events queued up
replacement_breeding_events.contains_key(group_entity)
})
// {(group_entity) | set to replacement breed } -> {(animal_entity, age) for females, juvenile>=, not breeding sows}
.into_group_map_by(|(animal_entity, age_weeks, group_entity)| **group_entity)
.iter()
.filter_map(move |(group_entity, eligible_sows)| {
// no replacement sows are available
if eligible_sows.is_empty() {
return None;
}
// select sows that are to execute the replacement events.
let replacement_events = replacement_breeding_events
.get(group_entity)
.unwrap()
.clone();
let replacement_sows = eligible_sows
.choose_multiple_weighted(
scenario_rng.as_mut().as_mut(),
replacement_events.len(),
|(_0, _1, age_weeks)| age_dependent_selection_weeks(age_weeks.0),
)
.unwrap();
// prepare the replacement events
// there are more replacement events than sows that may take over...
Some(replacement_events.into_iter().zip(replacement_sows).map(
|(
(_group_entity, new_breeding_event),
(sow_group_entity, sow_entity, _sow_age_weeks),
)| { (**sow_group_entity, *sow_entity, new_breeding_event) },
))
})
.flatten()
.collect();
if !new_breeding_events.is_empty() {
// the new sows that are (now) breeding, needs to be added to the record of
// breeding sows.
new_breeding_events.iter().for_each(|(_0, sow_entity, _2)| {
commands.entity(sow_entity).insert(BreedingSow);
});
// dbg!(new_breeding_events.len());
// Add replacement events to the breeding schedule!
breeding_schedule.push_breeding_events(new_breeding_events);
}
} |
Might indeed be #12674. I think it's unrelated to proc macros. |
Is that part of the new release? |
No, it'll be released next Monday. It would be appreciated if you could build rust-analyzer locally and test it, but waiting for next release is perfectly fine. |
A new nightly will be available tomorrow. |
Thanks. I'll test it tomorrow and let you know.
…On Mon, 12 Sep 2022, 20.57 Laurențiu Nicola, ***@***.***> wrote:
A new nightly will be available tomorrow.
—
Reply to this email directly, view it on GitHub
<#12768 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIDVSBYYZ74LHFTOUV5VZ3V554I3ANCNFSM53U26E7A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm getting this issue constantly and it is relentless.
I've tried to use release and prelease versions of R-A with no success.
UPDATED: See the updated code error message + code below.
rust-analyzer version: rust-analyzer version: 0.0.0 (5342f47 2022-07-09)
rustc version: rustc 1.62.0 (a8314ef7d 2022-06-27)
relevant settings: UPDATE: I tried to reset all of vscode's settings (including R-As).
This issue is only caused by this fail and it is a huge headache...
The text was updated successfully, but these errors were encountered: