8 ms·
Rust 1.40
- xiphias2 7y agolet x = Bar::Variant { a: 42 }; //~ ERROR Of course it's an error, as Bar doesn't have a field called ,,a''
- mark-simulacrum 7y agoThanks for pointing this out! Unfortunately, unlike most of our docs we don't yet have testing in place for the code examples on the blog. I've just pushed up a fix though so once that propagates this should be fixed.
- penagwin 7y agoI don't personally use Rust (yet) but I love seeing its progress! Congrats to everyone who has been contributing to Rust, it's definitely moving the language forward!
- moksly 7y agoThere hasn’t been a single Rust job posting in the entire region of Denmark where I live in 2019, so it’s probably fair to say that almost no one uses it. The progress is still cool though.
- steveklabnik 7y agoFacebook, Amazon, Google, Microsoft, Dropbox, Cloudflare... it’s still early days overall but there is certainly a significant amount of usage.
- Scarbutt 7y agoSelection bias.
- staticassertion 7y agoNotably, a lot of these companies are not just "playing around" with rust but it is already being used for critical projects. It's pretty difficult to use AWS without touching rust code, for example, and impossible in the case of Dropbox.
- jeltz 7y agoI am not sure that there are any Rust job postings in Sweden either, but I know several people using it on their jobs anyway, e.g. people recruited as C++ developers who work in Rust. I think it is hard to see any trends in smaller languages from job postings since a lot of recruitment is done internally and through contacts.
- steveklabnik 7y agoEmbark Studios is a game studio made up of ex-EA DICE folks, and they're using a ton of Rust! They're in Stockholm.
- nicklauri 7y agoThe main reason is many companies have a lot of C/C++ devs or other devs learned Rust, so they don't have to hire new Rust programmer. There are many places using Rust, you should check this out: https://www.rust-lang.org/production/users https://www.rust-lang.org/production/users
- Skunkleton 7y agoThe above is also certainly non-exhaustive. Google isn't on the list, and they are using rust in fuchia.
- danellis 7y ago#[non_exhaustive] https://www.rust-lang.org/production/users There you go.
- Skunkleton 7y agolmao
- umanwizard 7y agoFacebook too, most famously in Libra.
- souprock 7y agoThat is the case here to some extent. Projects have been done in rust, but "rust programmer" isn't what we seek. Jumping into rust for our major projects doesn't make sense. Existing code is largely C, with some assembly and C++, so rust would just add another language to the requirements. To somebody who isn't already a rust expert, it isn't even clear that rust is good for the job. We like bitfields as L-values in C, without ugly macros or other wrappers. We like to be able to easily produce a small relocatable blob of binary executable code, such as a firmware image or boot loader. Speed and size matter to us. Sometimes we compile for weird targets such as ARMv4, Coldfire, 80286, and Xtensa. C certainly isn't perfect. If rust had fewer limitations, that could be convincing. My wishlist is probably zero-priority, but FWIW: I'd like pass-by-value arrays, naked functions, easy ability to get things in place as desired (position independent or fixed) without a PLT or GOT, portable bitfield layout, specified calling conventions, computed goto, and other things that high-level programmers despise.
- Someone1234 7y agoIt is young by language standards, but it has considerable success considering it isn't even 10 years old yet. Plus there isn't really anything else in the market that directly competes with it outside of what it tries to replace (C/C++). For example: https://msrc-blog.microsoft.com/2019/11/07/using-rust-in-windows/ https://msrc-blog.microsoft.com/2019/11/07/using-rust-in-win...
- codehalo 7y agoD? And others of course?
- Someone1234 7y agoD isn't really competing with anything, it never took off. It already has a smaller market share than Rust while being twice as old (almost 20 years). I'd call D a dead language. Can a dead language compete with a growing one?
- giancarlostoro 7y agoFacebook, Ebay, Mercedes Benz and a few others[0] don't seem to believe so. Better tell them to use a different language? I'm on a Discord for Dlang that's quite active honestly. The D community is plenty active. Their forums and IRC. Maybe not as active as other language communities, but it's not made by Mozilla or Google which gets a lot more attention. [0]: https://dlang.org/orgs-using-d.html https://dlang.org/orgs-using-d.html
- coldtea 7y ago>Facebook, Ebay, Mercedes Benz and a few others[0] don't seem to believe so. Better tell them to use a different language? The already "use a different language" for most of their stuff. Their D use is tokenish, the way you can find any bizarro, niche language used somewhere big. That doesn't mean the language is in any kind of widespread use, just that some teams in some big company or another adopted it - as outliers.
- spand 7y agoNot affiliated but there is at least one posting here https://concordium.com/careers/ https://concordium.com/careers/
- erk__ 7y agoAnd I know there are at least a few companies using rust to some extend in the capital region, there have been some talks about it at the monthly hacknight https://cph.rs https://cph.rs
- AsyncAwait 7y agoIs Denmark on the cutting edge of these sorts of things? Many countries have enterprise companies that are heavily invested in Java/C# and maybe 3 startups using a bit of Go/Elixir in some places, but that's about it, it's not specific to Rust.
- fulafel 7y agoDenmark is doing pretty well if you look at the history and people of PLT. Probably #1 country in per capita terms. Hejlsberg, Bak, Lerdorf, Naur, Stroustrup, Troels Henriksen etc. (Denmark has less than 2% of the population of USA)
- AsyncAwait 7y agoSure, I am not discounting Denmark has smart computer scientists, nor that the U.S. has better ones, (I'm European myself), just that from my experience the European tech scene is slower on picking up the latest tech, (which is different from educational institutions).
- MassiveOwl 7y agoWeird, I write in Go, and based on the number of posts about Rust, i'd assumed that it was gaining traction
- Narishma 7y agoIt is.
- jahaja 7y agoRust is a pretty niched language trying to replace C++ and similar that are quite slow moving, so it's gonna take time. Most jobs are after all related to web/services where Rust's strong points aren't as relevant.
- vardump 7y agoThere hasn’t been a single C++ job posting in the entire region of where I live in 1989, so it’s probably fair to say that almost no one uses it. To me, Rust "feels" like one of those languages that will stealthily become very important at least in certain segments where security, performance, C ABI compatibility (dll/so/dylib) and zero runtime are required.
- saagarjha 7y ago> There hasn’t been a single C++ job posting in the entire region of where I live in 1989, so it’s probably fair to say that almost no one uses it. I don't see your point? > Rust "feels" like one of those languages that will stealthily become very important Rust is not very stealthy at all :)
- vardump 7y ago> I don't see your point? My point is that C++, Java, etc. got established long before the hiring patterns and keywords changed. The employers will just suddenly start to expect (language age + 1 year) experience. I think same will happen to Rust. > Rust is not very stealthy at all :) Yet it might appear like that from corporate point of view.
- kibwen 7y agoI don't suppose I have any listings for Rust jobs in Denmark specifically, but for remote Rust jobs you could try checking out our regular jobs thread on /r/rust. We post a new one with each Rust release, so the current one ( https://www.reddit.com/r/rust/comments/ecxd62/official_rrust_whos_hiring_thread_for_jobseekers/ https://www.reddit.com/r/rust/comments/ecxd62/official_rrust... ) will take time to accumulate postings, so for now I'd suggest perusing last cycle's thread ( https://www.reddit.com/r/rust/comments/dvxw6u/official_rrust_whos_hiring_thread_for_jobseekers/ https://www.reddit.com/r/rust/comments/dvxw6u/official_rrust... ).
- gameswithgo 7y agoThere was one in late 2018, I applied but it was too difficult from them to hire an American!
- bytematic 7y agoI don't know about that, Microsoft security analysis is in Rust, Google wrote an OS in rust, Mozilla firefox is mid-rewrite in rust, Linux is accepting rust work
- halffullbrain 7y agoAre you looking for Rust employment in Denmark?
- gfs 7y agoCan somebody elaborate on the #[non_exhaustive] use case inside a private struct? Wouldn't a separate crate not be able to use the struct if it was in another crate?
- Sharlin 7y agoI think `Foo` and `Bar` are supposed to be public, otherwise the example doesn't make sense.
- wtetzner 7y agoThe point is that the struct is public, and the fields are public, but users of the crate cannot directly create a new instance of the struct (without going through a function call in the module). This allows users to access the struct fields, but they cannot do any operations that would break if a new field is introduced.
- Waterluvian 7y agoWonderful! Any further news on evolution of the Rust Language Server? I'm still hoping ~Santa~ Annual Gift Man will bring me a considerably crisper, more accurate IDE-like experience to my favourite non-Intellij editor.
- steveklabnik 7y agoHave you seen rust-analyzer? That’s effectively it.
- Waterluvian 7y agoNo I don't think I was aware of this. I've been playing with VSCode -> RLS Plugin -> RLS. It looks like this is not that, so I'm pretty excited to check it out. Thanks for sharing!
- jayflux 7y agoI’ve moved from RLS to rust-analyzer, was worth it for me
- steveklabnik 7y agoGreat! For anyone else who hasn't: https://rust-analyzer.github.io/ https://rust-analyzer.github.io/ and https://ferrous-systems.com/blog/rust-analyzer-2019/ https://ferrous-systems.com/blog/rust-analyzer-2019/
- dralley 7y agoUnfortunately you still have to compile it from source instead of install an extension from the store, and there's no autoupdate. But the experience is vastly better. I deleted RLS immediately. And it's not that hard to install either.
- Waterluvian 7y agoThis is part of why I think I never discovered rust-analyzer. I first looked at what's most popular in the VSCode plugin library and found RLS. I then browser searched for alternatives and kept finding RLS. I think I concluded that RLS was all there was.
- kire456 7y agoThe #[non_exhaustive] feature makes me unreasonably happy. It is a problem I hadn't even realized might occur, and the solution is very elegant, forcing depending code to be sufficiently general.
- est31 7y agoFor enums at least, I'm not recommending it's use (yet), as with _Nonexhaustive you can make sure you caught all cases internally. Matching on _Nonexhaustive as a user of the library is of course a bad idea. There've been proposals to a lint like #[deny(reachable)] to make such checks possible for #[non_exhaustive] as well but it seems that nothing has happened yet: https://github.com/rust-lang/rust/issues/44109#issuecomment-521781237 https://github.com/rust-lang/rust/issues/44109#issuecomment-...
- kibwen 7y ago> For enums at least, I'm not recommending it's use (yet), as with _Nonexhaustive you can make sure you caught all cases internally. I don't think this is necessary. The attribute in question is applied to an enum variant, and that variant's constructor is then given only crate-wide visibility. This looks to be simply a compiler-enforced codification of the pattern you're describing.
- est31 7y agoIt can both be applied to enum variants as well as to entire enums. I meant the latter case. From the release announcement: > A perhaps more important aspect of #[non_exhaustive] is that it can also be attached to enums themselves. An example, taken from the standard library, is Ordering For example, take this _Nonexhaustive enum case here: https://github.com/est31/rcgen/blob/d6b84d3d9d51b088dd672975e68dcbcc286e347a/src/lib.rs#L172 https://github.com/est31/rcgen/blob/d6b84d3d9d51b088dd672975... A little bit further down, I'm matching on the enum in the to_oid function. I'd prefer if I got an error or at least a warning pointing to the match if I added a new enum case and didn't update the match statement.
- csande17 7y agoI'm a little confused by the decision to make breaking changes to the borrow checker in Rust 2015. Wasn't the whole point of Rust 2015 to allow old code that wasn't compatible with 2018's changes to compile? If keeping strict Rust 2015 source-compatibility was too burdensome for the compiler maintainers, why not just remove Rust 2015 entirely and tell everyone to use the auto-upgrader tools?
- steveklabnik 7y agoThe only reason that breaking changes were allowed to be made was that they fixed soundness issues.
- kibwen 7y agoTo elaborate, the original borrow checker that launched with Rust 1.0 had edge cases that could only be resolved with a drastically different analysis pipeline. As a result, it wasn't able to properly reject some patterns that were disallowed by the conceptual model. Over the course of several years this new analysis pipeline was developed and the borrow checker was rewritten to use it, which now properly rejects these patterns. But three years is plenty of time for code in the wild to begin relying on edge cases, so there's been a year-long deprecation cycle to warn anyone who might not have updated their code by now.
- csande17 7y agoRight, I guess I had it in my head that the Rust 2015-vs-2018 divide was that deprecation cycle.
- kibwen 7y agoThe difference between Rust 2015 and 2018 is less than most people think. Originally, yes, Rust 2018 was used to push the new borrow checker without affecting code using Rust 2015. But unlike a "version" that gets deprecated and left behind, a Rust edition perpetually continues to be supported and benefit from improvements with every compiler release. But this means that in order to support different borrow checkers in different editions the compiler had to continue to ship with both borrow checkers, which, considering how much code that is and the aforementioned bugs, was an intractable proposition in the long term.
- NieDzejkob 7y agoWoah, todo! is going to come in handy considering the wordiness of unimplemented!. However, weirdly enough, the documentation claims it has been stabilized in 1.39. Why is that?
- steveklabnik 7y agoIt’s just a bug. Would you like to file one or would you like me to?
- NieDzejkob 7y agoI'll send a PR, one moment.
- steveklabnik 7y agoAwesome, thanks!
- randyrand 7y agoUsing #[non_exhaustive] on enums is going to be general bad practice, just as many in c++ consider ‘default’ switch cases bad practice. When a new state is added to an enum, we want the code to not compile so that we can fix all the places that need updating.
- steveklabnik 7y agoYes, that’s the trade off. Like all trade offs, it makes sense sometimes, but you’re right that it’s not to be used in most cases.
- gdxhyrd 7y agoYeah, I don't like it at all. Yes, some enums are intended to be expanded. Still, as long as something is a compile-time error, I don't care about having to update my code when I choose to upgrade compilers. In fact, even if the enum is intended to be expanded, I prefer to hear about new features and changes on APIs I actually use in a given project. It allows me to review mu choices and many times in complex APIs there are new options or flags that are useful to know about and otherwise get ignored. It allows me to update all callers as needed. I have heard too many times the backwards compatibility story in the C++ world and I never valued it for things that are errors rather than behavior changes. It makes the libraries and the language way too rigid and makes evolving it a pain. As long as you don't change the meaning of code that compiles cleanly, feel free to change things. If you really want to keep code compilable because you are doing a chance that you believe will be a PITA, you could always offer a (truly) automated tool.
- cesarb 7y ago> Still, as long as something is a compile-time error, I don't care about having to update my code when I choose to upgrade compilers. It's not just your code; it could be the code of any of your dependencies (or their dependencies, recursively). Besides, the Rust team does intend to keep older code compiling unchanged on newer releases of the Rust compiler, unless the breakage is caused by fixing a soundness hole. The best example of a non-exhaustive enum, in my opinion, would be std::io::ErrorKind (https://doc.rust-lang.org/std/io/enum.ErrorKind.html https://doc.rust-lang.org/std/io/enum.ErrorKind.html). Several Rust releases ago, I added a new variant to that enum (the last one, UnexpectedEof, used by std::io::Read::read_exact - notice how that variant comes after "Other", which used to be the last one). If that enum were not non-exhaustive (non-exhaustive enums already existed since Rust 1.0, though using a doc-hidden trick instead of formal compiler support), I would not have been able to add that new variant, since it would risk breaking anything which matched on every variant of that enum.
- webboynews 7y agoWho takes offense at santa? Are you so afraid of Muslims that you have to completely changed your way of life?
- deleted 7y ago[deleted]
- Siecje 7y agoCan you cross compile for another platform?
- orf 7y agoYes: https://github.com/rust-embedded/cross https://github.com/rust-embedded/cross
- mamcx 7y agoI like the IDEA but the implementation is not the good one. Instead, this is what will be elegant: pub enum SearchOption { Left, Full, } pub enum SearchOptionBeta:SearchOption { Rigth, } Yep, extending struct and enums. This mean MATCH touch "SearchOption" as the "stable" API and the inner crate touch SearchOptionBeta. When SearchOptionBeta need magic is that it match SearchOption too. Later is just a matter of replace one for the other. And this is even useful for more than to stabilize certain fields or arms...
- swsieber 7y agoI'd personally do this: pub enum SearchOption { Left, Full, Beta(SearchOptionBeta), } #[non_exhaustive] pub enum SearchOptionBeta { Right }
- mamcx 7y agoYeah, this is how could be done with this, but also show why is a poor abstraction. If enums were abled to be extended: match e: SearchOptionBeta { SearchOptionBeta:: Left, Rigth, Full }
- jeffdavis 7y agoThe continuing improvements to procedural macros are great! I do a fair amount of integration with C, and the work the rust team is doing for procedural macros has helped a lot. Being able to use them in an extern blocks will surely help more. Like many, I have a wish list that I complain about sometimes, but I feel bad about complaining because rust has done so much to improve my use case I don't know where to begin. I should write up a blog post about all of the difficulty I had, and how each release since around 1.28 has introduced features that solved these problems one by one. To me, Rust/C interop is the killer feature. Not only is it a low-level language that can be used instead of C, it can also be used to extend C applications. I'm sure it was not easy to do this well, but what a great strategic decision by the rust team to spend the effort on it!
- joshbenford89 7y agoCan you recommend any good blog or tutorial on integrating C/Python and newer releases of Rust?
- jeffdavis 7y agoI didn't use much except for the official docs (book and reference). Googling around shows some promising material. Release notes are helpful -- when you see something added related to C, it's a strong hint to read about the new feature. Macro features are important because rust has sophisticated macros and C macros are closer to text replacement. So when trying to emulate a C header, you need to do a lot of macro magic in rust sometimes. Sorry that I don't have more to offer from personal experience.
- calibas 7y agoHere's a common Rust foreign function interface for Python, with quite a few examples: https://crates.io/crates/pyo3 https://crates.io/crates/pyo3 Here's the one for C: https://crates.io/crates/libc https://crates.io/crates/libc