diff options
| author | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-05 09:13:28 +0100 |
|---|---|---|
| committer | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-11 09:32:08 +0000 |
| commit | cf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch) | |
| tree | 40a88d9a46aaf3e8870676eb2538378b75a263eb /tests/ui/consts/const-pattern-not-const-evaluable.rs | |
| parent | ca855e6e42787ecd062d81d53336fe6788ef51a9 (diff) | |
| download | rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip | |
Move /src/test to /tests
Diffstat (limited to 'tests/ui/consts/const-pattern-not-const-evaluable.rs')
| -rw-r--r-- | tests/ui/consts/const-pattern-not-const-evaluable.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/consts/const-pattern-not-const-evaluable.rs b/tests/ui/consts/const-pattern-not-const-evaluable.rs new file mode 100644 index 00000000000..dae5343fe30 --- /dev/null +++ b/tests/ui/consts/const-pattern-not-const-evaluable.rs @@ -0,0 +1,30 @@ +// build-pass (FIXME(62277): could be check-pass?) + +#[derive(PartialEq, Eq)] +enum Cake { + BlackForest, + Marmor, +} +use Cake::*; + +struct Pair<A, B>(A, B); + +const BOO: Pair<Cake, Cake> = Pair(Marmor, BlackForest); +const FOO: Cake = BOO.1; + +const fn foo() -> Cake { + Marmor +} + +const WORKS: Cake = Marmor; + +const GOO: Cake = foo(); + +fn main() { + match BlackForest { + FOO => println!("hi"), + GOO => println!("meh"), + WORKS => println!("möp"), + _ => println!("bye"), + } +} |
