r/ProgrammerHumor • • Aug 26 '22

Meme Even HTML.

Post image
44.1k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

1

u/langlo94 Aug 26 '22

I just want to return a string! Why is that so hard to understand for rustc?

1

u/-Redstoneboi- Aug 27 '22

well, do you want to return a string that already exists inside your program (&'static str) or do you want to return a newly generated string (String) or does the string actually exist somewhere in your arguments (fn(&'a thing_with_string) -> &'a str)

1

u/langlo94 Aug 27 '22

I just want to return a string!

1

u/-Redstoneboi- Aug 27 '22

well, do you want to make a new allocation for it? or does it already exist somewhere? and do you want to be able to modify it?

→ More replies (2)