Skip to content

Omitting an lifetime name in the return value of an function should be always forbidden. #9466

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

Closed
Kimundi opened this issue Sep 24, 2013 · 1 comment

Comments

@Kimundi
Copy link
Member

Kimundi commented Sep 24, 2013

Right now any function signature of the form

fn foo(...) -> &Bar

is valid, but only if the thing returned has the static lifetime.

I think it would be less confusing if we would just always forbid that, requiring to write out the 'static explicitly in those cases:

fn foo(...) -> &'static Bar
@bluss
Copy link
Member

bluss commented Sep 24, 2013

dup of #2478

djkoloski pushed a commit to djkoloski/rust that referenced this issue Sep 21, 2022
Don't lint `large_stack_array` inside static items

We now check if the linted `Expr` is inside an `ItemKind::Static`, which can't take the suggested `Box<[...]`. I _think_ this is the correct fix for rust-lang#9460

I removed `if_chain` while I was at it.

changelog: Don't lint `large_stack_array` inside static items
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

3 participants