Skip to content

Commit b16a306

Browse files
committed
Moved compile-fail tests to ui tests.
1 parent fe28bcf commit b16a306

File tree

4,052 files changed

+59249
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,052 files changed

+59249
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
2+
--> $DIR/E0501.rs:28:23
3+
|
4+
LL | let bar = || {
5+
| -- closure construction occurs here
6+
LL | inside_closure(a)
7+
| - first borrow occurs due to use of `a` in closure
8+
LL | };
9+
LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
10+
| ^ borrow occurs here
11+
...
12+
LL | drop(bar);
13+
| --- borrow later used here
14+
15+
error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
16+
--> $DIR/E0501.rs:31:23
17+
|
18+
LL | let bar = || {
19+
| -- closure construction occurs here
20+
LL | inside_closure(a)
21+
| - first borrow occurs due to use of `a` in closure
22+
...
23+
LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
24+
| ^ borrow occurs here
25+
...
26+
LL | drop(bar);
27+
| --- borrow later used here
28+
29+
error: aborting due to 2 previous errors
30+
31+
For more information about this error, try `rustc --explain E0501`.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
2+
--> $DIR/E0501.rs:28:23
3+
|
4+
LL | let bar = || {
5+
| -- closure construction occurs here
6+
LL | inside_closure(a)
7+
| - previous borrow occurs due to use of `a` in closure
8+
LL | };
9+
LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
10+
| ^ borrow occurs here
11+
...
12+
LL | }
13+
| - borrow from closure ends here
14+
15+
error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
16+
--> $DIR/E0501.rs:31:23
17+
|
18+
LL | let bar = || {
19+
| -- closure construction occurs here
20+
LL | inside_closure(a)
21+
| - previous borrow occurs due to use of `a` in closure
22+
...
23+
LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
24+
| ^ borrow occurs here
25+
...
26+
LL | }
27+
| - borrow from closure ends here
28+
29+
error: aborting due to 2 previous errors
30+
31+
For more information about this error, try `rustc --explain E0501`.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
2+
--> $DIR/E0501.rs:28:23
3+
|
4+
LL | let bar = || {
5+
| -- closure construction occurs here
6+
LL | inside_closure(a)
7+
| - first borrow occurs due to use of `a` in closure
8+
LL | };
9+
LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
10+
| ^ borrow occurs here
11+
...
12+
LL | drop(bar);
13+
| --- borrow later used here
14+
15+
error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
16+
--> $DIR/E0501.rs:31:23
17+
|
18+
LL | let bar = || {
19+
| -- closure construction occurs here
20+
LL | inside_closure(a)
21+
| - first borrow occurs due to use of `a` in closure
22+
...
23+
LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
24+
| ^ borrow occurs here
25+
...
26+
LL | drop(bar);
27+
| --- borrow later used here
28+
29+
error: aborting due to 2 previous errors
30+
31+
For more information about this error, try `rustc --explain E0501`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0506]: cannot assign to `fancy_num` because it is borrowed
2+
--> $DIR/E0506.rs:21:5
3+
|
4+
LL | let fancy_ref = &fancy_num;
5+
| ---------- borrow of `fancy_num` occurs here
6+
LL | fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
8+
...
9+
LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
10+
| ------------- borrow later used here
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0506`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0506]: cannot assign to `fancy_num` because it is borrowed
2+
--> $DIR/E0506.rs:21:5
3+
|
4+
LL | let fancy_ref = &fancy_num;
5+
| --------- borrow of `fancy_num` occurs here
6+
LL | fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0506`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0506]: cannot assign to `fancy_num` because it is borrowed
2+
--> $DIR/E0506.rs:21:5
3+
|
4+
LL | let fancy_ref = &fancy_num;
5+
| ---------- borrow of `fancy_num` occurs here
6+
LL | fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
8+
...
9+
LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
10+
| ------------- borrow later used here
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0506`.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
2+
--> $DIR/E0508.rs:18:18
3+
|
4+
LL | let _value = array[0]; //[ast]~ ERROR [E0508]
5+
| ^^^^^^^^
6+
| |
7+
| cannot move out of here
8+
| help: consider using a reference instead: `&array[0]`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0508`.

0 commit comments

Comments
 (0)