From a0aa2307322cd47bbf416810ac0292925e03be87 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 19:39:49 +0200 Subject: Adding upstream version 1:7.0.3. Signed-off-by: Daniel Baumann --- rust/vendor/rustversion/tests/test_const.rs | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 rust/vendor/rustversion/tests/test_const.rs (limited to 'rust/vendor/rustversion/tests/test_const.rs') diff --git a/rust/vendor/rustversion/tests/test_const.rs b/rust/vendor/rustversion/tests/test_const.rs new file mode 100644 index 0000000..3c4f7d5 --- /dev/null +++ b/rust/vendor/rustversion/tests/test_const.rs @@ -0,0 +1,39 @@ +#![allow(clippy::semicolon_if_nothing_returned)] // https://github.com/rust-lang/rust-clippy/issues/7324 + +#[rustversion::attr(all(), const)] +fn _basic() {} +const _BASIC: () = _basic(); + +#[rustversion::attr(all(), const)] +unsafe fn _unsafe() {} +const _UNSAFE: () = unsafe { _unsafe() }; + +macro_rules! item { + ($i:item) => { + #[rustversion::attr(all(), const)] + $i + }; +} + +item! {fn _item() {}} +const _ITEM: () = _item(); + +macro_rules! ident { + ($fn:ident) => { + #[rustversion::attr(all(), const)] + $fn _ident() {} + }; +} + +ident! {fn} +const _IDENT: () = _ident(); + +#[rustversion::attr(all(), const)] +/// doc +fn _doc_below() {} +const _DOC_BELOW: () = _doc_below(); + +/// doc +#[rustversion::attr(all(), const)] +fn _doc_above() {} +const _DOC_ABOVE: () = _doc_above(); -- cgit v1.2.3