-
Notifications
You must be signed in to change notification settings - Fork 3
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
HashMap should be more widely usable #11
Comments
I think there's an issue for better handling of default type parameters, but I can't find it right now. |
There is. But I rather not wait for such language change when we can just move it into |
That would mean that users of |
@jethrogb Yes. But that's no worse than today when its not even available in |
@Ericson2314 @jethrogb A newtype could have worked, but now the default type alias should work today. Is there anything blocking this today? |
type aliases cannot have default type parameters. |
@Ericson2314 Er. I use this feature often.
|
Woah I didn't know that was even allowed in stable Rust. @eddyb? Still there are issues: pub type Result<T, E = ()> = core::result::Result<T, E>;
fn main() {
Ok(());
// fn asdf<E = ()>() -> Result<(), E> { Ok(()) }
//asdf();
println!("Hello, world!");
}
|
@Ericson2314 Of course that Indeed functions don't get this treat, but for all that it matters for |
@Ericson2314 I must admit I was surprised to find the following doesn't work.
Edit: Although you can't use |
To not break compat, we have to default those method type vars taken from the inherent impl. This isn't possible. We don't have the same problem with variant constructurs since HashMap has none exposed, but if it did that would be the same problem. |
I would recommend anyone wanting to use |
That's a good idea if you don't need to worry about other libraries consuming a hash map. My RFC rust-lang/rfcs#2492, which will hopefully get more consideration after the Rust 2018 crunch, would get us a way to defer the definition of the default so the main one can be moved. (And I'd hope the general thrust of the portability push would allows @Amanieu's alternative hashmaps and locks to be substituted in custom-built standard libraries easily so that they can be used more widely.) |
I hope that I'm not out-of-line in contributing to this conversation given that Let me just suggest that it's helpful to the users if we can avoid letting perfect Even if lang_items are ugly and the proliferation of lang_items From the point of view of my company:
The inability to move Intel SGX Enclaves seems at a high level to be the perfect application
then there's a point at which engineers start to say it would be simpler and Anyways -- I hope I've made my point without being too annoying. I want to thank |
@cbeck88 the biggest delay is not due to the scope of that RFC but due to the limit bandwidth of the core team. Even some sort of lang item fix would have been a long process (RFC, PR, etc...). I'm totally with you that pure things need to work, and big "fameworks" that drag everything do contradict the ideal of fine grained composition and use-only-what-you-need. Hopefully now that 2018 is out, we can get things moving with the RFC. Please comment sharing your usecase there! |
Not at all, all comments are welcome!
In my experience Rust generally favors the status quo in favor of ad-hoc solutions if a general solution is in sight.
It would've been nice too if we had const generics already. The Rust development process is community-driven and as @Ericson2314 mentions the priorities are set by the core team. This issue wasn't first raised 10 months ago (it's just that the Portability WG was formed around that time) but rather many years ago by myself and other people facing the exact same problems you described. I first released the So, the only reason no progress has been made is because of prioritization. Please add your voice to the demand for this feature and hopefully something can be done in the future! (people who don't care about SGX can stop reading here) I'm the author of the Fortanix Rust EDP and the
I agree! That's why I've been working on accomplishing exactly this for over 3 years and have started a company that has made this a reality. For a long time, Fortanix was the only company running Rust & SGX in production. Our considerable experience actually writing and using enclaves has been invaluable in designing the Fortanix Rust EDP and the
I'm not sure what you mean by this exactly, but the Fortanix EDP isn't based on the Intel SGX SDK.
I think you are reading too much into the Swami paper. What he describes (but doesn't cite) are known as Iago attacks and yes careful interface design is needed to avoid such attacks. However, there are even more damning attacks on the userspace-enclave interface, such as https://arxiv.org/abs/1710.09061 . Because getting this interface right is so important (it's the most direct attack surface an attacker can use!), I highly recommend that you do not design it from scratch, lest you run into the same pitfalls as everyone else before you. The
I don't think this is a fair characterization. It sounds like your enclave will largely consist of the memory allocator, the alloc crate which you apparently intend to use and serde. The complexity of those parts is far greater than anything you'd be pulling in alongside it from
I don't understand this argument. Either you need to audit the HashMap implementation, or you don't, but whether you pull it from
It's not clear to me if you intend to use the the Intel SGX SDK here or not, but the “trusted” parts of that cloc in at about 60000 CLOC of unsafe code! The
Depending on your usecase, this could in and of itself be a security vulnerability! |
Hi Jethro, Thanks very much for your comments. We are still discussing internally several It is great to hear that the fortanix sgx target is on track to hit stable in |
Fuchsia needs this in order to make Netstack3 no_std. |
I'll just repeat my comment from earlier in this thread:
The standard library |
Ah I missed your comment there, thanks! |
But that only useful for application, If I use this in a library, people can't put the HashMap of std in place of the HashBrown HashMap. |
Right now it can only be used on regular platforms due to the way the default hasher is initialized. This is a such a silly little thing. Yes, it's a one-of issue, but I view it as a good litmus test.
The text was updated successfully, but these errors were encountered: