New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl_stable_hash_for: support enums and tuple structs with generic parameters #55722

Merged
merged 1 commit into from Nov 14, 2018

Conversation

Projects
None yet
4 participants
@RalfJung
Member

RalfJung commented Nov 6, 2018

Port a bunch of implementations over to the macro, now that that is possible.

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 6, 2018

r? @varkor

(rust_highfive has picked a reviewer for you, use r? to override)

// twice for this purpose
(impl<$($lt:lifetime $(: $lt_bound:lifetime)* ),* $(,)* $($T:ident),* $(,)*>
for enum $enum_name:path
[ $enum_path:path ]

This comment has been minimized.

@varkor

varkor Nov 6, 2018

Member

This does seem a little unfortunate.

This comment has been minimized.

@RalfJung

RalfJung Nov 6, 2018

Member

Yeah I tried hard to avoid it, but I just found no way. You cannot concatenate to a path in macros, nor did I find a way to convert a tt into a path.

I tried using a keyword as separator between the two paths, or @, but the compiler rejected everything. I basically randomly tried separators and brackets were the first one that worked.^^

@varkor

This comment has been minimized.

Member

varkor commented Nov 6, 2018

This seems like a clear win, even if it does require repeating the enum name for the variants.

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented Nov 6, 2018

📌 Commit db3c69e has been approved by varkor

kennytm added a commit to kennytm/rust that referenced this pull request Nov 8, 2018

Rollup merge of rust-lang#55722 - RalfJung:impl-stable-hash, r=varkor
impl_stable_hash_for: support enums and tuple structs with generic parameters

Port a bunch of implementations over to the macro, now that that is possible.

bors added a commit that referenced this pull request Nov 8, 2018

Auto merge of #55789 - kennytm:rollup, r=kennytm
Rollup of 16 pull requests

Successful merges:

 - #54993 (Support for the program data address space option of LLVM's Target Datalayout)
 - #55576 (Clarify error message for -C opt-level)
 - #55638 (Fix ICE in msg_span_from_free_region on ReEmpty)
 - #55650 (Implement rotate using funnel shift on LLVM >= 7)
 - #55672 (miri: accept extern types in structs if they are the only field)
 - #55719 (Sidestep link error from rustfix'ed code by using a *defined* static.)
 - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters)
 - #55736 (Elide anon lifetimes in conflicting impl note)
 - #55739 (Consume optimization fuel from the MIR inliner)
 - #55753 (borrow_set: remove a helper function and a clone it uses)
 - #55755 (Improve creation of 3 IndexVecs)
 - #55758 ([regression - rust2018]: unused_mut lint false positives on nightly)
 - #55760 (Remove intermediate font specs)
 - #55761 (mir: remove a hacky recursive helper function)
 - #55774 (wasm32-unknown-emscripten expects the rust_eh_personality symbol)
 - #55788 (rustc: Request ansi colors if stderr isn't a tty)

Failed merges:

r? @ghost

kennytm added a commit to kennytm/rust that referenced this pull request Nov 13, 2018

Rollup merge of rust-lang#55722 - RalfJung:impl-stable-hash, r=varkor
impl_stable_hash_for: support enums and tuple structs with generic parameters

Port a bunch of implementations over to the macro, now that that is possible.

bors added a commit that referenced this pull request Nov 13, 2018

Auto merge of #55912 - kennytm:rollup, r=kennytm
Rollup of 20 pull requests

Successful merges:

 - #55136 (Remove short doc where it starts with a codeblock)
 - #55711 (Format BtreeMap::range_mut example)
 - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters)
 - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err)
 - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to)
 - #55805 (Move `static_assert!` into librustc_data_structures)
 - #55837 (Make PhantomData #[structural_match])
 - #55840 (Fix TLS errors when downloading stage0)
 - #55843 (add FromIterator<A> to Box<[A]>)
 - #55858 (Small fixes on code blocks in rustdoc)
 - #55863 (Fix a typo in std::panic)
 - #55870 (Fix typos.)
 - #55874 (string: Add documentation for `From` impls)
 - #55879 (save-analysis: Don't panic for macro-generated use globs)
 - #55882 (Reference count `crate_inherent_impls`s return value.)
 - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra)
 - #55889 (global allocators: add a few comments)
 - #55896 (Document optimizations enabled by FusedIterator)
 - #55905 (Change `Lit::short_name` to `Lit::literal_name`.)
 - #55908 (Fix their/there grammar nit)

bors added a commit that referenced this pull request Nov 13, 2018

Auto merge of #55912 - kennytm:rollup, r=kennytm
Rollup of 20 pull requests

Successful merges:

 - #55136 (Remove short doc where it starts with a codeblock)
 - #55711 (Format BtreeMap::range_mut example)
 - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters)
 - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err)
 - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to)
 - #55805 (Move `static_assert!` into librustc_data_structures)
 - #55837 (Make PhantomData #[structural_match])
 - #55840 (Fix TLS errors when downloading stage0)
 - #55843 (add FromIterator<A> to Box<[A]>)
 - #55858 (Small fixes on code blocks in rustdoc)
 - #55863 (Fix a typo in std::panic)
 - #55870 (Fix typos.)
 - #55874 (string: Add documentation for `From` impls)
 - #55879 (save-analysis: Don't panic for macro-generated use globs)
 - #55882 (Reference count `crate_inherent_impls`s return value.)
 - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra)
 - #55889 (global allocators: add a few comments)
 - #55896 (Document optimizations enabled by FusedIterator)
 - #55905 (Change `Lit::short_name` to `Lit::literal_name`.)
 - #55908 (Fix their/there grammar nit)

bors added a commit that referenced this pull request Nov 13, 2018

Auto merge of #55912 - kennytm:rollup, r=kennytm
Rollup of 20 pull requests

Successful merges:

 - #55136 (Remove short doc where it starts with a codeblock)
 - #55711 (Format BtreeMap::range_mut example)
 - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters)
 - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err)
 - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to)
 - #55805 (Move `static_assert!` into librustc_data_structures)
 - #55837 (Make PhantomData #[structural_match])
 - #55840 (Fix TLS errors when downloading stage0)
 - #55843 (add FromIterator<A> to Box<[A]>)
 - #55858 (Small fixes on code blocks in rustdoc)
 - #55863 (Fix a typo in std::panic)
 - #55870 (Fix typos.)
 - #55874 (string: Add documentation for `From` impls)
 - #55879 (save-analysis: Don't panic for macro-generated use globs)
 - #55882 (Reference count `crate_inherent_impls`s return value.)
 - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra)
 - #55889 (global allocators: add a few comments)
 - #55896 (Document optimizations enabled by FusedIterator)
 - #55905 (Change `Lit::short_name` to `Lit::literal_name`.)
 - #55908 (Fix their/there grammar nit)

@bors bors merged commit db3c69e into rust-lang:master Nov 14, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@RalfJung RalfJung deleted the RalfJung:impl-stable-hash branch Nov 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment