mirror of
https://github.com/uuid-rs/uuid.git
synced 2025-10-01 23:10:58 +00:00
Fix macro hygiene
Re-export Ok and Err
This commit is contained in:
parent
0fc31017a1
commit
1d1ae31e6c
@ -273,6 +273,11 @@ mod macros;
|
|||||||
#[cfg(feature = "macro-diagnostics")]
|
#[cfg(feature = "macro-diagnostics")]
|
||||||
pub extern crate uuid_macro_internal;
|
pub extern crate uuid_macro_internal;
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub mod __macro_support {
|
||||||
|
pub use crate::std::result::Result::{Err, Ok};
|
||||||
|
}
|
||||||
|
|
||||||
use crate::std::convert;
|
use crate::std::convert;
|
||||||
|
|
||||||
pub use crate::{builder::Builder, error::Error};
|
pub use crate::{builder::Builder, error::Error};
|
||||||
|
@ -15,8 +15,8 @@ macro_rules! define_uuid_macro {
|
|||||||
macro_rules! uuid {
|
macro_rules! uuid {
|
||||||
($uuid:literal) => {{
|
($uuid:literal) => {{
|
||||||
const OUTPUT: $crate::Uuid = match $crate::Uuid::try_parse($uuid) {
|
const OUTPUT: $crate::Uuid = match $crate::Uuid::try_parse($uuid) {
|
||||||
Ok(u) => u,
|
$crate::__macro_support::Ok(u) => u,
|
||||||
Err(_) => {
|
$crate::__macro_support::Err(_) => {
|
||||||
// here triggers const_err
|
// here triggers const_err
|
||||||
// const_panic requires 1.57
|
// const_panic requires 1.57
|
||||||
#[allow(unconditional_panic)]
|
#[allow(unconditional_panic)]
|
||||||
|
7
tests/ui/compile_pass/hygiene.rs
Normal file
7
tests/ui/compile_pass/hygiene.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
use uuid::{uuid, Uuid};
|
||||||
|
|
||||||
|
fn Ok() {}
|
||||||
|
|
||||||
|
const _: Uuid = uuid!("00000000-0000-0000-0000-000000000000");
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user