-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Regression: rvalue temporary "does not live long enough" #29166
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
Comments
cc @brson |
Hmm I wonder if the iterators involved need to have the escape hatch for dropck added to them. |
Here is a variant (that has also regressed) that does not use the fn main() {
drop((match (Vec::new(), &()) { (mut v, b) => { v.push(b); v } })
.into_iter())
} |
(It looks like Update: Oh, duh, |
Add dropck unsafe escape hatch (UGEH) to vec::IntoIter. Fix #29166
The following code compiles on stable and beta, but not nightly:
For reference, the error produced by the above is:
The original test case was reduced down to the above thanks to eddyb and bluss. The original problematic line was
m.values_of("args").unwrap_or(vec![]).into_iter().map(Into::into).collect()
(clapArgMatches
→Option<Vec<&str>>
→Vec<&str>
→ boom). Specifically, the issue was with the.into_iter()
method, though the error pointed to an earlier temporary as not living long enough.If desired, I can provide a complete, in-context example of this going awry.
bluss suggested that this was related to #29006.
The text was updated successfully, but these errors were encountered: