File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
src/tools/clippy/tests/ui/crashes Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 1+ // originally from rustc ./tests/ui/regions/issue-78262.rs
2+ // ICE: to get the signature of a closure, use args.as_closure().sig() not fn_sig()
3+ #![allow(clippy::upper_case_acronyms)]
4+
5+ trait TT {}
6+
7+ impl dyn TT + '_ {
8+ fn func(&self) {}
9+ }
10+
11+ #[rustfmt::skip]
12+ fn main() {
13+ let f = |x: &dyn TT| x.func();
14+ //~^ ERROR: borrowed data escapes outside of closure
15+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ LL | let f = |x: &dyn TT| x.func();
88 | | | argument requires that `'1` must outlive `'static`
99 | | let's call the lifetime of this reference `'1`
1010 | `x` is a reference that is only valid in the closure body
11+ |
12+ help: consider relaxing the implicit `'static` requirement on the impl
13+ |
14+ LL | impl dyn TT + '_ {
15+ | ++++
1116
1217error: aborting due to 1 previous error
1318
You can’t perform that action at this time.
0 commit comments