This website requires JavaScript.
Explore
Help
Register
Sign In
rust-lang
/
rust
Watch
1
Star
0
Fork
0
You've already forked rust
Code
Issues
Pull Requests
Actions
1
Packages
Projects
Releases
Wiki
Activity
Files
51b51b51d7931da85280382a81c4dd80c73ca754
rust
/
tests
/
ui
/
lifetimes
/
unnamed-closure-doesnt-life-long-enough-issue-67634.rs
4 lines
97 B
Rust
Raw
Normal View
History
Unescape
Escape
Do not ICE on lifetime error involving closures
2019-12-28 13:51:29 -08:00
fn
main
(
)
{
Use an 'approximate' universal upper bound when reporting region errors Fixes #67765 When reporting errors during MIR region inference, we sometimes use `universal_upper_bound` to obtain a named universal region that we can display to the user. However, this is not always possible - in a case like `fn foo<'a, 'b>() { .. }`, the only upper bound for a region containing `'a` and `'b` is `'static`. When displaying diagnostics, it's usually better to display *some* named region (even if there are multiple involved) rather than fall back to a generic error involving `'static`. This commit adds a new `approx_universal_upper_bound` method, which uses the lowest-numbered universal region if the only alternative is to return `'static`.
2020-06-27 13:54:56 -04:00
[
0
]
.
iter
(
)
.
flat_map
(
|
a
|
[
0
]
.
iter
(
)
.
map
(
|
_
|
&
a
)
)
;
//~ ERROR closure may outlive
Do not ICE on lifetime error involving closures
2019-12-28 13:51:29 -08:00
}
Reference in New Issue
Copy Permalink