Skip to content

Commit 8bbf042

Browse files
committed
Added test for #49824.
1 parent 43e6e2e commit 8bbf042

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

src/test/ui/issue-49824.nll.stderr

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+

src/test/ui/issue-49824.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
}

src/test/ui/issue-49824.stderr

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+

0 commit comments

Comments
 (0)