Skip to content
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

The ultimate safety #30

Open
turalcar opened this issue Feb 28, 2024 · 6 comments
Open

The ultimate safety #30

turalcar opened this issue Feb 28, 2024 · 6 comments

Comments

@turalcar
Copy link

turalcar commented Feb 28, 2024

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
Copy link

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
Copy link

TgZ39 commented Feb 29, 2024

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
Copy link

TgZ39 commented Feb 29, 2024

🚀

@TruncatedDinoSour
Copy link

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

@theavgeekbee
Copy link

ahh yes my favorite lifetime specifier: abcdefghijklmnopqrstuvwxyz

@TruncatedDinoSour
Copy link

ahh yes my favorite lifetime specifier: abcdefghijklmnopqrstuvwxyz

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants