Skip to content

Commit 2332759

Browse files
committed
Move some compile-fail tests to ui
1 parent 7e32059 commit 2332759

File tree

1,152 files changed

+9668
-17
lines changed

Some content is hidden

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

1,152 files changed

+9668
-17
lines changed
File renamed without changes.

src/test/ui/issue-10176.stderr

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-10176.rs:12:5
3+
|
4+
LL | fn f() -> isize {
5+
| ----- expected `isize` because of return type
6+
LL | (return 1, return 2)
7+
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple
8+
|
9+
= note: expected type `isize`
10+
found type `(!, !)`
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0308`.
File renamed without changes.

src/test/ui/issue-10200.stderr

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0532]: expected tuple struct/variant, found function `foo`
2+
--> $DIR/issue-10200.rs:16:9
3+
|
4+
LL | foo(x) //~ ERROR expected tuple struct/variant, found function `foo`
5+
| ^^^ did you mean `Foo`?
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0532`.

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

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
warning: not reporting region error due to nll
2+
--> $DIR/issue-10291.rs:13:9
3+
|
4+
LL | x //~ ERROR E0312
5+
| ^
6+
7+
error: unsatisfied lifetime constraints
8+
--> $DIR/issue-10291.rs:12:5
9+
|
10+
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ free region requires that `'x` must outlive `'static`
12+
13+
error: aborting due to previous error
14+
File renamed without changes.

src/test/ui/issue-10291.stderr

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
2+
--> $DIR/issue-10291.rs:13:9
3+
|
4+
LL | x //~ ERROR E0312
5+
| ^
6+
|
7+
note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 12:65...
8+
--> $DIR/issue-10291.rs:12:65
9+
|
10+
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
11+
| _________________________________________________________________^
12+
LL | | x //~ ERROR E0312
13+
LL | | }));
14+
| |_____^
15+
note: ...but the borrowed content is only valid for the lifetime 'x as defined on the function body at 11:9
16+
--> $DIR/issue-10291.rs:11:9
17+
|
18+
LL | fn test<'x>(x: &'x isize) {
19+
| ^^
20+
21+
error: aborting due to previous error
22+
23+
For more information about this error, try `rustc --explain E0312`.

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

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0382]: use of moved value: `x`
2+
--> $DIR/issue-10398.rs:17:14
3+
|
4+
LL | let _a = x;
5+
| - value moved here
6+
LL | drop(x);
7+
| ^ value used here after move
8+
|
9+
= note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0382`.
File renamed without changes.

src/test/ui/issue-10398.stderr

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0382]: use of moved value: `x`
2+
--> $DIR/issue-10398.rs:17:14
3+
|
4+
LL | let _a = x;
5+
| -- value moved here
6+
LL | drop(x);
7+
| ^ value used here after move
8+
|
9+
= note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0382`.
File renamed without changes.

src/test/ui/issue-10401.stderr

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0368]: binary assignment operation `+=` cannot be applied to type `&str`
2+
--> $DIR/issue-10401.rs:13:5
3+
|
4+
LL | a += { "b" };
5+
| -^^^^^^^^^^^
6+
| |
7+
| cannot use `+=` on type `&str`
8+
| `+` can't be used to concatenate two `&str` strings
9+
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
10+
|
11+
LL | a.to_owned() += { "b" };
12+
| ^^^^^^^^^^^^
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0368`.
File renamed without changes.

src/test/ui/issue-10412.stderr

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
error: lifetimes cannot use keyword names
2+
--> $DIR/issue-10412.rs:11:20
3+
|
4+
LL | trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names
5+
| ^^^^^
6+
7+
error: lifetimes cannot use keyword names
8+
--> $DIR/issue-10412.rs:12:25
9+
|
10+
LL | fn serialize(val : &'self T) -> Vec<u8>; //~ ERROR lifetimes cannot use keyword names
11+
| ^^^^^
12+
13+
error: lifetimes cannot use keyword names
14+
--> $DIR/issue-10412.rs:13:38
15+
|
16+
LL | fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names
17+
| ^^^^^
18+
19+
error: lifetimes cannot use keyword names
20+
--> $DIR/issue-10412.rs:16:6
21+
|
22+
LL | impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
23+
| ^^^^^
24+
25+
error: lifetimes cannot use keyword names
26+
--> $DIR/issue-10412.rs:16:36
27+
|
28+
LL | impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
29+
| ^^^^^
30+
31+
error: lifetimes cannot use keyword names
32+
--> $DIR/issue-10412.rs:19:25
33+
|
34+
LL | fn serialize(val : &'self str) -> Vec<u8> { //~ ERROR lifetimes cannot use keyword names
35+
| ^^^^^
36+
37+
error: lifetimes cannot use keyword names
38+
--> $DIR/issue-10412.rs:22:37
39+
|
40+
LL | fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names
41+
| ^^^^^
42+
43+
error[E0106]: missing lifetime specifier
44+
--> $DIR/issue-10412.rs:16:13
45+
|
46+
LL | impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
47+
| ^^^^^^^^^^^^^^^^^ expected lifetime parameter
48+
49+
error: aborting due to 8 previous errors
50+
51+
For more information about this error, try `rustc --explain E0106`.
File renamed without changes.

src/test/ui/issue-10465.stderr

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0599]: no method named `foo` found for type `&b::B` in the current scope
2+
--> $DIR/issue-10465.rs:27:15
3+
|
4+
LL | b.foo(); //~ ERROR: no method named `foo` found
5+
| ^^^
6+
|
7+
= help: items from traits can only be used if the trait is in scope
8+
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
9+
`use a::A;`
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0599`.

src/test/compile-fail/issue-10536.rs renamed to src/test/ui/issue-10536.rs

+2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ pub fn main() {
2424
foo!();
2525

2626
assert!({one! two()});
27+
//~^ ERROR macros that expand to items must either be surrounded with braces or followed by a
2728

2829
// regardless of whether nested macro_rules works, the following should at
2930
// least throw a conventional error.
3031
assert!({one! two});
32+
//~^ ERROR expected
3133
}

src/test/ui/issue-10536.stderr

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: macros that expand to items must either be surrounded with braces or followed by a semicolon
2+
--> $DIR/issue-10536.rs:26:22
3+
|
4+
LL | assert!({one! two()});
5+
| ^^
6+
7+
error: expected `(` or `{`, found `}`
8+
--> $DIR/issue-10536.rs:31:22
9+
|
10+
LL | assert!({one! two});
11+
| ^ expected `(` or `{`
12+
13+
error: aborting due to 2 previous errors
14+
File renamed without changes.

src/test/ui/issue-10545.stderr

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0603]: struct `S` is private
2+
--> $DIR/issue-10545.rs:17:11
3+
|
4+
LL | fn foo(_: a::S) { //~ ERROR: struct `S` is private
5+
| ^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0603`.

src/test/compile-fail/issue-10656.rs renamed to src/test/ui/issue-10656.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: missing documentation for crate
12-
1311
#![deny(missing_docs)]
1412
#![crate_type="lib"]
13+
//~^^ ERROR missing documentation for crate

src/test/ui/issue-10656.stderr

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: missing documentation for crate
2+
--> $DIR/issue-10656.rs:11:1
3+
|
4+
LL | / #![deny(missing_docs)]
5+
LL | | #![crate_type="lib"]
6+
| |____________________^
7+
|
8+
note: lint level defined here
9+
--> $DIR/issue-10656.rs:11:9
10+
|
11+
LL | #![deny(missing_docs)]
12+
| ^^^^^^^^^^^^
13+
14+
error: aborting due to previous error
15+
File renamed without changes.

src/test/ui/issue-10755.stderr

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
error: linker `llllll` not found
2+
|
3+
= note: No such file or directory (os error 2)
4+
5+
error: aborting due to previous error
6+
File renamed without changes.

src/test/ui/issue-10764.stderr

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-10764.rs:14:15
3+
|
4+
LL | fn main() { f(bar) }
5+
| ^^^ expected "Rust" fn, found "C" fn
6+
|
7+
= note: expected type `fn()`
8+
found type `extern "C" fn() {bar}`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0308`.
File renamed without changes.

src/test/ui/issue-10877.stderr

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error[E0130]: patterns aren't allowed in foreign function declarations
2+
--> $DIR/issue-10877.rs:13:12
3+
|
4+
LL | fn foo(1: ());
5+
| ^ pattern not allowed in foreign function
6+
7+
error[E0130]: patterns aren't allowed in foreign function declarations
8+
--> $DIR/issue-10877.rs:15:12
9+
|
10+
LL | fn bar((): isize);
11+
| ^^ pattern not allowed in foreign function
12+
13+
error[E0130]: patterns aren't allowed in foreign function declarations
14+
--> $DIR/issue-10877.rs:17:12
15+
|
16+
LL | fn baz(Foo { x }: isize);
17+
| ^^^^^^^^^ pattern not allowed in foreign function
18+
19+
error[E0130]: patterns aren't allowed in foreign function declarations
20+
--> $DIR/issue-10877.rs:19:12
21+
|
22+
LL | fn qux((x,y): ());
23+
| ^^^^^ pattern not allowed in foreign function
24+
25+
error: aborting due to 4 previous errors
26+
27+
For more information about this error, try `rustc --explain E0130`.
File renamed without changes.

src/test/ui/issue-10991.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0605]: non-primitive cast: `()` as `usize`
2+
--> $DIR/issue-10991.rs:13:14
3+
|
4+
LL | let _t = nil as usize; //~ ERROR: non-primitive cast: `()` as `usize`
5+
| ^^^^^^^^^^^^
6+
|
7+
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0605`.
File renamed without changes.

src/test/ui/issue-11154.stderr

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
error: cannot prefer dynamic linking when performing LTO
2+
3+
note: only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO
4+
5+
error: aborting due to previous error
6+

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

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
2+
--> $DIR/issue-11192.rs:30:10
3+
|
4+
LL | let mut test = |foo: &Foo| {
5+
| ----------- mutable borrow occurs here
6+
LL | println!("access {}", foo.x);
7+
LL | ptr = box Foo { x: ptr.x + 1 };
8+
| --- previous borrow occurs due to use of `ptr` in closure
9+
...
10+
LL | test(&*ptr);
11+
| -----^^^^^-
12+
| | |
13+
| | immutable borrow occurs here
14+
| borrow later used here
15+
16+
error: aborting due to previous error
17+
18+
For more information about this error, try `rustc --explain E0502`.
File renamed without changes.

src/test/ui/issue-11192.stderr

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error[E0502]: cannot borrow `*ptr` as immutable because `ptr` is also borrowed as mutable
2+
--> $DIR/issue-11192.rs:30:11
3+
|
4+
LL | let mut test = |foo: &Foo| {
5+
| ----------- mutable borrow occurs here
6+
LL | println!("access {}", foo.x);
7+
LL | ptr = box Foo { x: ptr.x + 1 };
8+
| --- previous borrow occurs due to use of `ptr` in closure
9+
...
10+
LL | test(&*ptr);
11+
| ^^^^ immutable borrow occurs here
12+
LL | //~^ ERROR: cannot borrow `*ptr` as immutable
13+
LL | }
14+
| - mutable borrow ends here
15+
16+
error: aborting due to previous error
17+
18+
For more information about this error, try `rustc --explain E0502`.
File renamed without changes.

src/test/ui/issue-11374.stderr

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-11374.rs:36:15
3+
|
4+
LL | c.read_to(v); //~ ERROR E0308
5+
| ^
6+
| |
7+
| expected &mut [u8], found struct `std::vec::Vec`
8+
| help: consider mutably borrowing here: `&mut v`
9+
|
10+
= note: expected type `&mut [u8]`
11+
found type `std::vec::Vec<_>`
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0308`.

src/test/ui/issue-11493.ast.stderr

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0597]: borrowed value does not live long enough (Ast)
2+
--> $DIR/issue-11493.rs:20:35
3+
|
4+
LL | let y = x.as_ref().unwrap_or(&id(5));
5+
| ^^^^^ - temporary value dropped here while still borrowed
6+
| |
7+
| temporary value does not live long enough
8+
...
9+
LL | }
10+
| - temporary value needs to live until here
11+
|
12+
= note: consider using a `let` binding to increase its lifetime
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0597`.

src/test/ui/issue-11493.mir.stderr

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0597]: borrowed value does not live long enough (Ast)
2+
--> $DIR/issue-11493.rs:20:35
3+
|
4+
LL | let y = x.as_ref().unwrap_or(&id(5));
5+
| ^^^^^ - temporary value dropped here while still borrowed
6+
| |
7+
| temporary value does not live long enough
8+
...
9+
LL | }
10+
| - temporary value needs to live until here
11+
|
12+
= note: consider using a `let` binding to increase its lifetime
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0597`.

0 commit comments

Comments
 (0)