Speykious / cve-rs

Blazingly 🔥 fast 🚀 memory vulnerabilities, written in 100% safe Rust. 🦀
Other
3.72k stars 94 forks source link

The ultimate safety #30

Open turalcar opened 4 months ago

turalcar commented 4 months ago

There is a way to make this truly safe (I won't spoil this for you)

fn translate<'a, T>(_: &'static &'a (), x: &'a T) -> &'static T {
    x
}

trait Witness<'a> {
    fn extend<T>(self, x: &'a T) -> &'static T;
}

impl<'a> Witness<'a> for &'static () {
    fn extend<T>(self, x: &'a T) -> &'static T {
        translate(&self, x)
    }
}
TruncatedDinoSour commented 4 months ago
impl 'fn static::<'abcdefghijklmnopqrstuvwxyz>{ {{}{ trait for &T!fn&' ( ), ->!'''static TP L{ s>!<p'Witness<for &aa'a'a'b'a'L>{
    x
}

rust as its finest

TgZ39 commented 4 months ago
impl 'fn static::<'abcdefghijklmnopqrstuvwxyz>{ {{}{ trait for &T!fn&' ( ), ->!'''static TP L{ s>!<p'Witness<for &aa'a'a'b'a'L>{
    x
}

rust as its finest

Is that valid syntax?

TgZ39 commented 4 months ago

🚀

TruncatedDinoSour commented 4 months ago
impl 'fn static::<'abcdefghijklmnopqrstuvwxyz>{ {{}{ trait for &T!fn&' ( ), ->!'''static TP L{ s>!<p'Witness<for &aa'a'a'b'a'L>{
    x
}

rust as its finest

Is that valid syntax?

if ur srs : no, its satire, highlighting rusts truly 'beautiful' syntax if not : yes ofc it is

InfinitePower563 commented 4 months ago

ahh yes my favorite lifetime specifier: abcdefghijklmnopqrstuvwxyz

TruncatedDinoSour commented 4 months ago

ahh yes my favorite lifetime specifier: abcdefghijklmnopqrstuvwxyz

yeah it means 'until rust language is good, be alive' ( dead lifetime )