Skip to content

Commit c4eb1bf

Browse files
popzxcfmease
andcommitted
Do not use const { } blocks for GCI
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
1 parent 73e44e8 commit c4eb1bf

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/doc/unstable-book/src/language-features/generic-const-items.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ See also: [generic_const_exprs], [min_generic_const_args].
2525
#![allow(incomplete_features)]
2626
#![feature(generic_const_items)]
2727

28-
const GENERIC_VAL<const ARG: usize>: usize = const { ARG + 1 };
28+
const GENERIC_VAL<const ARG: usize>: usize = ARG + 1;
2929

3030
#[test]
3131
fn generic_const_arg() {
@@ -41,13 +41,7 @@ fn generic_const_arg() {
4141
#![feature(generic_const_items)]
4242

4343
// `GENERIC_VAL::<0>` will fail to compile
44-
const GENERIC_VAL<const ARG: usize>: usize = const {
45-
if ARG > 0 {
46-
ARG + 1
47-
} else {
48-
panic!("0 value")
49-
}
50-
};
44+
const GENERIC_VAL<const ARG: usize>: usize = if ARG > 0 { ARG + 1 } else { panic!("0 value") };
5145

5246
// Will fail to compile if the `Copy` derive is removed.
5347
const COPY_MARKER<C: Copy>: () = ();

0 commit comments

Comments
 (0)