diff options
| author | Gary Guo <gary@garyguo.net> | 2022-12-01 17:54:50 +0000 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2022-12-01 17:54:50 +0000 |
| commit | 171b7d62adc6f3c1a58322a8bf92deefd83a118c (patch) | |
| tree | d184d80f2b96af169613f9c579856fa920f3611a /src/test | |
| parent | 9c0bc3028a575eece6d4e8fbc6624cb95b9c9893 (diff) | |
| download | rust-171b7d62adc6f3c1a58322a8bf92deefd83a118c.tar.gz rust-171b7d62adc6f3c1a58322a8bf92deefd83a118c.zip | |
Make inline const block `ExprWithBlock`
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/inline-const/expr-with-block-err.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/inline-const/expr-with-block-err.stderr | 9 | ||||
| -rw-r--r-- | src/test/ui/inline-const/expr-with-block.rs | 10 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/inline-const/expr-with-block-err.rs b/src/test/ui/inline-const/expr-with-block-err.rs new file mode 100644 index 00000000000..f7547742ddc --- /dev/null +++ b/src/test/ui/inline-const/expr-with-block-err.rs @@ -0,0 +1,6 @@ +#![feature(inline_const)] + +fn main() { + const { 2 } - const { 1 }; + //~^ ERROR mismatched types +} diff --git a/src/test/ui/inline-const/expr-with-block-err.stderr b/src/test/ui/inline-const/expr-with-block-err.stderr new file mode 100644 index 00000000000..6f7408f4e2a --- /dev/null +++ b/src/test/ui/inline-const/expr-with-block-err.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/expr-with-block-err.rs:4:13 + | +LL | const { 2 } - const { 1 }; + | ^ expected `()`, found integer + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/inline-const/expr-with-block.rs b/src/test/ui/inline-const/expr-with-block.rs new file mode 100644 index 00000000000..391872476fc --- /dev/null +++ b/src/test/ui/inline-const/expr-with-block.rs @@ -0,0 +1,10 @@ +// check-pass +#![feature(inline_const)] +fn main() { + match true { + true => const {} + false => () + } + const {} + () +} |
