Removed un-checked #[cold] from match arm branches.

Fixed infinite recursition in DynBounds::downcast() (NOTE: it currently just panicks on error because FUCK RangeBounds<T> man...)

Fortune for markov's current commit: Middle blessing − 中吉
master
Avril 3 years ago
parent bfaff6067a
commit 3267151615
Signed by: flanchan
GPG Key ID: 284488987C31F630

807
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
[package]
name = "markov"
version = "0.9.0"
version = "0.9.1"
description = "Generate string of text from Markov chain fed by stdin"
authors = ["Avril <flanchan@cumallover.me>"]
edition = "2018"
@ -49,6 +49,7 @@ instant-init = []
opt-level = 3
lto = "fat"
codegen-units = 1
strip=true
[dependencies]
chain = {package = "markov", version = "1.1.0"}

@ -165,7 +165,7 @@ impl BindError<std::convert::Infallible>
match self {
Self::Warp(w) => BindError::Warp(w),
Self::IO(w) => BindError::IO(w),
#[cold] _ => unreachable!(),
/*#[cold]*/ _ => unreachable!(),
}
}
}

@ -246,7 +246,7 @@ pub async fn host(from: ChainHandle<String>)
tokio::select!{
v = &mut child => {
match v {
#[cold] Ok(_) => {warn!("Child exited before we have? This should probably never happen.")},//Should never happen.
/*#[cold]*/ Ok(_) => {warn!("Child exited before we have? This should probably never happen.")},//Should never happen.
Err(e) => {error!("Child exited abnormally. Aborting: {}", e)}, //Child panic or cancel.
}
},
@ -302,7 +302,7 @@ pub async fn host(from: ChainHandle<String>)
//
// This probably shouldn't happen, as we `select!` for it up there and child never calls `close()` on `rx`.
// In any case, it means we should abort.
#[cold] error!("Failed to send buffer: {}", err);
/*#[cold]*/ error!("Failed to send buffer: {}", err);
break;
}
}

@ -1,5 +1,3 @@
#![feature(split_inclusive)]
#![allow(dead_code)]
#[macro_use] extern crate log;

@ -113,7 +113,11 @@ use std::any::{
impl<T: 'static> DynRange<T>
{
#[inline]
pub fn into_boxed(self) -> Box<dyn Any /*TODO: + Send + Sync */+ 'static>
{
self.into_inner()
}
fn into_inner(self) -> Box<dyn Any + 'static>
{
match self {
@ -157,7 +161,12 @@ impl<T: 'static> DynRange<T>
}
pub fn downcast<R: RangeBounds<T> + 'static>(self) -> Result<R, Self>
{
Box::new(self).downcast()
self.into_inner().downcast::<R>()
.map(|x| *x)
.map_err(|b| {
todo!("make this bullshit properly unboxable ehh...")
})
//Box::<(dyn std::any::Any + 'static)>::downcast(Box::new(self)).map_ok(|ok| *ok)
}
}

@ -28,7 +28,7 @@ pub async fn body(state: State, num: Option<usize>, mut output: mpsc::Sender<Str
output.send(filter.filter_owned(match sanitise::Sentance::new_iter(&string)
.max_by_key(|x| x.len()) {
Some(x) => x,
#[cold] None => return Ok(()),
/*#[cold]*/ None => return Ok(()),
}.to_owned())).await?;
}
Ok(())

Loading…
Cancel
Save