You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
n owned_iterator(slice: &[~str]) -> ~Iterator<~str> {
~slice.iter().map(|s| s.clone()) as ~Iterator<~str>
}
fn main() {
let mut fail = {
owned_iterator(~["ok".to_owned()])
};
let v = ~["fail".to_owned()];
for i in fail {
println!("{}", i); // prints "fail"
}
let mut segFault = {
owned_iterator(~["ok".to_owned()])
};
let v = ~[-1];
for i in segFault {
println!("{}", i); // Segmentation fault
}
}
The text was updated successfully, but these errors were encountered:
…ang#13929)
Some lifetimes in function return types are not bound to concrete
content and can be set arbitrarily. Clippy should not propose to replace
them by the default `'_` lifetime if such a lifetime cannot be
determined unambigously.
I added a field to the `LifetimeChecker` and `Usage` to flag lifetimes
that cannot be replaced by default ones, but it feels a bit hacky.
Fixrust-lang#13923
changelog: [`needless_lifetimes`]: remove false positives by checking
that lifetimes can indeed be elided
This bug was originally reported on the Rust subreddit by user
double_to_bool_conv
: http://www.reddit.com/r/rust/comments/24kfmv/iterator_can_live_longer_than_its_parent_is_this/The version below has been updated after the removal of the
~"string"
syntax.The text was updated successfully, but these errors were encountered: