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

Lifetime of borrowed values should be extended #6721

Closed
lilyball opened this issue May 24, 2013 · 1 comment
Closed

Lifetime of borrowed values should be extended #6721

lilyball opened this issue May 24, 2013 · 1 comment

Comments

@lilyball
Copy link
Contributor

When borrowing an owned value, the lifetime of the value should be extended at least to the end of the current statement, and perhaps extended to the full lifetime of the borrow.

Extending the lifetime to the end of the current statement would allow constructs like the following to work:

foo(vec::from_elem(16, 0).slice(0,4));

Extending the lifetime to the full lifetime of the borrow would just be a bit more convenient for the programmer who doesn't care about having an owned pointer, although it may not be worth the complexity.

@nikomatsakis

@nikomatsakis
Copy link
Contributor

I agree. Dup of #3511.

flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 25, 2021
… r=flip1995

Change unnecessary_wraps to pedantic

changelog: Change unnecessary_wraps to pedantic

There seems to be enough evidence that this lint is not wanted as warn-by-default. Attempted before at rust-lang#6380. False positives at rust-lang#6721 and rust-lang#6427. Actually requested to change the category at rust-lang#6726.

Closes rust-lang#6726
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

2 participants