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

Disallow return types of &'static foo from being written as &foo #8309

Closed
bstrie opened this issue Aug 5, 2013 · 5 comments
Closed

Disallow return types of &'static foo from being written as &foo #8309

bstrie opened this issue Aug 5, 2013 · 5 comments

Comments

@bstrie
Copy link
Contributor

bstrie commented Aug 5, 2013

As far as I can tell, when &str appears as the return type of a function, this silently implies &'static str. I think this holds for all other types as well, not just str. I propose that we force people to be explicit here, since our general rule is that any borrowed pointer that is returned from a function must have an explicit lifetime.

@bluss
Copy link
Member

bluss commented Aug 5, 2013

The buglet in pull #8308 was found while discussing this issue

@bstrie
Copy link
Contributor Author

bstrie commented Aug 5, 2013

Nominating for Well-Defined.

@nikomatsakis
Copy link
Contributor

I think &str should be the same as returning any other borrowed pointer? If it's not, that's a bug, but otherwise this seems like a dup of #2478.

@bluss
Copy link
Member

bluss commented Aug 29, 2013

It's a duplicate.

@catamorphism
Copy link
Contributor

Closing as dup

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