about summary refs log tree commit diff
path: root/src/test/ui/block-result
diff options
context:
space:
mode:
authorAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-05 09:13:28 +0100
committerAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-11 09:32:08 +0000
commitcf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch)
tree40a88d9a46aaf3e8870676eb2538378b75a263eb /src/test/ui/block-result
parentca855e6e42787ecd062d81d53336fe6788ef51a9 (diff)
Move /src/test to /tests
Diffstat (limited to 'src/test/ui/block-result')
-rw-r--r--src/test/ui/block-result/block-must-not-have-result-do.rs5
-rw-r--r--src/test/ui/block-result/block-must-not-have-result-do.stderr9
-rw-r--r--src/test/ui/block-result/block-must-not-have-result-res.rs10
-rw-r--r--src/test/ui/block-result/block-must-not-have-result-res.stderr11
-rw-r--r--src/test/ui/block-result/block-must-not-have-result-while.rs6
-rw-r--r--src/test/ui/block-result/block-must-not-have-result-while.stderr21
-rw-r--r--src/test/ui/block-result/consider-removing-last-semi.fixed20
-rw-r--r--src/test/ui/block-result/consider-removing-last-semi.rs20
-rw-r--r--src/test/ui/block-result/consider-removing-last-semi.stderr36
-rw-r--r--src/test/ui/block-result/issue-11714.rs7
-rw-r--r--src/test/ui/block-result/issue-11714.stderr14
-rw-r--r--src/test/ui/block-result/issue-13428.rs16
-rw-r--r--src/test/ui/block-result/issue-13428.stderr22
-rw-r--r--src/test/ui/block-result/issue-13624.rs29
-rw-r--r--src/test/ui/block-result/issue-13624.stderr19
-rw-r--r--src/test/ui/block-result/issue-20862.rs9
-rw-r--r--src/test/ui/block-result/issue-20862.stderr26
-rw-r--r--src/test/ui/block-result/issue-22645.rs17
-rw-r--r--src/test/ui/block-result/issue-22645.stderr26
-rw-r--r--src/test/ui/block-result/issue-3563.rs7
-rw-r--r--src/test/ui/block-result/issue-3563.stderr9
-rw-r--r--src/test/ui/block-result/issue-5500.rs7
-rw-r--r--src/test/ui/block-result/issue-5500.stderr19
-rw-r--r--src/test/ui/block-result/unexpected-return-on-unit.rs14
-rw-r--r--src/test/ui/block-result/unexpected-return-on-unit.stderr18
25 files changed, 0 insertions, 397 deletions
diff --git a/src/test/ui/block-result/block-must-not-have-result-do.rs b/src/test/ui/block-result/block-must-not-have-result-do.rs
deleted file mode 100644
index 4fdb69778cb..00000000000
--- a/src/test/ui/block-result/block-must-not-have-result-do.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn main() {
-    loop {
-        true //~  ERROR mismatched types
-    }
-}
diff --git a/src/test/ui/block-result/block-must-not-have-result-do.stderr b/src/test/ui/block-result/block-must-not-have-result-do.stderr
deleted file mode 100644
index 914886f81b4..00000000000
--- a/src/test/ui/block-result/block-must-not-have-result-do.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/block-must-not-have-result-do.rs:3:9
-   |
-LL |         true
-   |         ^^^^ expected `()`, found `bool`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/block-result/block-must-not-have-result-res.rs b/src/test/ui/block-result/block-must-not-have-result-res.rs
deleted file mode 100644
index 7e86274a18e..00000000000
--- a/src/test/ui/block-result/block-must-not-have-result-res.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-struct R;
-
-impl Drop for R {
-    fn drop(&mut self) {
-        true //~  ERROR mismatched types
-    }
-}
-
-fn main() {
-}
diff --git a/src/test/ui/block-result/block-must-not-have-result-res.stderr b/src/test/ui/block-result/block-must-not-have-result-res.stderr
deleted file mode 100644
index 0080d06dd20..00000000000
--- a/src/test/ui/block-result/block-must-not-have-result-res.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/block-must-not-have-result-res.rs:5:9
-   |
-LL |     fn drop(&mut self) {
-   |                        - expected `()` because of default return type
-LL |         true
-   |         ^^^^ expected `()`, found `bool`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/block-result/block-must-not-have-result-while.rs b/src/test/ui/block-result/block-must-not-have-result-while.rs
deleted file mode 100644
index 418059bf280..00000000000
--- a/src/test/ui/block-result/block-must-not-have-result-while.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-fn main() {
-    while true { //~ WARN denote infinite loops with
-        true //~  ERROR mismatched types
-             //~| expected `()`, found `bool`
-    }
-}
diff --git a/src/test/ui/block-result/block-must-not-have-result-while.stderr b/src/test/ui/block-result/block-must-not-have-result-while.stderr
deleted file mode 100644
index 7f96aa289d0..00000000000
--- a/src/test/ui/block-result/block-must-not-have-result-while.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-warning: denote infinite loops with `loop { ... }`
-  --> $DIR/block-must-not-have-result-while.rs:2:5
-   |
-LL |     while true {
-   |     ^^^^^^^^^^ help: use `loop`
-   |
-   = note: `#[warn(while_true)]` on by default
-
-error[E0308]: mismatched types
-  --> $DIR/block-must-not-have-result-while.rs:3:9
-   |
-LL | /     while true {
-LL | |         true
-   | |         ^^^^ expected `()`, found `bool`
-LL | |
-LL | |     }
-   | |_____- expected this to be `()`
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/block-result/consider-removing-last-semi.fixed b/src/test/ui/block-result/consider-removing-last-semi.fixed
deleted file mode 100644
index 36a769fe529..00000000000
--- a/src/test/ui/block-result/consider-removing-last-semi.fixed
+++ /dev/null
@@ -1,20 +0,0 @@
-// run-rustfix
-
-pub fn f() -> String {  //~ ERROR mismatched types
-    0u8;
-    "bla".to_string()
-}
-
-pub fn g() -> String {  //~ ERROR mismatched types
-    "this won't work".to_string();
-    "removeme".to_string()
-}
-
-pub fn macro_tests() -> u32 {  //~ ERROR mismatched types
-    macro_rules! mac {
-        () => (1);
-    }
-    mac!()
-}
-
-fn main() {}
diff --git a/src/test/ui/block-result/consider-removing-last-semi.rs b/src/test/ui/block-result/consider-removing-last-semi.rs
deleted file mode 100644
index b9a73148902..00000000000
--- a/src/test/ui/block-result/consider-removing-last-semi.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// run-rustfix
-
-pub fn f() -> String {  //~ ERROR mismatched types
-    0u8;
-    "bla".to_string();
-}
-
-pub fn g() -> String {  //~ ERROR mismatched types
-    "this won't work".to_string();
-    "removeme".to_string();
-}
-
-pub fn macro_tests() -> u32 {  //~ ERROR mismatched types
-    macro_rules! mac {
-        () => (1);
-    }
-    mac!();
-}
-
-fn main() {}
diff --git a/src/test/ui/block-result/consider-removing-last-semi.stderr b/src/test/ui/block-result/consider-removing-last-semi.stderr
deleted file mode 100644
index 9be0367ae38..00000000000
--- a/src/test/ui/block-result/consider-removing-last-semi.stderr
+++ /dev/null
@@ -1,36 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/consider-removing-last-semi.rs:3:15
-   |
-LL | pub fn f() -> String {
-   |        -      ^^^^^^ expected struct `String`, found `()`
-   |        |
-   |        implicitly returns `()` as its body has no tail or `return` expression
-LL |     0u8;
-LL |     "bla".to_string();
-   |                      - help: remove this semicolon to return this value
-
-error[E0308]: mismatched types
-  --> $DIR/consider-removing-last-semi.rs:8:15
-   |
-LL | pub fn g() -> String {
-   |        -      ^^^^^^ expected struct `String`, found `()`
-   |        |
-   |        implicitly returns `()` as its body has no tail or `return` expression
-LL |     "this won't work".to_string();
-LL |     "removeme".to_string();
-   |                           - help: remove this semicolon to return this value
-
-error[E0308]: mismatched types
-  --> $DIR/consider-removing-last-semi.rs:13:25
-   |
-LL | pub fn macro_tests() -> u32 {
-   |        -----------      ^^^ expected `u32`, found `()`
-   |        |
-   |        implicitly returns `()` as its body has no tail or `return` expression
-...
-LL |     mac!();
-   |           - help: remove this semicolon to return this value
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/block-result/issue-11714.rs b/src/test/ui/block-result/issue-11714.rs
deleted file mode 100644
index 3dda7e80191..00000000000
--- a/src/test/ui/block-result/issue-11714.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn blah() -> i32 { //~ ERROR mismatched types
-    1
-
-    ;
-}
-
-fn main() { }
diff --git a/src/test/ui/block-result/issue-11714.stderr b/src/test/ui/block-result/issue-11714.stderr
deleted file mode 100644
index 42fb3d3d43d..00000000000
--- a/src/test/ui/block-result/issue-11714.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/issue-11714.rs:1:14
-   |
-LL | fn blah() -> i32 {
-   |    ----      ^^^ expected `i32`, found `()`
-   |    |
-   |    implicitly returns `()` as its body has no tail or `return` expression
-...
-LL |     ;
-   |     - help: remove this semicolon to return this value
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/block-result/issue-13428.rs b/src/test/ui/block-result/issue-13428.rs
deleted file mode 100644
index ac85964353a..00000000000
--- a/src/test/ui/block-result/issue-13428.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Regression test for #13428
-
-fn foo() -> String {  //~ ERROR mismatched types
-    format!("Hello {}",
-            "world")
-    // Put the trailing semicolon on its own line to test that the
-    // note message gets the offending semicolon exactly
-    ;
-}
-
-fn bar() -> String {  //~ ERROR mismatched types
-    "foobar".to_string()
-    ;
-}
-
-pub fn main() {}
diff --git a/src/test/ui/block-result/issue-13428.stderr b/src/test/ui/block-result/issue-13428.stderr
deleted file mode 100644
index 2b386d10c53..00000000000
--- a/src/test/ui/block-result/issue-13428.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/issue-13428.rs:3:13
-   |
-LL | fn foo() -> String {
-   |    ---      ^^^^^^ expected struct `String`, found `()`
-   |    |
-   |    implicitly returns `()` as its body has no tail or `return` expression
-
-error[E0308]: mismatched types
-  --> $DIR/issue-13428.rs:11:13
-   |
-LL | fn bar() -> String {
-   |    ---      ^^^^^^ expected struct `String`, found `()`
-   |    |
-   |    implicitly returns `()` as its body has no tail or `return` expression
-LL |     "foobar".to_string()
-LL |     ;
-   |     - help: remove this semicolon to return this value
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/block-result/issue-13624.rs b/src/test/ui/block-result/issue-13624.rs
deleted file mode 100644
index 4d2844cc5ae..00000000000
--- a/src/test/ui/block-result/issue-13624.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-mod a {
-  pub enum Enum {
-    EnumStructVariant { x: u8, y: u8, z: u8 }
-  }
-
-  pub fn get_enum_struct_variant() -> () {
-    Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
-    //~^ ERROR mismatched types
-    //~| expected `()`, found enum `Enum`
-  }
-}
-
-mod b {
-  mod test {
-    use a;
-
-    fn test_enum_struct_variant() {
-      let enum_struct_variant = ::a::get_enum_struct_variant();
-      match enum_struct_variant {
-        a::Enum::EnumStructVariant { x, y, z } => {
-        //~^ ERROR mismatched types
-        //~| expected `()`, found enum `Enum`
-        }
-      }
-    }
-  }
-}
-
-fn main() {}
diff --git a/src/test/ui/block-result/issue-13624.stderr b/src/test/ui/block-result/issue-13624.stderr
deleted file mode 100644
index 13070b4e821..00000000000
--- a/src/test/ui/block-result/issue-13624.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/issue-13624.rs:7:5
-   |
-LL |   pub fn get_enum_struct_variant() -> () {
-   |                                       -- expected `()` because of return type
-LL |     Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Enum`
-
-error[E0308]: mismatched types
-  --> $DIR/issue-13624.rs:20:9
-   |
-LL |       match enum_struct_variant {
-   |             ------------------- this expression has type `()`
-LL |         a::Enum::EnumStructVariant { x, y, z } => {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Enum`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/block-result/issue-20862.rs b/src/test/ui/block-result/issue-20862.rs
deleted file mode 100644
index e435fd7aee9..00000000000
--- a/src/test/ui/block-result/issue-20862.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-fn foo(x: i32) {
-    |y| x + y
-//~^ ERROR: mismatched types
-}
-
-fn main() {
-    let x = foo(5)(2);
-//~^ ERROR: expected function, found `()`
-}
diff --git a/src/test/ui/block-result/issue-20862.stderr b/src/test/ui/block-result/issue-20862.stderr
deleted file mode 100644
index 37bad64c5bf..00000000000
--- a/src/test/ui/block-result/issue-20862.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/issue-20862.rs:2:5
-   |
-LL | fn foo(x: i32) {
-   |                - help: a return type might be missing here: `-> _`
-LL |     |y| x + y
-   |     ^^^^^^^^^ expected `()`, found closure
-   |
-   = note: expected unit type `()`
-                found closure `[closure@$DIR/issue-20862.rs:2:5: 2:8]`
-
-error[E0618]: expected function, found `()`
-  --> $DIR/issue-20862.rs:7:13
-   |
-LL | fn foo(x: i32) {
-   | -------------- `foo` defined here returns `()`
-...
-LL |     let x = foo(5)(2);
-   |             ^^^^^^---
-   |             |
-   |             call expression requires function
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0308, E0618.
-For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/block-result/issue-22645.rs b/src/test/ui/block-result/issue-22645.rs
deleted file mode 100644
index 5f7fb8dd32b..00000000000
--- a/src/test/ui/block-result/issue-22645.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-use std::ops::Add;
-
-trait Scalar {}
-impl Scalar for f64 {}
-
-struct Bob;
-
-impl<RHS: Scalar> Add <RHS> for Bob {
-  type Output = Bob;
-  fn add(self, rhs : RHS) -> Bob { Bob }
-}
-
-fn main() {
-  let b = Bob + 3.5;
-  b + 3 //~ ERROR E0277
-  //~^ ERROR: mismatched types
-}
diff --git a/src/test/ui/block-result/issue-22645.stderr b/src/test/ui/block-result/issue-22645.stderr
deleted file mode 100644
index 28debd60a99..00000000000
--- a/src/test/ui/block-result/issue-22645.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0277]: the trait bound `{integer}: Scalar` is not satisfied
-  --> $DIR/issue-22645.rs:15:5
-   |
-LL |   b + 3
-   |     ^ the trait `Scalar` is not implemented for `{integer}`
-   |
-   = help: the trait `Scalar` is implemented for `f64`
-note: required for `Bob` to implement `Add<{integer}>`
-  --> $DIR/issue-22645.rs:8:19
-   |
-LL | impl<RHS: Scalar> Add <RHS> for Bob {
-   |                   ^^^^^^^^^     ^^^
-
-error[E0308]: mismatched types
-  --> $DIR/issue-22645.rs:15:3
-   |
-LL | fn main() {
-   |           - expected `()` because of default return type
-LL |   let b = Bob + 3.5;
-LL |   b + 3
-   |   ^^^^^ expected `()`, found struct `Bob`
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0277, E0308.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/block-result/issue-3563.rs b/src/test/ui/block-result/issue-3563.rs
deleted file mode 100644
index 0b652a1f54b..00000000000
--- a/src/test/ui/block-result/issue-3563.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-trait A {
-    fn a(&self) {
-        || self.b()
-        //~^ ERROR no method named `b` found
-    }
-}
-fn main() {}
diff --git a/src/test/ui/block-result/issue-3563.stderr b/src/test/ui/block-result/issue-3563.stderr
deleted file mode 100644
index be551f6e889..00000000000
--- a/src/test/ui/block-result/issue-3563.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0599]: no method named `b` found for reference `&Self` in the current scope
-  --> $DIR/issue-3563.rs:3:17
-   |
-LL |         || self.b()
-   |                 ^ help: there is a method with a similar name: `a`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/block-result/issue-5500.rs b/src/test/ui/block-result/issue-5500.rs
deleted file mode 100644
index 577987a4596..00000000000
--- a/src/test/ui/block-result/issue-5500.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() {
-    &panic!()
-    //~^ ERROR mismatched types
-    //~| expected unit type `()`
-    //~| found reference `&_`
-    //~| expected `()`, found reference
-}
diff --git a/src/test/ui/block-result/issue-5500.stderr b/src/test/ui/block-result/issue-5500.stderr
deleted file mode 100644
index 211a6052864..00000000000
--- a/src/test/ui/block-result/issue-5500.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/issue-5500.rs:2:5
-   |
-LL | fn main() {
-   |           - expected `()` because of default return type
-LL |     &panic!()
-   |     ^^^^^^^^^ expected `()`, found reference
-   |
-   = note: expected unit type `()`
-              found reference `&_`
-help: consider removing the borrow
-   |
-LL -     &panic!()
-LL +     panic!()
-   |
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/block-result/unexpected-return-on-unit.rs b/src/test/ui/block-result/unexpected-return-on-unit.rs
deleted file mode 100644
index 2fcbfe8c068..00000000000
--- a/src/test/ui/block-result/unexpected-return-on-unit.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Test that we do some basic error correction in the tokeniser (and don't spew
-// too many bogus errors).
-
-fn foo() -> usize {
-    3
-}
-
-fn bar() {
-    foo() //~ ERROR mismatched types
-}
-
-fn main() {
-    bar()
-}
diff --git a/src/test/ui/block-result/unexpected-return-on-unit.stderr b/src/test/ui/block-result/unexpected-return-on-unit.stderr
deleted file mode 100644
index 4acb955a8e7..00000000000
--- a/src/test/ui/block-result/unexpected-return-on-unit.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/unexpected-return-on-unit.rs:9:5
-   |
-LL |     foo()
-   |     ^^^^^ expected `()`, found `usize`
-   |
-help: consider using a semicolon here
-   |
-LL |     foo();
-   |          +
-help: try adding a return type
-   |
-LL | fn bar() -> usize {
-   |          ++++++++
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.