Skip to content

Commit 068b3df

Browse files
committed
Moved compile-fail tests to ui tests.
1 parent 7293c3f commit 068b3df

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`.
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`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0583]: file not found for module `module_that_doesnt_exist`
2+
--> $DIR/E0583.rs:11:5
3+
|
4+
LL | mod module_that_doesnt_exist; //~ ERROR E0583
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: name the file either module_that_doesnt_exist.rs or module_that_doesnt_exist/mod.rs inside the directory "$DIR"
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0583`.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0594]: cannot assign to immutable static item `NUM`
2+
--> $DIR/E0594.rs:17:5
3+
|
4+
LL | NUM = 20; //[ast]~ ERROR E0594
5+
| ^^^^^^^^ cannot assign
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0594`.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0594]: cannot assign to immutable static item
2+
--> $DIR/E0594.rs:17:5
3+
|
4+
LL | NUM = 20; //[ast]~ ERROR E0594
5+
| ^^^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0594`.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0594]: cannot assign to immutable static item `NUM`
2+
--> $DIR/E0594.rs:17:5
3+
|
4+
LL | NUM = 20; //[ast]~ ERROR E0594
5+
| ^^^^^^^^ cannot assign
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0594`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
2+
--> $DIR/E0596.rs:16:13
3+
|
4+
LL | let x = 1;
5+
| - help: consider changing this to be mutable: `mut x`
6+
LL | let y = &mut x; //[ast]~ ERROR [E0596]
7+
| ^^^^^^ cannot borrow as mutable
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0596`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0596]: cannot borrow immutable local variable `x` as mutable
2+
--> $DIR/E0596.rs:16:18
3+
|
4+
LL | let x = 1;
5+
| - consider changing this to `mut x`
6+
LL | let y = &mut x; //[ast]~ ERROR [E0596]
7+
| ^ cannot borrow mutably
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0596`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
2+
--> $DIR/E0596.rs:16:13
3+
|
4+
LL | let x = 1;
5+
| - help: consider changing this to be mutable: `mut x`
6+
LL | let y = &mut x; //[ast]~ ERROR [E0596]
7+
| ^^^^^^ cannot borrow as mutable
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0596`.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0433]: failed to resolve. crate root in paths can only be used in start position
2+
--> $DIR/absolute-paths-in-nested-use-groups.rs:16:5
3+
|
4+
LL | ::bar, //~ ERROR crate root in paths can only be used in start position
5+
| ^ crate root in paths can only be used in start position
6+
7+
error[E0433]: failed to resolve. `super` in paths can only be used in start position
8+
--> $DIR/absolute-paths-in-nested-use-groups.rs:17:5
9+
|
10+
LL | super::bar, //~ ERROR `super` in paths can only be used in start position
11+
| ^^^^^ `super` in paths can only be used in start position
12+
13+
error[E0433]: failed to resolve. `self` in paths can only be used in start position
14+
--> $DIR/absolute-paths-in-nested-use-groups.rs:18:5
15+
|
16+
LL | self::bar, //~ ERROR `self` in paths can only be used in start position
17+
| ^^^^ `self` in paths can only be used in start position
18+
19+
error: aborting due to 3 previous errors
20+
21+
For more information about this error, try `rustc --explain E0433`.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0507]: cannot move out of borrowed content
2+
--> $DIR/access-mode-in-closures.rs:19:15
3+
|
4+
LL | match *s { sty(v) => v } //~ ERROR cannot move out
5+
| ^^ - move occurs because v has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait
6+
| |
7+
| cannot move out of borrowed content
8+
| help: consider removing this dereference operator: `s`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0507`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0507]: cannot move out of borrowed content
2+
--> $DIR/access-mode-in-closures.rs:19:15
3+
|
4+
LL | match *s { sty(v) => v } //~ ERROR cannot move out
5+
| ^^ - hint: to prevent move, use `ref v` or `ref mut v`
6+
| |
7+
| cannot move out of borrowed content
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0507`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: return type should be `!`
2+
--> $DIR/alloc-error-handler-bad-signature-1.rs:22:6
3+
|
4+
LL | ) -> () //~ ERROR return type should be `!`
5+
| ^^
6+
7+
error: argument should be `Layout`
8+
--> $DIR/alloc-error-handler-bad-signature-1.rs:21:11
9+
|
10+
LL | info: &Layout, //~ ERROR argument should be `Layout`
11+
| ^^^^^^^
12+
13+
error: aborting due to 2 previous errors
14+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: return type should be `!`
2+
--> $DIR/alloc-error-handler-bad-signature-2.rs:22:3
3+
|
4+
LL | ) { //~ ERROR return type should be `!`
5+
| ^
6+
7+
error: argument should be `Layout`
8+
--> $DIR/alloc-error-handler-bad-signature-2.rs:21:11
9+
|
10+
LL | info: Layout, //~ ERROR argument should be `Layout`
11+
| ^^^^^^
12+
13+
error: aborting due to 2 previous errors
14+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: function should have one argument
2+
--> $DIR/alloc-error-handler-bad-signature-3.rs:20:1
3+
|
4+
LL | / fn oom() -> ! { //~ ERROR function should have one argument
5+
LL | | loop {}
6+
LL | | }
7+
| |_^
8+
9+
error: aborting due to previous error
10+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: allocators must be statics
2+
--> $DIR/function-allocator.rs:13:1
3+
|
4+
LL | fn foo() {} //~ ERROR: allocators must be statics
5+
| ^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied
2+
--> $DIR/not-an-allocator.rs:12:1
3+
|
4+
LL | static A: usize = 0;
5+
| ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
6+
|
7+
= note: required by `std::alloc::GlobalAlloc::alloc`
8+
9+
error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied
10+
--> $DIR/not-an-allocator.rs:12:1
11+
|
12+
LL | static A: usize = 0;
13+
| ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
14+
|
15+
= note: required by `std::alloc::GlobalAlloc::dealloc`
16+
17+
error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied
18+
--> $DIR/not-an-allocator.rs:12:1
19+
|
20+
LL | static A: usize = 0;
21+
| ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
22+
|
23+
= note: required by `std::alloc::GlobalAlloc::realloc`
24+
25+
error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied
26+
--> $DIR/not-an-allocator.rs:12:1
27+
|
28+
LL | static A: usize = 0;
29+
| ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
30+
|
31+
= note: required by `std::alloc::GlobalAlloc::alloc_zeroed`
32+
33+
error: aborting due to 4 previous errors
34+
35+
For more information about this error, try `rustc --explain E0277`.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: cannot define more than one #[global_allocator]
2+
--> $DIR/two-allocators.rs:16:1
3+
|
4+
LL | static B: System = System;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
error: the #[global_allocator] in this crate conflicts with global allocator in: system_allocator
2+
3+
error: aborting due to previous error
4+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
error: the #[global_allocator] in system_allocator conflicts with this global allocator in: system_allocator2
2+
3+
error: aborting due to previous error
4+

0 commit comments

Comments
 (0)