diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/crashes/133597.rs | 11 | ||||
| -rw-r--r-- | tests/debuginfo/empty-string.rs | 2 | ||||
| -rw-r--r-- | tests/debuginfo/msvc-pretty-enums.rs | 2 | ||||
| -rw-r--r-- | tests/debuginfo/pretty-std.rs | 3 | ||||
| -rw-r--r-- | tests/debuginfo/strings-and-strs.rs | 2 | ||||
| -rw-r--r-- | tests/ui/feature-gates/feature-gate-never_patterns.stderr | 35 | ||||
| -rw-r--r-- | tests/ui/parser/macro/macro-expand-to-match-arm.stderr | 7 | ||||
| -rw-r--r-- | tests/ui/parser/match-arm-without-body.stderr | 56 | ||||
| -rw-r--r-- | tests/ui/unboxed-closures/existential-printing.rs | 8 | ||||
| -rw-r--r-- | tests/ui/unboxed-closures/existential-printing.stderr | 17 | ||||
| -rw-r--r-- | tests/ui/unpretty/debug-fmt-hir.rs | 26 | ||||
| -rw-r--r-- | tests/ui/unpretty/debug-fmt-hir.stdout | 25 | ||||
| -rw-r--r-- | tests/ui/unpretty/self-hir.rs | 14 | ||||
| -rw-r--r-- | tests/ui/unpretty/self-hir.stdout | 18 |
14 files changed, 197 insertions, 29 deletions
diff --git a/tests/crashes/133597.rs b/tests/crashes/133597.rs deleted file mode 100644 index f716d5e7bc7..00000000000 --- a/tests/crashes/133597.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ known-bug: #133597 - -pub trait Foo2 { - fn boxed<'a: 'a>() -> impl Sized + FnOnce<()>; -} - -impl Foo2 for () {} - - -fn f() -> impl FnOnce<()> { || () } -fn main() { () = f(); } diff --git a/tests/debuginfo/empty-string.rs b/tests/debuginfo/empty-string.rs index 014465c27ca..6cf61e17771 100644 --- a/tests/debuginfo/empty-string.rs +++ b/tests/debuginfo/empty-string.rs @@ -17,7 +17,7 @@ // lldb-command:run // lldb-command:fr v empty_string -// lldb-check:[...] empty_string = "" { vec = size=0 } +// lldb-check:[...] empty_string = "" // lldb-command:fr v empty_str // lldb-check:[...] empty_str = "" diff --git a/tests/debuginfo/msvc-pretty-enums.rs b/tests/debuginfo/msvc-pretty-enums.rs index d60a7b81944..06bc25dc5d5 100644 --- a/tests/debuginfo/msvc-pretty-enums.rs +++ b/tests/debuginfo/msvc-pretty-enums.rs @@ -30,7 +30,7 @@ // lldb-check:(msvc_pretty_enums::CStyleEnum) j = High // lldb-command:v k -// lldb-check:(core::option::Option<alloc::string::String>) k = { value = { 0 = "IAMA optional string!" { vec = size=21 { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 'o' [6] = 'p' [7] = 't' [8] = 'i' [9] = 'o' [10] = 'n' [11] = 'a' [12] = 'l' [13] = ' ' [14] = 's' [15] = 't' [16] = 'r' [17] = 'i' [18] = 'n' [19] = 'g' [20] = '!' } } } } +// lldb-check:(core::option::Option<alloc::string::String>) k = { value = { 0 = "IAMA optional string!" { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 'o' [6] = 'p' [7] = 't' [8] = 'i' [9] = 'o' [10] = 'n' [11] = 'a' [12] = 'l' [13] = ' ' [14] = 's' [15] = 't' [16] = 'r' [17] = 'i' [18] = 'n' [19] = 'g' [20] = '!' } } } // lldb-command:v l // lldb-check:(core::result::Result<u32, msvc_pretty_enums::Empty>) l = { value = { 0 = {} } } diff --git a/tests/debuginfo/pretty-std.rs b/tests/debuginfo/pretty-std.rs index d7c640a5bea..53835d41be2 100644 --- a/tests/debuginfo/pretty-std.rs +++ b/tests/debuginfo/pretty-std.rs @@ -51,7 +51,8 @@ // lldb-check:[...] str_slice = "IAMA string slice!" { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 's' [6] = 't' [7] = 'r' [8] = 'i' [9] = 'n' [10] = 'g' [11] = ' ' [12] = 's' [13] = 'l' [14] = 'i' [15] = 'c' [16] = 'e' [17] = '!' } // lldb-command:v string -// lldb-check:[...] string = "IAMA string!" { vec = size=12 { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 's' [6] = 't' [7] = 'r' [8] = 'i' [9] = 'n' [10] = 'g' [11] = '!' } } +// lldb-check:[...] string = "IAMA string!" { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 's' [6] = 't' [7] = 'r' [8] = 'i' [9] = 'n' [10] = 'g' [11] = '!' } + // lldb-command:v some // lldb-check:[...] some = Some(8) diff --git a/tests/debuginfo/strings-and-strs.rs b/tests/debuginfo/strings-and-strs.rs index 543e74e1744..7d550408bec 100644 --- a/tests/debuginfo/strings-and-strs.rs +++ b/tests/debuginfo/strings-and-strs.rs @@ -24,7 +24,7 @@ // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v plain_string -// lldb-check:(alloc::string::String) plain_string = "Hello" { vec = size=5 { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } } +// lldb-check:(alloc::string::String) plain_string = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } // lldb-command:v plain_str // lldb-check:(&str) plain_str = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } diff --git a/tests/ui/feature-gates/feature-gate-never_patterns.stderr b/tests/ui/feature-gates/feature-gate-never_patterns.stderr index dcd5db56da8..473e263c796 100644 --- a/tests/ui/feature-gates/feature-gate-never_patterns.stderr +++ b/tests/ui/feature-gates/feature-gate-never_patterns.stderr @@ -58,19 +58,34 @@ error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:38:9 | LL | Some(_) - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => { todo!() } + | ++++++++++++++ error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:43:9 | LL | Some(_) if false, - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^^^^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) if false => { todo!() }, + | ++++++++++++++ error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:45:9 | LL | Some(_) if false - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^^^^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) if false => { todo!() } + | ++++++++++++++ error[E0658]: `!` patterns are experimental --> $DIR/feature-gate-never_patterns.rs:50:13 @@ -96,13 +111,23 @@ error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:64:9 | LL | Some(_) - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => { todo!() } + | ++++++++++++++ error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:70:9 | LL | Some(_) if false - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^^^^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) if false => { todo!() } + | ++++++++++++++ error: a guard on a never pattern will never be run --> $DIR/feature-gate-never_patterns.rs:54:19 diff --git a/tests/ui/parser/macro/macro-expand-to-match-arm.stderr b/tests/ui/parser/macro/macro-expand-to-match-arm.stderr index 1927d80fd72..702e76d59f9 100644 --- a/tests/ui/parser/macro/macro-expand-to-match-arm.stderr +++ b/tests/ui/parser/macro/macro-expand-to-match-arm.stderr @@ -14,7 +14,12 @@ error: `match` arm with no body --> $DIR/macro-expand-to-match-arm.rs:14:9 | LL | arm!(None => {}), - | ^^^^^^^^^^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^^^^^^^^^^ + | +help: add a body after the pattern + | +LL | arm!(None => {}) => { todo!() }, + | ++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/match-arm-without-body.stderr b/tests/ui/parser/match-arm-without-body.stderr index 9df8485972f..a65875b787a 100644 --- a/tests/ui/parser/match-arm-without-body.stderr +++ b/tests/ui/parser/match-arm-without-body.stderr @@ -68,49 +68,89 @@ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:7:9 | LL | Some(_) - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) => { todo!() } + | ++++++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:30:9 | LL | Some(_) if true - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^^^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) if true => { todo!() } + | ++++++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:40:9 | LL | Some(_) if true, - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^^^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) if true => { todo!() }, + | ++++++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:45:9 | LL | Some(_) if true, - | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^^^^^^^^^ + | +help: add a body after the pattern + | +LL | Some(_) if true => { todo!() }, + | ++++++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:51:9 | LL | pat!() - | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^ + | +help: add a body after the pattern + | +LL | pat!() => { todo!() } + | ++++++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:56:9 | LL | pat!(), - | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^ + | +help: add a body after the pattern + | +LL | pat!() => { todo!() }, + | ++++++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:61:9 | LL | pat!() if true, - | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^^^^^^^^^ + | +help: add a body after the pattern + | +LL | pat!() if true => { todo!() }, + | ++++++++++++++ error: `match` arm with no body --> $DIR/match-arm-without-body.rs:72:9 | LL | pat!(), - | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + | ^^^^^^ + | +help: add a body after the pattern + | +LL | pat!() => { todo!() }, + | ++++++++++++++ error: aborting due to 13 previous errors diff --git a/tests/ui/unboxed-closures/existential-printing.rs b/tests/ui/unboxed-closures/existential-printing.rs new file mode 100644 index 00000000000..f4337320209 --- /dev/null +++ b/tests/ui/unboxed-closures/existential-printing.rs @@ -0,0 +1,8 @@ +// Make sure we don't ICE printing `impl AsyncFnOnce<()>`. + +#![feature(unboxed_closures, fn_traits)] + +fn f() -> impl FnOnce<()> { || () } + +fn main() { () = f(); } +//~^ ERROR mismatched types diff --git a/tests/ui/unboxed-closures/existential-printing.stderr b/tests/ui/unboxed-closures/existential-printing.stderr new file mode 100644 index 00000000000..95de98878af --- /dev/null +++ b/tests/ui/unboxed-closures/existential-printing.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/existential-printing.rs:7:13 + | +LL | fn f() -> impl FnOnce<()> { || () } + | --------------- the expected opaque type +LL | +LL | fn main() { () = f(); } + | ^^ --- this expression has type `impl FnOnce<()>` + | | + | expected opaque type, found `()` + | + = note: expected opaque type `impl FnOnce<()>` + found unit type `()` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/unpretty/debug-fmt-hir.rs b/tests/ui/unpretty/debug-fmt-hir.rs new file mode 100644 index 00000000000..c19f3c4c0c5 --- /dev/null +++ b/tests/ui/unpretty/debug-fmt-hir.rs @@ -0,0 +1,26 @@ +//@ compile-flags: -Zunpretty=hir +//@ check-pass + +use std::fmt; + +pub struct Bar { + a: String, + b: u8, +} + +impl fmt::Debug for Bar { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + debug_struct_field2_finish(f, "Bar", "a", &self.a, "b", &&self.b) + } +} + +fn debug_struct_field2_finish<'a>( + name: &str, + name1: &str, + value1: &'a dyn fmt::Debug, + name2: &str, + value2: &'a dyn fmt::Debug, +) -> fmt::Result +{ + loop {} +} diff --git a/tests/ui/unpretty/debug-fmt-hir.stdout b/tests/ui/unpretty/debug-fmt-hir.stdout new file mode 100644 index 00000000000..2c9c96de9d1 --- /dev/null +++ b/tests/ui/unpretty/debug-fmt-hir.stdout @@ -0,0 +1,25 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +//@ compile-flags: -Zunpretty=hir +//@ check-pass + +use std::fmt; + +struct Bar { + a: String, + b: u8, +} + +impl fmt::Debug for Bar { + fn fmt(&self, f: &'_ mut fmt::Formatter<'_>) + -> + fmt::Result { + debug_struct_field2_finish(f, "Bar", "a", &self.a, "b", &&self.b) + } +} + +fn debug_struct_field2_finish<'a>(name: &'_ str, name1: &'_ str, + value1: &'a dyn fmt::Debug, name2: &'_ str, value2: &'a dyn fmt::Debug) + -> fmt::Result { loop { } } diff --git a/tests/ui/unpretty/self-hir.rs b/tests/ui/unpretty/self-hir.rs new file mode 100644 index 00000000000..448d828d444 --- /dev/null +++ b/tests/ui/unpretty/self-hir.rs @@ -0,0 +1,14 @@ +//@ compile-flags: -Zunpretty=hir +//@ check-pass + +pub struct Bar { + a: String, + b: u8, +} + +impl Bar { + fn imm_self(self) {} + fn mut_self(mut self) {} + fn refimm_self(&self) {} + fn refmut_self(&mut self) {} +} diff --git a/tests/ui/unpretty/self-hir.stdout b/tests/ui/unpretty/self-hir.stdout new file mode 100644 index 00000000000..4da080dc611 --- /dev/null +++ b/tests/ui/unpretty/self-hir.stdout @@ -0,0 +1,18 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +//@ compile-flags: -Zunpretty=hir +//@ check-pass + +struct Bar { + a: String, + b: u8, +} + +impl Bar { + fn imm_self(self) { } + fn mut_self(mut self) { } + fn refimm_self(&self) { } + fn refmut_self(&mut self) { } +} |
