Skip to content

Commit

Permalink
Fix macro hygiene
Browse files Browse the repository at this point in the history
Re-export Ok and Err
  • Loading branch information
teohhanhui committed Jul 12, 2023
1 parent 0fc3101 commit 74ffb04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ mod macros;
#[cfg(feature = "macro-diagnostics")]
pub extern crate uuid_macro_internal;

#[doc(hidden)]
pub mod __macro_support {
pub use crate::std::result::Result::{Err, Ok};
}

use crate::std::convert;

pub use crate::{builder::Builder, error::Error};
Expand Down
4 changes: 2 additions & 2 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ macro_rules! define_uuid_macro {
macro_rules! uuid {
($uuid:literal) => {{
const OUTPUT: $crate::Uuid = match $crate::Uuid::try_parse($uuid) {
Ok(u) => u,
Err(_) => {
$crate::__macro_support::Ok(u) => u,
$crate::__macro_support::Err(_) => {
// here triggers const_err
// const_panic requires 1.57
#[allow(unconditional_panic)]
Expand Down

0 comments on commit 74ffb04

Please sign in to comment.