Skip to content

Commit

Permalink
Merge pull request #2 from RalfJung/promotion
Browse files Browse the repository at this point in the history
avoid relying on implicit promotion of const fn calls
  • Loading branch information
denisandroid authored Dec 28, 2020
2 parents a8e513a + 7162f3d commit 2b7d093
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,16 @@ macro_rules! raw_one_const {
[$type:ty: $a: expr] => {$a};

[str: $a: expr, $b: expr] => {{
unsafe {
const _HIDDEN: &str = unsafe {
$crate::ignore_feature::const_raw_ptr(
&$crate::raw_one_const!{
u8:
$a.as_bytes(),
$b.as_bytes()
}
)
}
};
_HIDDEN
}};

[str: $a: expr, $($b: expr),*] => {{
Expand All @@ -257,15 +258,16 @@ macro_rules! raw_one_const {

[$type:ty: $a: expr, $b: expr] => {{
#[allow(unused_unsafe)]
unsafe {
const _HIDDEN: [$type; $a.len() + $b.len()] = unsafe {
$crate::const_concat::<
[$type; $a.len()],
[$type; $b.len()],
$type,

[$type; $a.len() + $b.len()],
>($a, $b)
}
};
_HIDDEN
}};

[$type:ty: $a: expr, $($b: expr),*] => {{
Expand Down

0 comments on commit 2b7d093

Please sign in to comment.