Rollup merge of #149498 - reddevilmidzy:t8, r=fee1-dead
Tidying up `tests/ui/issues` tests [1/N] > [!NOTE] > Intermediate commits are intended to help review, but will be squashed add comment commit prior to merge. part of rust-lang/rust#133895
This commit is contained in:
commit
1f458c634e
18 changed files with 111 additions and 133 deletions
10
tests/ui/box/self-assignment.rs
Normal file
10
tests/ui/box/self-assignment.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
//@ run-pass
|
||||
//! regression test for <https://github.com/rust-lang/rust/issues/3290>
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
pub fn main() {
|
||||
let mut x: Box<_> = Box::new(3);
|
||||
x = x;
|
||||
assert_eq!(*x, 3);
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
// Can't use unit struct as constructor function
|
||||
// related issue <https://github.com/rust-lang/rust/issues/20714>
|
||||
|
||||
//@ aux-build:empty-struct.rs
|
||||
|
||||
|
|
@ -8,7 +9,7 @@ use empty_struct::*;
|
|||
struct Empty2;
|
||||
|
||||
enum E {
|
||||
Empty4
|
||||
Empty4,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0618]: expected function, found struct `Empty2`
|
||||
--> $DIR/empty-struct-unit-expr.rs:15:14
|
||||
--> $DIR/empty-struct-unit-expr.rs:16:14
|
||||
|
|
||||
LL | struct Empty2;
|
||||
| ------------- struct `Empty2` defined here
|
||||
|
|
@ -16,9 +16,9 @@ LL + let e2 = Empty2;
|
|||
|
|
||||
|
||||
error[E0618]: expected function, found enum variant `E::Empty4`
|
||||
--> $DIR/empty-struct-unit-expr.rs:16:14
|
||||
--> $DIR/empty-struct-unit-expr.rs:17:14
|
||||
|
|
||||
LL | Empty4
|
||||
LL | Empty4,
|
||||
| ------ enum variant `E::Empty4` defined here
|
||||
...
|
||||
LL | let e4 = E::Empty4();
|
||||
|
|
@ -33,7 +33,7 @@ LL + let e4 = E::Empty4;
|
|||
|
|
||||
|
||||
error[E0618]: expected function, found struct `XEmpty2`
|
||||
--> $DIR/empty-struct-unit-expr.rs:18:15
|
||||
--> $DIR/empty-struct-unit-expr.rs:19:15
|
||||
|
|
||||
LL | let xe2 = XEmpty2();
|
||||
| ^^^^^^^--
|
||||
|
|
@ -47,7 +47,7 @@ LL + let xe2 = XEmpty2;
|
|||
|
|
||||
|
||||
error[E0618]: expected function, found enum variant `XE::XEmpty4`
|
||||
--> $DIR/empty-struct-unit-expr.rs:19:15
|
||||
--> $DIR/empty-struct-unit-expr.rs:20:15
|
||||
|
|
||||
LL | let xe4 = XE::XEmpty4();
|
||||
| ^^^^^^^^^^^--
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
//! regression test for #37576, #50802
|
||||
//! Tests that using unlabeled `break` or `continue` within a loop or while's condition.
|
||||
|
||||
fn main() {
|
||||
'test_1: while break 'test_1 {}
|
||||
while break {}
|
||||
|
|
@ -7,9 +10,13 @@ fn main() {
|
|||
while let true = break {}
|
||||
//~^ ERROR `break` or `continue` with no label
|
||||
|
||||
loop { 'test_3: while break 'test_3 {} }
|
||||
loop { while break {} }
|
||||
//~^ ERROR `break` or `continue` with no label
|
||||
loop {
|
||||
'test_3: while break 'test_3 {}
|
||||
}
|
||||
loop {
|
||||
while break {}
|
||||
//~^ ERROR `break` or `continue` with no label
|
||||
}
|
||||
|
||||
loop {
|
||||
'test_4: while break 'test_4 {}
|
||||
|
|
@ -29,9 +36,13 @@ fn main() {
|
|||
while let true = continue {}
|
||||
//~^ ERROR `break` or `continue` with no label
|
||||
|
||||
loop { 'test_7: while continue 'test_7 {} }
|
||||
loop { while continue {} }
|
||||
//~^ ERROR `break` or `continue` with no label
|
||||
loop {
|
||||
'test_7: while continue 'test_7 {}
|
||||
}
|
||||
loop {
|
||||
while continue {}
|
||||
//~^ ERROR `break` or `continue` with no label
|
||||
}
|
||||
|
||||
loop {
|
||||
'test_8: while continue 'test_8 {}
|
||||
|
|
@ -42,4 +53,13 @@ fn main() {
|
|||
//~^ ERROR `break` or `continue` with no label
|
||||
continue;
|
||||
}
|
||||
|
||||
'test_9: loop {
|
||||
break while continue 'test_9 {};
|
||||
}
|
||||
loop {
|
||||
break while continue {
|
||||
//~^ ERROR `break` or `continue` with no label
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +1,57 @@
|
|||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/issue-37576.rs:3:11
|
||||
--> $DIR/break-continue-in-loop-while-condition.rs:6:11
|
||||
|
|
||||
LL | while break {}
|
||||
| ^^^^^ unlabeled `break` in the condition of a `while` loop
|
||||
|
||||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/issue-37576.rs:7:22
|
||||
--> $DIR/break-continue-in-loop-while-condition.rs:10:22
|
||||
|
|
||||
LL | while let true = break {}
|
||||
| ^^^^^ unlabeled `break` in the condition of a `while` loop
|
||||
|
||||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/issue-37576.rs:11:18
|
||||
|
|
||||
LL | loop { while break {} }
|
||||
| ^^^^^ unlabeled `break` in the condition of a `while` loop
|
||||
|
||||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/issue-37576.rs:19:15
|
||||
--> $DIR/break-continue-in-loop-while-condition.rs:17:15
|
||||
|
|
||||
LL | while break {}
|
||||
| ^^^^^ unlabeled `break` in the condition of a `while` loop
|
||||
|
||||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/issue-37576.rs:25:11
|
||||
--> $DIR/break-continue-in-loop-while-condition.rs:26:15
|
||||
|
|
||||
LL | while break {}
|
||||
| ^^^^^ unlabeled `break` in the condition of a `while` loop
|
||||
|
||||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/break-continue-in-loop-while-condition.rs:32:11
|
||||
|
|
||||
LL | while continue {}
|
||||
| ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
|
||||
|
||||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/issue-37576.rs:29:22
|
||||
--> $DIR/break-continue-in-loop-while-condition.rs:36:22
|
||||
|
|
||||
LL | while let true = continue {}
|
||||
| ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
|
||||
|
||||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/issue-37576.rs:33:18
|
||||
|
|
||||
LL | loop { while continue {} }
|
||||
| ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
|
||||
|
||||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/issue-37576.rs:41:15
|
||||
--> $DIR/break-continue-in-loop-while-condition.rs:43:15
|
||||
|
|
||||
LL | while continue {}
|
||||
| ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/break-continue-in-loop-while-condition.rs:52:15
|
||||
|
|
||||
LL | while continue {}
|
||||
| ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
|
||||
|
||||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/break-continue-in-loop-while-condition.rs:61:21
|
||||
|
|
||||
LL | break while continue {
|
||||
| ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0590`.
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
struct G;
|
||||
|
||||
fn main() {
|
||||
let g = G(); //~ ERROR: expected function, found struct `G`
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
error[E0618]: expected function, found struct `G`
|
||||
--> $DIR/issue-20714.rs:4:13
|
||||
|
|
||||
LL | struct G;
|
||||
| -------- struct `G` defined here
|
||||
...
|
||||
LL | let g = G();
|
||||
| ^--
|
||||
| |
|
||||
| call expression requires function
|
||||
|
|
||||
help: `G` is a unit struct, and does not take parentheses to be constructed
|
||||
|
|
||||
LL - let g = G();
|
||||
LL + let g = G;
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0618`.
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
//@ run-pass
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub fn main() {
|
||||
let mut q = VecDeque::new();
|
||||
q.push_front(10);
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
//@ dont-require-annotations: NOTE
|
||||
|
||||
fn foo<T, U>(x: T, y: U) {
|
||||
let mut xx = x;
|
||||
xx = y;
|
||||
//~^ ERROR mismatched types
|
||||
//~| NOTE expected type parameter `T`, found type parameter `U`
|
||||
//~| NOTE expected type parameter `T`
|
||||
//~| NOTE found type parameter `U`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-2951.rs:5:10
|
||||
|
|
||||
LL | fn foo<T, U>(x: T, y: U) {
|
||||
| - - found type parameter
|
||||
| |
|
||||
| expected type parameter
|
||||
LL | let mut xx = x;
|
||||
| - expected due to this value
|
||||
LL | xx = y;
|
||||
| ^ expected type parameter `T`, found type parameter `U`
|
||||
|
|
||||
= note: expected type parameter `T`
|
||||
found type parameter `U`
|
||||
= note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
pub fn main() {
|
||||
let mut x: Box<_> = Box::new(3);
|
||||
x = x;
|
||||
assert_eq!(*x, 3);
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#[allow(unreachable_code)]
|
||||
|
||||
fn main() {
|
||||
loop {
|
||||
break while continue { //~ ERROR E0590
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
|
||||
--> $DIR/issue-50802.rs:5:21
|
||||
|
|
||||
LL | break while continue {
|
||||
| ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0590`.
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/3680>
|
||||
|
||||
fn main() {
|
||||
match None { //~ NOTE this expression has type `Option<_>`
|
||||
Err(_) => ()
|
||||
match None {
|
||||
//~^ NOTE this expression has type `Option<_>`
|
||||
Err(_) => (),
|
||||
//~^ ERROR mismatched types
|
||||
//~| NOTE expected enum `Option<_>`
|
||||
//~| NOTE found enum `Result<_, _>`
|
||||
|
|
@ -1,16 +1,17 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-3680.rs:3:9
|
||||
--> $DIR/match-option-result-mismatch.rs:6:9
|
||||
|
|
||||
LL | match None {
|
||||
| ---- this expression has type `Option<_>`
|
||||
LL | Err(_) => ()
|
||||
LL |
|
||||
LL | Err(_) => (),
|
||||
| ^^^^^^ expected `Option<_>`, found `Result<_, _>`
|
||||
|
|
||||
= note: expected enum `Option<_>`
|
||||
found enum `Result<_, _>`
|
||||
help: try wrapping the pattern in `Some`
|
||||
|
|
||||
LL | Some(Err(_)) => ()
|
||||
LL | Some(Err(_)) => (),
|
||||
| +++++ +
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
//@ run-pass
|
||||
//! regression test for <https://github.com/rust-lang/rust/issues/3091>
|
||||
|
||||
pub fn main() {
|
||||
let x = 1;
|
||||
|
|
@ -1,14 +1,24 @@
|
|||
// Test that we print out the names of type parameters correctly in
|
||||
// our error messages.
|
||||
// related issue <https://github.com/rust-lang/rust/issues/2951>
|
||||
|
||||
//@ dont-require-annotations: NOTE
|
||||
|
||||
fn foo<Foo, Bar>(x: Foo) -> Bar {
|
||||
x
|
||||
//~^ ERROR mismatched types
|
||||
//~| NOTE expected type parameter `Bar`, found type parameter `Foo`
|
||||
//~| NOTE expected type parameter `Bar`
|
||||
//~| NOTE found type parameter `Foo`
|
||||
//~^ ERROR mismatched types
|
||||
//~| NOTE expected type parameter `Bar`, found type parameter `Foo`
|
||||
//~| NOTE expected type parameter `Bar`
|
||||
//~| NOTE found type parameter `Foo`
|
||||
}
|
||||
|
||||
fn bar<Foo, Bar>(x: Foo, y: Bar) {
|
||||
let mut xx = x;
|
||||
xx = y;
|
||||
//~^ ERROR mismatched types
|
||||
//~| NOTE expected type parameter `Foo`, found type parameter `Bar`
|
||||
//~| NOTE expected type parameter `Foo`
|
||||
//~| NOTE found type parameter `Bar`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/type-parameter-names.rs:7:5
|
||||
--> $DIR/type-parameter-names.rs:8:5
|
||||
|
|
||||
LL | fn foo<Foo, Bar>(x: Foo) -> Bar {
|
||||
| --- --- --- expected `Bar` because of return type
|
||||
|
|
@ -15,6 +15,23 @@ LL | x
|
|||
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
|
||||
= note: the caller chooses a type for `Bar` which can be different from `Foo`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/type-parameter-names.rs:17:10
|
||||
|
|
||||
LL | fn bar<Foo, Bar>(x: Foo, y: Bar) {
|
||||
| --- --- found type parameter
|
||||
| |
|
||||
| expected type parameter
|
||||
LL | let mut xx = x;
|
||||
| - expected due to this value
|
||||
LL | xx = y;
|
||||
| ^ expected type parameter `Foo`, found type parameter `Bar`
|
||||
|
|
||||
= note: expected type parameter `Foo`
|
||||
found type parameter `Bar`
|
||||
= note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue