Skip to content

Commit

Permalink
Auto merge of #53196 - davidtwco:compile-fail-to-ui, r=nikomatsakis
Browse files Browse the repository at this point in the history
Move `compile-fail` tests to `ui`

Fixes #46841, #52531, #44844.

r? @nikomatsakis
  • Loading branch information
bors committed Aug 14, 2018
2 parents d67ba90 + 7b02656 commit f45f525
Show file tree
Hide file tree
Showing 6,539 changed files with 59,549 additions and 77 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
16 changes: 12 additions & 4 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}

fn report_similar_impl_candidates(&self,
impl_candidates: Vec<ty::TraitRef<'tcx>>,
mut impl_candidates: Vec<ty::TraitRef<'tcx>>,
err: &mut DiagnosticBuilder)
{
if impl_candidates.is_empty() {
return;
}

let len = impl_candidates.len();
let end = if impl_candidates.len() <= 5 {
impl_candidates.len()
} else {
Expand All @@ -459,10 +460,17 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
});

// Sort impl candidates so that ordering is consistent for UI tests.
let normalized_impl_candidates = &mut impl_candidates[0..end]
.iter()
.map(normalize)
.collect::<Vec<String>>();
normalized_impl_candidates.sort();

err.help(&format!("the following implementations were found:{}{}",
&impl_candidates[0..end].iter().map(normalize).collect::<String>(),
if impl_candidates.len() > 5 {
format!("\nand {} others", impl_candidates.len() - 4)
normalized_impl_candidates.join(""),
if len > 5 {
format!("\nand {} others", len - 4)
} else {
"".to_owned()
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/meta-expected-error-wrong-rev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-compare-mode-nll

// revisions: a
// should-fail

Expand Down
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions src/test/ui/E0501.ast.nll.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
--> $DIR/E0501.rs:28:23
|
LL | let bar = || {
| -- closure construction occurs here
LL | inside_closure(a)
| - first borrow occurs due to use of `a` in closure
LL | };
LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
| ^ borrow occurs here
...
LL | drop(bar);
| --- borrow later used here

error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
--> $DIR/E0501.rs:31:23
|
LL | let bar = || {
| -- closure construction occurs here
LL | inside_closure(a)
| - first borrow occurs due to use of `a` in closure
...
LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
| ^ borrow occurs here
...
LL | drop(bar);
| --- borrow later used here

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0501`.
31 changes: 31 additions & 0 deletions src/test/ui/E0501.ast.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
--> $DIR/E0501.rs:28:23
|
LL | let bar = || {
| -- closure construction occurs here
LL | inside_closure(a)
| - previous borrow occurs due to use of `a` in closure
LL | };
LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
| ^ borrow occurs here
...
LL | }
| - borrow from closure ends here

error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
--> $DIR/E0501.rs:31:23
|
LL | let bar = || {
| -- closure construction occurs here
LL | inside_closure(a)
| - previous borrow occurs due to use of `a` in closure
...
LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
| ^ borrow occurs here
...
LL | }
| - borrow from closure ends here

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0501`.
31 changes: 31 additions & 0 deletions src/test/ui/E0501.mir.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
--> $DIR/E0501.rs:28:23
|
LL | let bar = || {
| -- closure construction occurs here
LL | inside_closure(a)
| - first borrow occurs due to use of `a` in closure
LL | };
LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
| ^ borrow occurs here
...
LL | drop(bar);
| --- borrow later used here

error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
--> $DIR/E0501.rs:31:23
|
LL | let bar = || {
| -- closure construction occurs here
LL | inside_closure(a)
| - first borrow occurs due to use of `a` in closure
...
LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
| ^ borrow occurs here
...
LL | drop(bar);
| --- borrow later used here

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0501`.
File renamed without changes.
14 changes: 14 additions & 0 deletions src/test/ui/E0506.ast.nll.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error[E0506]: cannot assign to `fancy_num` because it is borrowed
--> $DIR/E0506.rs:21:5
|
LL | let fancy_ref = &fancy_num;
| ---------- borrow of `fancy_num` occurs here
LL | fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
...
LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
| ------------- borrow later used here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0506`.
11 changes: 11 additions & 0 deletions src/test/ui/E0506.ast.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0506]: cannot assign to `fancy_num` because it is borrowed
--> $DIR/E0506.rs:21:5
|
LL | let fancy_ref = &fancy_num;
| --------- borrow of `fancy_num` occurs here
LL | fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0506`.
14 changes: 14 additions & 0 deletions src/test/ui/E0506.mir.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error[E0506]: cannot assign to `fancy_num` because it is borrowed
--> $DIR/E0506.rs:21:5
|
LL | let fancy_ref = &fancy_num;
| ---------- borrow of `fancy_num` occurs here
LL | fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
...
LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
| ------------- borrow later used here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0506`.
File renamed without changes.
12 changes: 12 additions & 0 deletions src/test/ui/E0508-fail.ast.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
--> $DIR/E0508-fail.rs:18:18
|
LL | let _value = array[0]; //[ast]~ ERROR [E0508]
| ^^^^^^^^
| |
| cannot move out of here
| help: consider using a reference instead: `&array[0]`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0508`.
12 changes: 12 additions & 0 deletions src/test/ui/E0508-fail.mir.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
--> $DIR/E0508-fail.rs:18:18
|
LL | let _value = array[0]; //[ast]~ ERROR [E0508]
| ^^^^^^^^
| |
| cannot move out of here
| help: consider using a reference instead: `&array[0]`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0508`.
File renamed without changes.
12 changes: 12 additions & 0 deletions src/test/ui/E0508.ast.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
--> $DIR/E0508.rs:18:18
|
LL | let _value = array[0]; //[ast]~ ERROR [E0508]
| ^^^^^^^^
| |
| cannot move out of here
| help: consider using a reference instead: `&array[0]`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0508`.
12 changes: 12 additions & 0 deletions src/test/ui/E0508.mir.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
--> $DIR/E0508.rs:18:18
|
LL | let _value = array[0]; //[ast]~ ERROR [E0508]
| ^^^^^^^^
| |
| cannot move out of here
| help: consider using a reference instead: `&array[0]`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0508`.
File renamed without changes.
11 changes: 11 additions & 0 deletions src/test/ui/E0583.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0583]: file not found for module `module_that_doesnt_exist`
--> $DIR/E0583.rs:11:5
|
LL | mod module_that_doesnt_exist; //~ ERROR E0583
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: name the file either module_that_doesnt_exist.rs or module_that_doesnt_exist/mod.rs inside the directory "$DIR"

error: aborting due to previous error

For more information about this error, try `rustc --explain E0583`.
9 changes: 9 additions & 0 deletions src/test/ui/E0594.ast.nll.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0594]: cannot assign to immutable static item `NUM`
--> $DIR/E0594.rs:17:5
|
LL | NUM = 20; //[ast]~ ERROR E0594
| ^^^^^^^^ cannot assign

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
9 changes: 9 additions & 0 deletions src/test/ui/E0594.ast.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0594]: cannot assign to immutable static item
--> $DIR/E0594.rs:17:5
|
LL | NUM = 20; //[ast]~ ERROR E0594
| ^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
9 changes: 9 additions & 0 deletions src/test/ui/E0594.mir.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0594]: cannot assign to immutable static item `NUM`
--> $DIR/E0594.rs:17:5
|
LL | NUM = 20; //[ast]~ ERROR E0594
| ^^^^^^^^ cannot assign

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
File renamed without changes.
11 changes: 11 additions & 0 deletions src/test/ui/E0596.ast.nll.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/E0596.rs:16:13
|
LL | let x = 1;
| - help: consider changing this to be mutable: `mut x`
LL | let y = &mut x; //[ast]~ ERROR [E0596]
| ^^^^^^ cannot borrow as mutable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0596`.
11 changes: 11 additions & 0 deletions src/test/ui/E0596.ast.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0596]: cannot borrow immutable local variable `x` as mutable
--> $DIR/E0596.rs:16:18
|
LL | let x = 1;
| - consider changing this to `mut x`
LL | let y = &mut x; //[ast]~ ERROR [E0596]
| ^ cannot borrow mutably

error: aborting due to previous error

For more information about this error, try `rustc --explain E0596`.
11 changes: 11 additions & 0 deletions src/test/ui/E0596.mir.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/E0596.rs:16:13
|
LL | let x = 1;
| - help: consider changing this to be mutable: `mut x`
LL | let y = &mut x; //[ast]~ ERROR [E0596]
| ^^^^^^ cannot borrow as mutable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0596`.
File renamed without changes.
21 changes: 21 additions & 0 deletions src/test/ui/absolute-paths-in-nested-use-groups.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error[E0433]: failed to resolve. crate root in paths can only be used in start position
--> $DIR/absolute-paths-in-nested-use-groups.rs:16:5
|
LL | ::bar, //~ ERROR crate root in paths can only be used in start position
| ^ crate root in paths can only be used in start position

error[E0433]: failed to resolve. `super` in paths can only be used in start position
--> $DIR/absolute-paths-in-nested-use-groups.rs:17:5
|
LL | super::bar, //~ ERROR `super` in paths can only be used in start position
| ^^^^^ `super` in paths can only be used in start position

error[E0433]: failed to resolve. `self` in paths can only be used in start position
--> $DIR/absolute-paths-in-nested-use-groups.rs:18:5
|
LL | self::bar, //~ ERROR `self` in paths can only be used in start position
| ^^^^ `self` in paths can only be used in start position

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0433`.
12 changes: 12 additions & 0 deletions src/test/ui/access-mode-in-closures.nll.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0507]: cannot move out of borrowed content
--> $DIR/access-mode-in-closures.rs:19:15
|
LL | match *s { sty(v) => v } //~ ERROR cannot move out
| ^^ - move occurs because v has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait
| |
| cannot move out of borrowed content
| help: consider removing this dereference operator: `s`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0507`.
File renamed without changes.
11 changes: 11 additions & 0 deletions src/test/ui/access-mode-in-closures.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0507]: cannot move out of borrowed content
--> $DIR/access-mode-in-closures.rs:19:15
|
LL | match *s { sty(v) => v } //~ ERROR cannot move out
| ^^ - hint: to prevent move, use `ref v` or `ref mut v`
| |
| cannot move out of borrowed content

error: aborting due to previous error

For more information about this error, try `rustc --explain E0507`.
14 changes: 14 additions & 0 deletions src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: return type should be `!`
--> $DIR/alloc-error-handler-bad-signature-1.rs:22:6
|
LL | ) -> () //~ ERROR return type should be `!`
| ^^

error: argument should be `Layout`
--> $DIR/alloc-error-handler-bad-signature-1.rs:21:11
|
LL | info: &Layout, //~ ERROR argument should be `Layout`
| ^^^^^^^

error: aborting due to 2 previous errors

14 changes: 14 additions & 0 deletions src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: return type should be `!`
--> $DIR/alloc-error-handler-bad-signature-2.rs:22:3
|
LL | ) { //~ ERROR return type should be `!`
| ^

error: argument should be `Layout`
--> $DIR/alloc-error-handler-bad-signature-2.rs:21:11
|
LL | info: Layout, //~ ERROR argument should be `Layout`
| ^^^^^^

error: aborting due to 2 previous errors

Loading

0 comments on commit f45f525

Please sign in to comment.