Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move compile-fail tests to ui #53196

Merged
merged 20 commits into from
Aug 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
fe28bcf
Check error-patterns on UI tests. Fixes #52531.
davidtwco Aug 8, 2018
b16a306
Moved compile-fail tests to ui tests.
davidtwco Aug 8, 2018
3e0a407
Updated new UI tests to pass with NLL compare-mode
davidtwco Aug 8, 2018
3fc7ab2
Merged migrated compile-fail tests and ui tests. Fixes #46841.
davidtwco Aug 8, 2018
ed79c31
Tidy no longer fails when there are no files or subdirectories in a t…
davidtwco Aug 8, 2018
2ad663c
Normalize test build directory and root build directory.
davidtwco Aug 9, 2018
dc5a657
Fixed truncated path not being normalized.
davidtwco Aug 9, 2018
8e7b9b8
Suggested trait implementation ordering is now deterministic.
davidtwco Aug 9, 2018
003b5a8
Normalize crateresolve1.rs to support different candidate ordering be…
davidtwco Aug 9, 2018
7c13eb4
Fix no-link-with-link-args by introducing another normalization.
davidtwco Aug 9, 2018
a922642
Moved tests back to compile-test if they don't work on ui.
davidtwco Aug 9, 2018
0cfc173
Moved problematic tests on Windows back to compile-fail.
davidtwco Aug 10, 2018
cd12c82
Fixed 'no such file or directory' mismatch between Windows and Linux.
davidtwco Aug 10, 2018
768998a
Normalize tests for i686 Windows.
davidtwco Aug 10, 2018
b8b7a3c
Moved problematic tests on i586-unknown-linux-gnu back to compile-fail.
davidtwco Aug 10, 2018
f7f7c1e
Moved problematic tests on dist-x86_64-musl back to compile-fail.
davidtwco Aug 13, 2018
4b24645
Moved problematic tests on wasm32-unknown back to compile-fail.
davidtwco Aug 13, 2018
67ec37b
Moved problematic tests on armhf-gnu back to compile-fail.
davidtwco Aug 13, 2018
d775e61
Moved problematic tests on x86_64-pc-windows-gnu back to compile-fail.
davidtwco Aug 13, 2018
7b02656
Moved problematic tests on x86_64-gnu-nopt back to compile-fail.
davidtwco Aug 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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.
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`.
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