File tree 3 files changed +60
-0
lines changed
3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ error: unsatisfied lifetime constraints
2
+ --> $DIR/issue-49824.rs:22:9
3
+ |
4
+ LL | || {
5
+ | _____-
6
+ | |_____|
7
+ | ||
8
+ LL | || || {
9
+ | ||_________^
10
+ LL | ||| let _y = &mut x;
11
+ LL | ||| }
12
+ | |||_________^ requires that `'1` must outlive `'2`
13
+ LL | || };
14
+ | || -
15
+ | ||_____|
16
+ | |______lifetime `'1` represents the closure body
17
+ | lifetime `'2` appears in return type
18
+
19
+ error: aborting due to previous error
20
+
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ #![ feature( rustc_attrs) ]
12
+
13
+ // This test checks that a failure occurs with NLL but does not fail with the
14
+ // legacy AST output. Check issue-49824.nll.stderr for expected compilation error
15
+ // output under NLL and #49824 for more information.
16
+
17
+ #[ rustc_error]
18
+ fn main ( ) {
19
+ //~^ compilation successful
20
+ let mut x = 0 ;
21
+ || {
22
+ || {
23
+ let _y = & mut x;
24
+ }
25
+ } ;
26
+ }
Original file line number Diff line number Diff line change
1
+ error: compilation successful
2
+ --> $DIR/issue-49824.rs:18:1
3
+ |
4
+ LL | / fn main() {
5
+ LL | | //~^ compilation successful
6
+ LL | | let mut x = 0;
7
+ LL | | || {
8
+ ... |
9
+ LL | | };
10
+ LL | | }
11
+ | |_^
12
+
13
+ error: aborting due to previous error
14
+
You can’t perform that action at this time.
0 commit comments