Announcing Rust 1.16
blog.rust-lang.org
blog.rust-lang.org
If you just want to make sure you code compiles, this is the command for you.
There's also a bunch of API stablilizations around Strings, Vectors etc, complete changelog: https://github.com/rust-lang/rust/blob/master/RELEASES.md#ve...
Congratulations to everyone involved on the release!
Well played, Rust devs, well played. https://imgur.com/a/lK1BQ
The last time I checked Rust didn't support .frameworks creation, didn't support Bitcode and calling the main thread from Rust wasn't easy.
I would love to hear if these issues have been resolved.
Bitcode is tough, see https://github.com/rust-lang/rust/issues/35968
In general, we'd love to get this into better shape, but need some help from people with the time and expertise to hack on it.
To be fair to Rust, it does perfectly what it's supposed to do as a language on iOS/Android. I have a fully multithreaded toy Rust+Swift app that works fine, and the performance is pretty good. Most of the problems I described are due to the differences in the paradigms between Swift/Java and Rust. (OOP vs Functional), and I'm sure things will be fine with time.
Do you have any better approach to JNI calls other than Djinni, SafeJNI, SWIG, RPC-like with bulk of work on Java side?
We use Djinni extensively and it does what it advertises. We've to be careful with retain cycles and Djinni proxies create strong retain cycles if didn't configure correctly.
I'm actively looking into libdispatch for threading. I've heard of people having success with long polling of file/socket and dispatch_source to update main threads from BG on iOS/Android. I'll probably write a blog post if I succeed (and that's a big IF).
Not really, but I am aware of that pattern as it is the approach taken by SDL.
Thanks.
I use this homegrown solution on an Android app of mine which integrates with the CPython interpreter: https://github.com/joaoventura/pybridge/
It is RPC-like, but the code is quite simple: https://github.com/joaoventura/pybridge/#how-it-works. In the java-side, you just create a JSON object, send it to Python-land and get the result. Here's the java example in the code (https://goo.gl/sw4JLt) and here's the python function that it calls (https://goo.gl/hgbqVR).
Don't know if it's what you're looking for, or how it compares to the solutions you mentioned above, but I had someone from dropbox contributing a fix, and mentioning that going forward with a solution like this he would need something similar to djinni regarding error handling: https://github.com/joaoventura/pybridge/pull/3#issuecomment-...
On my specific case it is more weekend programming, mainly focused on graphics and multimedia, so I can bare the ocasional pain for reading image files, being called as a service or interacting with the network related hardware.
Just wanted to have some heads up on other possibilities that I could be missing, from people that do it professionally.
From a purely "how do I get something I can link to" perspective, you can still build a cdylib and a header for it, Xcode will let you include the header in your Objective-C code or in the Swift bridging header, and then you can link to the cdylib and copy it into the "Frameworks" subdirectory in the bundle at build time. I've been doing that in an OS X app for several months and it works out very well.
> calling the main thread from Rust wasn't easy.
If you want to schedule code to run in the main queue/thread/runloop, that's an Apple-specific thing Rust wouldn't be aware of by default, but I did find a wrapper for libdispatch/GCD, and it seems to support calling things on the main queue which should do what you want.
https://crates.io/crates/dispatch
You can also have your app provide a C callback to the Rust code (even a Swift closure with captured variables, with some clever workarounds since you can't do that by default), and then in the callback you can schedule code to run on the main queue/thread if you want.
>You can also have your app provide a C callback to the Rust code
That's exactly what I'm doing, however callbacks become cumbersome after a while, and I don't like that pattern. I need to do MVVM where the View is a thin iOS/Android layer, and the VM is in Rust. Right now there are significant hurdles to keep references from Swift to Rust and vice versa.
What would be the difference though, why make the distinction?
> Dynamic libraries outside of a framework bundle, which typically have the file extension .dylib, are not supported on iOS, watchOS, or tvOS, except for the system Swift libraries provided by Xcode.
https://developer.apple.com/library/content/technotes/tn2435...
Thanks.
my only concern is bitcode support, not feasible now due to a version mismatch between apple's llvm and rust's llvm (you can emit bitcode with rustc). which means currently you can ship apps for iOS, but not watchOS or tvOS.
(my use case of rust is DSP / audio synthesis)
I am willing to dedicate some amount of my own time to make it happen but am not convinced that my skills [2] and the amount of time I have available to spend is sufficient to make a difference.
In general, the differences between Tier 2 and Tier 1 are:
1. Get tests running on every commit.
2. Gate building on those tests passing.
The first is a technical/money issue, the latter is a social issue. That is, getting all tests working is technical, being able to afford running them on every commit is monetary, but gating builds on failures on a platform is an issue of "who is responsible for making sure things stay passing."
Given that we run these tests on every commit, in some sense, it would be the PR author's job, but if they get stuck, we need someone who's able to help them fix that. That is the hardest part of moving from tier 2 to tier 1 in my personal opinion. Who is that person? What happens if they drop off the project?
I would have liked to volunteer as the kind of person that would investigate issues for the FreeBSD platform but as I said, both my skills and my time are limited to the extent that they might not be sufficient.
As for what happens if the person responsible for this drops off the project, I think the solution to that is not so complicated; demote the platform back to tier 2 until someone else (if anyone ever) steps up to take over the responsibility.
I expect that your situation isn't uncommon, maybe the solution is two or three people rather than one. Raises that bar though...
Sounds like a good idea to me. Personally I would be willing to work with a couple of other volunteers as long as we were able to get along.
The next tier 1 is going to be ARM, probably for both Android and Linux, and then I personally don't see any others on the horizon. I actually see our tiers being redefined soon to be more graduated, and not have so many tier 2 commitments (we're happy to build artifacts for obscure platforms, less happy to be on the hook for guaranteeing obscure platforms continue to build - not saying FreeBSD specifically is 'obscure').
That said, the differences between tier 1 and tier 2 are not so great. If a platform has testing on CI then it is pretty close to tier 1, even if it's technically tier 2. The problem here is that testing the FreeBSD targets requires running FreeBSD in some way and that has been hard for our CI to do. Anything that can be crossed from Linux is easy, everything else is a painful special case. So with FreeBSD we do the the cross-building, but not the cross-testing. So the most effective thing to do to take Rust FreeBSD support to the next level is to figure out a way to get the CI to run tests.
There may be opportunities in the future for paid Rust platform support, where if a motivated party donates the right amount of money, we'll make it happen. I think that will have to happen to get some of the remaining platforms up to production quality.
If I were to set up my own FreeBSD buildbot for commits to the Rust repos, would result reports from my buildbot be welcome? Would automatic reports be useful to you, or should I manually inspect failures and write up a bug report / pull request with fixes for issues that arise? If automatic, how could I best integrate reports of failure with your development process for Rust?
>There may be opportunities in the future for paid Rust platform support, where if a motivated party donates the right amount of money, we'll make it happen. I think that will have to happen to get some of the remaining platforms up to production quality.
I like this idea though I don't have a lot of money to spend myself currently.
We have a "meta CI" system called bors/homu that integrates with other CI, currently Travis and AppVeyor. bors works with any service that can post a result to a GitHub PR.
So the plan for supporting further architectures is to create a small custom runner that builds, tests and posts to the PR. That code does not exist yet, but if it appeared there are likely several upcoming architectures that could make use of it.
With that tool, we could allow contributors to set up their own integration bots and hook into our CI.
If anyone is interested, it'd probably be quite easy to adapt for running rust tests inside a FreeBSD vm:
https://evilpiepirate.org/git/ktest.git
If anyone is interested I'd be happy to walk someone through what it does and what parts you'd want.
https://github.com/rust-lang-nursery/rls
https://github.com/jonathandturner/rls_vscode
For some reason, code completion via Racer doesn't work yet for me via RLS, so I use the "old" RustyCode extension for that (https://github.com/saviorisdead/RustyCode).
The feature is designed so that incremental typechecking can happen—it just doesn't yet.
"The attribute `export_macro` is currently unknown to the compiler" - what a surprise in beta 1.17.
That said, regressions happen, which is why beta exists. If you find them, please file them!
What I can't wait for is Tokio for Diesel and Rocket.
[1] https://github.com/SergioBenitez/Rocket/tree/master/examples
Usually this means you want to build things build on arrays.
>The problem with mmapped files is that they don't always appear at the same address
i.e. you use arrays and then index into the array instead of using pointers.
> So in order to use the standard data-structures, Rust must provide some mechanism to make this possible
Well, arrays exist in Rust. Or you're going to have to be more specific about what you're trying to do.
I want to allocate arrays, maps, etcetera inside the region of a memory mapped file. Then, later, when I mmap the same file to a different region in memory, I want the arrays and maps to still work. That's all.
I imagine this will be possible once the custom allocators work sorts out.
The allocators and data structures would need to support using non-raw-pointer pointers types, including not even platform-pointer sized types.
You could probably get pretty far by copy pasting the standard library containers you're interested in and replace Box with something like OffsetBox which uses indices into your memmap arena instead of pointers to any addressable memory. Of course, implementing OffsetBox is an exercise for the reader. :)
You would probably have to write some unsafe code to get it to work. But it's not a blocker for a project.
After some searching, I found that Microsoft Visual Studio supports something similar, and exactly for the application I had in mind: [1].
Edit: so it was 1.15! I've been running 1.14 on my laptop and didn't realize it!
Thank you!
You mean people dedicated to releases, or just that everyone must cut off an appendage to join the team? :)
$ rustup update stable
Nah. The old "rustup.sh" script doesn't install "rustup", the application.Rust isn't in the Ubuntu distribution, either.
Stop rolling your own installer and use the distro programs. You are not a special snowflake.
rustup.sh has been deprecated for months now.
> Rust isn't in the Ubuntu distribution, either.
It's in Debian now, so (as far as I know) that means it should end up in Ubuntu soonish.
> Stop rolling your own installer and use the distro programs.
Not everyone is on Linux.
Cargo in Debian, on the other hand, is stuck on 0.15.0... (current version for "stable rust" is 0.17.0) ; no newer version in experimental...
Now that we've gotten a lot of the kinks worked out, hopefully it won't be weeks in the future.
That said, Ubuntu does carry (an obsolete version of) Rust: http://packages.ubuntu.com/search?keywords=rustc&searchon=na...