Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
alexchamberlain
on Oct 14, 2023
|
parent
|
context
|
favorite
| on:
Escape analysis hates copy elision (2021)
No, the following would be valid (if a little pointless):
fn foo(x: &'a T) -> &'a T { x }
sapiogram
on Oct 14, 2023
[–]
Your example changed the type of the function, though. I'm assuming there is no `&T` in the function's output type.
alexchamberlain
on Oct 14, 2023
|
parent
[–]
Oh sorry; I had misunderstood the question.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
fn foo(x: &'a T) -> &'a T { x }