-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
src/lib.rs
Outdated
@@ -1,101 +1,57 @@ | |||
#![recursion_limit="128"] | |||
extern crate uuid; | |||
pub use uuid::Uuid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can't have a pub export here...
src/lib.rs
Outdated
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newlines will be fixed by rustfmt so not a worry
Cargo.toml
Outdated
|
||
[features] | ||
default = [] | ||
nightly = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
src/lib.rs
Outdated
|
||
#[cfg(feature = "nightly")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use #[cfg(nightly)]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kinggoesgaming Are you sure #[cfg(nightly)]
really working? I create an new hello-word project with cargo new hello-world --bin
, and modify main.rs :
fn main() {
test();
}
#[cfg(nightly)]
fn test() {
println!("nightly, Hello, world!");
}
#[cfg(not(nightly))]
fn test() {
println!("not nightly, Hello, world!");
}
Run with command cargo +nightly run
,It still prints not nightly, Hello, world!
;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kinggoesgaming yah he is right. I reproduced it here and I'm getting the same output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it works only when you have a mod foo
or extern crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something funky is definitely going on... Imma fiddle around today on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright after going through the mighty google, I seems I was wrong. #[cfg(nightly)]
was discussed at one point, however no resolution... This includes the mod foo
This needs resolution in a way that user does not have to explicitly provide the nightly
feature gate. I will probably use a build script in combination with rustc_version
for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mokeyish see uuid-rs/uuid#220
I think the same setup can be added here (perhaps as a separate PR that is merged before this PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kinggoesgaming what's the issue with providing an explicit feature in order to enable an unstable nightly
Rust feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proceed with the #[cfg(feature = "nightly")]
src/lib.rs
Outdated
{$literal:expr} => { | ||
{ | ||
const BYTES: [u8; 16] = uuid_parts! {$literal}; | ||
$crate::Uuid::from_uuid_bytes(BYTES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it is clear that people need to depend on uuid
, instead use:
{
use uuid;
uuid::Uuid::from_uuid_bytes(BYTES)
}
Cargo.toml
Outdated
[dependencies] | ||
uuid_macro_impl = { path = "./uuid_macro_impl"} | ||
proc-macro-hack = { version = "0.4"} | ||
uuid = { git = "https://github.com/mokeyish/uuid.git", branch = "master" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why depend on the fork?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dylan-DPC Because this have't approved yet. Do you know why about this snapshot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes i know. Just made that note so we remember to switch back to the crate once that is completed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the PR has been merged, so update this...
Note that once we get [email protected]
is released we update this again... (later)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -0,0 +1,23 @@ | |||
[package] | |||
authors = [ | |||
"Hunar Roop Kahlon <[email protected]>", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you forgot me 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops...
218: Add const Uuid::from_uuid_bytes r=kinggoesgaming a=mokeyish <!-- As we are working towards a stable version of uuid, we require that you open an issue, before submitting a pull request. If the pull request is imcomplete, prepend the Title with WIP: --> **I'm submitting a const Uuid::from_uuid_bytes for creating const uuid value.** [ref uuid_macro](uuid-rs/uuid_macro#1) - [ ] bug fix - [x] feature enhancement - [ ] deprecation or removal - [ ] refactor # Description <!-- Provide a summary of your changes in the Title above --> # Motivation <!-- Why is this change required --> # Tests <!-- How are these changes tested? --> # Related Issue(s) <!-- As noted above, we require an issue for every PR. Please link to the issue here --> Co-authored-by: MOKEYISH <[email protected]> Co-authored-by: YISH <[email protected]>
@mokeyish can you update the version of uuid? |
@kinggoesgaming The |
Oh no that managed to slip through... @Dylan-DPC or me will get a new version released to fix that |
@mokeyish update to |
bors r+ |
@mokeyish you can't r+ till all the changes were approved |
|
@kinggoesgaming your previous review looks outdated now. Can you dismiss it and rereview? |
Cargo.toml
Outdated
[dependencies] | ||
uuid_macro_impl = { path = "./uuid_macro_impl"} | ||
proc-macro-hack = { version = "0.4"} | ||
uuid = { version = "0.6.5", features = ["const_fn"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add default-features = false
here as well?
bors r+ |
1: add full uuid macro r=kinggoesgaming a=mokeyish It depend on [ref const Uuid::from_uuid_bytes](uuid-rs/uuid#218) *The example* ```rust extern crate uuid; extern crate uuid_macro; use uuid::Uuid; // if you want to create const uuid value,just enable nightly feature. const CONST_UUID: Uuid = uuid!("936DA01F9ABD4d9d80C702AF85C822A8"); fn main() { let my_uuid = uuid!("936DA01F9ABD4d9d80C702AF85C822A8") println!("Parsed a version {} UUID.", my_uuid.get_version_num()); println!("{}", my_uuid); } ``` Co-authored-by: YISH <[email protected]> Co-authored-by: YISH <[email protected]> Co-authored-by: mokeyish <[email protected]>
Build succeeded |
It depend on ref const Uuid::from_uuid_bytes
The example