Skip to content
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

Remove using void to bypass ICE #1295

Merged
merged 1 commit into from
Nov 6, 2019
Merged

Remove using void to bypass ICE #1295

merged 1 commit into from
Nov 6, 2019

Conversation

tomaka
Copy link
Member

@tomaka tomaka commented Nov 5, 2019

It turns out that nightly Rust ICEs when using enum with zero variants.
See rust-lang/rust#65462

We were hoping that this ICE would eventually be fixed, but it's about to hit stable and it still isn't fix.

The solution now is unfortunately to remove using empty enums from our API.

Should be merged before #1294

@Demi-Marie
Copy link
Contributor

@tomaka We can implement Void differently:

mod void {
	pub struct Void(());
	pub fn absurd(_i: Void) -> ! {
		// This could just as well be an unchecked, unsafe unreachable
		unreachable!("void cannot be constructed");
	}
}

This works because void::Void has a private constructor, so it cannot actually be constructed.

@tomaka
Copy link
Member Author

tomaka commented Nov 5, 2019

@demimarie-parity I'm kind of hesitating to keep Void at all. We used it because we thought that ! was being stabilized and that we could replace Void with ! briefly in the future. It turned out that ! isn't stable yet.

@Demi-Marie
Copy link
Contributor

@tomaka In that case, can you go ahead and merge this and #1294?

@tomaka tomaka merged commit 96699a4 into libp2p:master Nov 6, 2019
@tomaka tomaka deleted the bypass-ice branch November 6, 2019 08:20
tomaka added a commit to tomaka/libp2p-rs that referenced this pull request Nov 6, 2019
tomaka added a commit that referenced this pull request Nov 6, 2019
* Implement Debug for (ed25519|secp256k1)::(Keypair|SecretKey) (#1285)

* Fix possible arithmetic overflow in libp2p-kad. (#1291)

When the number of active queries exceeds the (internal)
JOBS_MAX_QUERIES limit, which is only supposed to bound
the number of concurrent queries relating to background
jobs, an arithmetic overflow occurs. This is fixed by
using saturating subtraction.

* protocols/plaintext: Add example on how to upgrade with PlainTextConfig1 (#1286)

* [mdns] - Support for long mDNS names (Bug #1232) (#1287)

* Dead code -- commenting out with a note referencing future implementation

* Adding "std" feature so that cargo can build in other directories (notably `misc/mdns`, so that I could run these tests)

* Permitting `PeerID` to be built from an `Identity` multihash

* The length limit for DNS labels is 63 characters, as per RFC1035

* Allocates the vector with capacity for the service name plus additional QNAME encoding bytes

* Added support for encoding/decoding peer IDs with an encoded length greater than 63 characters

* Removing "std" from ring features

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>

* Retaining MAX_INLINE_KEY_LENGTH with comment about future usage

* `segment_peer_id` consumes `peer_id` ... plus an early return for IDs that don't need to be segmented

* Fixing logic

* Bump most dependencies (#1268)

* Bump most dependencies

This actually builds 😊.

* Bump all dependencies

Includes the excellent work of @rschulman in #1265.

* Remove use of ed25519-dalek fork

* Monomorphize more dependencies

* Add compatibility hack for rand

Cargo allows a crate to depend on multiple versions of another, but
`cargo-web` panics in that situation.  Use a wrapper crate to work
around the panic.

* Use @tomaka’s idea for using a newer `rand`

instead of my own ugly hack.

* Switch to Parity master

as its dependency-bumping PR has been merged.

* Update some depenendencies again

* Remove unwraps and `#[allow(deprecated)]`.

* Remove spurious changes to dependencies

Bumping minor or patch versions is not needed, and increases likelyhood
of merge conflicts.

* Remove some redundant Cargo.toml changes

* Replace a retry loop with an expect

`ed25519::SecretKey::from_bytes` will never fail for 32-byte inputs.

* Revert changes that don’t belong in this PR

* Remove using void to bypass ICE (#1295)

* Publish 0.13.0 (#1294)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants