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 some compile-fail tests to ui #52409

Merged
merged 3 commits into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
  •  
  •  
  •  
File renamed without changes.
14 changes: 14 additions & 0 deletions src/test/ui/issue-10176.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error[E0308]: mismatched types
--> $DIR/issue-10176.rs:12:5
|
LL | fn f() -> isize {
| ----- expected `isize` because of return type
LL | (return 1, return 2)
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple
|
= note: expected type `isize`
found type `(!, !)`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
File renamed without changes.
9 changes: 9 additions & 0 deletions src/test/ui/issue-10200.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0532]: expected tuple struct/variant, found function `foo`
--> $DIR/issue-10200.rs:16:9
|
LL | foo(x) //~ ERROR expected tuple struct/variant, found function `foo`
| ^^^ did you mean `Foo`?

error: aborting due to previous error

For more information about this error, try `rustc --explain E0532`.
14 changes: 14 additions & 0 deletions src/test/ui/issue-10291.nll.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
warning: not reporting region error due to nll
--> $DIR/issue-10291.rs:13:9
|
LL | x //~ ERROR E0312
| ^

error: unsatisfied lifetime constraints
--> $DIR/issue-10291.rs:12:5
|
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ free region requires that `'x` must outlive `'static`

error: aborting due to previous error

File renamed without changes.
23 changes: 23 additions & 0 deletions src/test/ui/issue-10291.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/issue-10291.rs:13:9
|
LL | x //~ ERROR E0312
| ^
|
note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 12:65...
--> $DIR/issue-10291.rs:12:65
|
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
| _________________________________________________________________^
LL | | x //~ ERROR E0312
LL | | }));
| |_____^
note: ...but the borrowed content is only valid for the lifetime 'x as defined on the function body at 11:9
--> $DIR/issue-10291.rs:11:9
|
LL | fn test<'x>(x: &'x isize) {
| ^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0312`.
13 changes: 13 additions & 0 deletions src/test/ui/issue-10398.nll.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error[E0382]: use of moved value: `x`
--> $DIR/issue-10398.rs:17:14
|
LL | let _a = x;
| - value moved here
LL | drop(x);
| ^ value used here after move
|
= note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait

error: aborting due to previous error

For more information about this error, try `rustc --explain E0382`.
File renamed without changes.
13 changes: 13 additions & 0 deletions src/test/ui/issue-10398.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error[E0382]: use of moved value: `x`
--> $DIR/issue-10398.rs:17:14
|
LL | let _a = x;
| -- value moved here
LL | drop(x);
| ^ value used here after move
|
= note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait

error: aborting due to previous error

For more information about this error, try `rustc --explain E0382`.
File renamed without changes.
16 changes: 16 additions & 0 deletions src/test/ui/issue-10401.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error[E0368]: binary assignment operation `+=` cannot be applied to type `&str`
--> $DIR/issue-10401.rs:13:5
|
LL | a += { "b" };
| -^^^^^^^^^^^
| |
| cannot use `+=` on type `&str`
| `+` can't be used to concatenate two `&str` strings
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
|
LL | a.to_owned() += { "b" };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open an issue about this wrong suggestion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| ^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0368`.
File renamed without changes.
51 changes: 51 additions & 0 deletions src/test/ui/issue-10412.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:11:20
|
LL | trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names
| ^^^^^

error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:12:25
|
LL | fn serialize(val : &'self T) -> Vec<u8>; //~ ERROR lifetimes cannot use keyword names
| ^^^^^

error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:13:38
|
LL | fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names
| ^^^^^

error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:16:6
|
LL | impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
| ^^^^^

error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:16:36
|
LL | impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
| ^^^^^

error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:19:25
|
LL | fn serialize(val : &'self str) -> Vec<u8> { //~ ERROR lifetimes cannot use keyword names
| ^^^^^

error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:22:37
|
LL | fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names
| ^^^^^

error[E0106]: missing lifetime specifier
--> $DIR/issue-10412.rs:16:13
|
LL | impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
| ^^^^^^^^^^^^^^^^^ expected lifetime parameter

error: aborting due to 8 previous errors

For more information about this error, try `rustc --explain E0106`.
File renamed without changes.
13 changes: 13 additions & 0 deletions src/test/ui/issue-10465.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error[E0599]: no method named `foo` found for type `&b::B` in the current scope
--> $DIR/issue-10465.rs:27:15
|
LL | b.foo(); //~ ERROR: no method named `foo` found
| ^^^
|
= help: items from traits can only be used if the trait is in scope
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
`use a::A;`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ pub fn main() {
foo!();

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

// regardless of whether nested macro_rules works, the following should at
// least throw a conventional error.
assert!({one! two});
//~^ ERROR expected
}
14 changes: 14 additions & 0 deletions src/test/ui/issue-10536.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: macros that expand to items must either be surrounded with braces or followed by a semicolon
--> $DIR/issue-10536.rs:26:22
|
LL | assert!({one! two()});
| ^^

error: expected `(` or `{`, found `}`
--> $DIR/issue-10536.rs:31:22
|
LL | assert!({one! two});
| ^ expected `(` or `{`

error: aborting due to 2 previous errors

File renamed without changes.
9 changes: 9 additions & 0 deletions src/test/ui/issue-10545.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0603]: struct `S` is private
--> $DIR/issue-10545.rs:17:11
|
LL | fn foo(_: a::S) { //~ ERROR: struct `S` is private
| ^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0603`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern: missing documentation for crate

#![deny(missing_docs)]
#![crate_type="lib"]
//~^^ ERROR missing documentation for crate
15 changes: 15 additions & 0 deletions src/test/ui/issue-10656.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: missing documentation for crate
--> $DIR/issue-10656.rs:11:1
|
LL | / #![deny(missing_docs)]
LL | | #![crate_type="lib"]
| |____________________^
|
note: lint level defined here
--> $DIR/issue-10656.rs:11:9
|
LL | #![deny(missing_docs)]
| ^^^^^^^^^^^^

error: aborting due to previous error

File renamed without changes.
6 changes: 6 additions & 0 deletions src/test/ui/issue-10755.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
error: linker `llllll` not found
|
= note: No such file or directory (os error 2)

error: aborting due to previous error

File renamed without changes.
12 changes: 12 additions & 0 deletions src/test/ui/issue-10764.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/issue-10764.rs:14:15
|
LL | fn main() { f(bar) }
| ^^^ expected "Rust" fn, found "C" fn
|
= note: expected type `fn()`
found type `extern "C" fn() {bar}`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
File renamed without changes.
27 changes: 27 additions & 0 deletions src/test/ui/issue-10877.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
error[E0130]: patterns aren't allowed in foreign function declarations
--> $DIR/issue-10877.rs:13:12
|
LL | fn foo(1: ());
| ^ pattern not allowed in foreign function

error[E0130]: patterns aren't allowed in foreign function declarations
--> $DIR/issue-10877.rs:15:12
|
LL | fn bar((): isize);
| ^^ pattern not allowed in foreign function

error[E0130]: patterns aren't allowed in foreign function declarations
--> $DIR/issue-10877.rs:17:12
|
LL | fn baz(Foo { x }: isize);
| ^^^^^^^^^ pattern not allowed in foreign function

error[E0130]: patterns aren't allowed in foreign function declarations
--> $DIR/issue-10877.rs:19:12
|
LL | fn qux((x,y): ());
| ^^^^^ pattern not allowed in foreign function

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0130`.
File renamed without changes.
11 changes: 11 additions & 0 deletions src/test/ui/issue-10991.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0605]: non-primitive cast: `()` as `usize`
--> $DIR/issue-10991.rs:13:14
|
LL | let _t = nil as usize; //~ ERROR: non-primitive cast: `()` as `usize`
| ^^^^^^^^^^^^
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait

error: aborting due to previous error

For more information about this error, try `rustc --explain E0605`.
File renamed without changes.
6 changes: 6 additions & 0 deletions src/test/ui/issue-11154.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
error: cannot prefer dynamic linking when performing LTO

note: only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO

error: aborting due to previous error

18 changes: 18 additions & 0 deletions src/test/ui/issue-11192.nll.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
--> $DIR/issue-11192.rs:30:10
|
LL | let mut test = |foo: &Foo| {
| ----------- mutable borrow occurs here
LL | println!("access {}", foo.x);
LL | ptr = box Foo { x: ptr.x + 1 };
| --- previous borrow occurs due to use of `ptr` in closure
...
LL | test(&*ptr);
| -----^^^^^-
| | |
| | immutable borrow occurs here
| borrow later used here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0502`.
File renamed without changes.
18 changes: 18 additions & 0 deletions src/test/ui/issue-11192.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error[E0502]: cannot borrow `*ptr` as immutable because `ptr` is also borrowed as mutable
--> $DIR/issue-11192.rs:30:11
|
LL | let mut test = |foo: &Foo| {
| ----------- mutable borrow occurs here
LL | println!("access {}", foo.x);
LL | ptr = box Foo { x: ptr.x + 1 };
| --- previous borrow occurs due to use of `ptr` in closure
...
LL | test(&*ptr);
| ^^^^ immutable borrow occurs here
LL | //~^ ERROR: cannot borrow `*ptr` as immutable
LL | }
| - mutable borrow ends here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0502`.
File renamed without changes.
15 changes: 15 additions & 0 deletions src/test/ui/issue-11374.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error[E0308]: mismatched types
--> $DIR/issue-11374.rs:36:15
|
LL | c.read_to(v); //~ ERROR E0308
| ^
| |
| expected &mut [u8], found struct `std::vec::Vec`
| help: consider mutably borrowing here: `&mut v`
|
= note: expected type `&mut [u8]`
found type `std::vec::Vec<_>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
16 changes: 16 additions & 0 deletions src/test/ui/issue-11493.ast.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error[E0597]: borrowed value does not live long enough (Ast)
--> $DIR/issue-11493.rs:20:35
|
LL | let y = x.as_ref().unwrap_or(&id(5));
| ^^^^^ - temporary value dropped here while still borrowed
| |
| temporary value does not live long enough
...
LL | }
| - temporary value needs to live until here
|
= note: consider using a `let` binding to increase its lifetime

error: aborting due to previous error

For more information about this error, try `rustc --explain E0597`.
16 changes: 16 additions & 0 deletions src/test/ui/issue-11493.mir.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error[E0597]: borrowed value does not live long enough (Ast)
--> $DIR/issue-11493.rs:20:35
|
LL | let y = x.as_ref().unwrap_or(&id(5));
| ^^^^^ - temporary value dropped here while still borrowed
| |
| temporary value does not live long enough
...
LL | }
| - temporary value needs to live until here
|
= note: consider using a `let` binding to increase its lifetime

error: aborting due to previous error

For more information about this error, try `rustc --explain E0597`.
Loading