@Vanilla_Town if you and culturedurbanite were married which one would be the wife and which one would be eaten?
I like to picture Jones as a powerbottom
Hit a compiler bug.
So we have this:
#![feature(adt_const_params)]
#[derive(Debug, Default)]
struct Foo<const F: f32> {}
impl<const F: f32> Foo<F> {
fn foo() -> f32 {
F
}
}
this compiles, and works: Rust Playground
pub fn main() {
const f: f32 = 0.75f32;
println!("{}", Foo::<f>::foo())
}
this does not:
pub fn main() {
println!("{}", Foo::<0.75f32>::foo());
}
???
Probably a formatting problem right
the compiler isn't lowering the floating point literal "0.75f32" to a constant (which it should be considered afaik, this should be able to be evaluated at compile time: Tracking issue for `#![feature(const_fn_floating_point_arithmetic)]` · Issue #57241 · rust-lang/rust · GitHub)
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: Const::from_anon_const: couldn't lit_to_const TypeError
--> src/main.rs:15:26
|
15 | println!("{}", Foo::<0.75f32>::foo());
| ^^^^^^^
|
= note: delayed at compiler/rustc_middle/src/ty/consts.rs:128:30
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1425:13
...
unless I'm missing something about floating point/language semantics.
What are you doing right now? Like, what's the end goal?
The general idea is to have a bloom filter that requires a buffer of M bits dependent on N number of items in the set with P probability of a false positive.
So we have a structure that looks something like:
struct Foo {
uint8_t buf[M]
}
So with metaprogramming, you could define something like Foo{5, .05} or something that is expanded to
struct Foo {
uint8_t buf[A * B]
}
where M ends up being A * B or whatever it is.
In rust, you can use const generics to offload this to the type system, rather than doing it via metaprogramming.
The regular primitives (usize, i8, boolean) are stable, floating point is not.
While amateur programming I have stumbled upon some case where apparently float literals (which should be constants and evaluated at compile-time) are not the same as const f: f32 = float literal within the type system.
looking at this, it seems the exact same thing is being produced assembly wise.
Can't you just write this in hlsl?
i have to spend 6 hours tomorrow weed eating a massive property in 105 degree heat
im not some fat tranny like you subsidized by the state
if im going to do something, it's going to be fun and interesting to me.
sorry bro I'm not a gay ■■■■■■ libtard i actually have to do hard work
There are plenty of those that work hard
the mexicans who vote democrat illegally aren't "libtards" dude sorry
where did you find this guy lmao
this is why I like rust so much: It's a foray into the abyss of highly competent, radicalized tranny libtards and their army of people concerned with "code of conduct" alongside mega-autistic type theory
I've got so much to weed to smoke unless like the libtards
Sorry jones, i didn't mean to grief your thread. I'm sorry.