summaryrefslogtreecommitdiffstats
path: root/content/2014-11-24-this-week-in-rust.md
blob: 991ebdf7a595624be0c10163ba3e7c29b941283d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
Title: This Week in Rust 58
Date: 2014-11-24
Category: This Week in Rust

Hello and welcome to another issue of *This Week in Rust*!
[Rust](http://rust-lang.org) is a systems language pursuing the trifecta:
safe, concurrent, and fast. This is a weekly summary of its progress and
community. Want something mentioned? [Send me an
email!](mailto:corey@octayn.net?subject=This%20Week%20in%20Rust%20Suggestion)
Want to get involved? [We love
contributions](https://github.com/mozilla/rust/wiki/Note-guide-for-new-contributors).

The big news this week was that the [central crate
repository][crates.io] is [now live][crates.io-blog].  There was much
discussion on [Hacker News][crates.io-hn], [/r/rust][crates.io-reddit1] and
[/r/programming][crates.io-reddit2].

[crates.io]: https://crates.io/
[crates.io-blog]: http://blog.rust-lang.org/2014/11/20/Cargo.html
[crates.io-hn]: http://news.ycombinator.com/item?id=8637493
[crates.io-reddit1]: https://www.reddit.com/r/rust/comments/2mwice/cratesio_has_shipped/
[crates.io-reddit2]: https://www.reddit.com/r/programming/comments/2mwidh/rusts_central_package_repository_is_up/

We also have a new [guide to error handling][error].

[error]: http://doc.rust-lang.org/guide-error-handling.html

# What's cooking on master?

100 pull requests were [merged in the last week][1].

[1]: https://github.com/rust-lang/rust/pulls?q=is%3Apr+is%3Amerged+updated%3A2014-11-17..2014-11-23

## Breaking Changes

* Enum variants are now [namespaced by their type name][enumns], a
  major change. Enums in the standard library have been reexported in
  their old locations, for now at
  least. [RFC][enumns-rfc]. [Reddit][enumns-reddit].
* Collections have been modified to [no longer require the various
  `_equiv` methods][borrow], which are now deprecated.  Methods that
  search by key and value now often take a generic type that
  implements `BorrowFrom`, which converts e.g. both `str` and `String`
  to `&str`. [RFC][borrow-rfc].
* As part of ongoing [DST-ification][dst], `AsSlice` has been
  [modified to work with unsized types][unsized-asslice]. This breaks
  existing code because `AsSlice` type vars should now be taken by
  reference. At the same time, some of the ops have been extended to
  work with unsized types.
* The `str` method `slice_shift_char`'s return type [has changed
  slightly][slice_shift_char].
* The `find_copy` and `get_copy` methods of `HashMap` [are
  deprecated][cloned].  `find_copy` can be performed with
  `map.get(&key).cloned()`, which converts the `Option<&T>` returned
  by `get` to `Option<T>`, and `get_copy` to simply
  `map[key].clone()`, which calls `.clone()` on the value returned by
  reference from the indexing operator.
* [Runtime removal continues][rt]. Breaking changes here are mostly
  to code invoking the runtime directly.
* The `overloaded_calls` and `unboxed_closure_sugar` feature gates
  [have been combined][gates] into a single `unboxed_closures` gate.
* Formatting has [seen a stability pass][fmt] with some minor breaking
  changes. [RFC][fmt-rfc].
* The little-used `col!` macro is [renamed to `column!`][column].
* Non-ASCII lifetime identifiers are [behind the `non_ascii_idents`
  feature gate][ascii] as intended.
* [Struct variants can not be matched as if they were tuple
  variants][varmatch].
* There have been [several breaking changes and deprecations to
  `std::char`][stdchar].
* Likewise, there have been a number of changes to the code
  [dealing with raw string and vector processing][raw].

[enumns]: https://github.com/rust-lang/rust/pull/18973
[enumns-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0390-enum-namespacing.md
[enumns-reddit]: https://www.reddit.com/r/rust/comments/2ml4oo/switch_to_purely_namespaced_enums/
[dst]: http://smallcultfollowing.com/babysteps/blog/2014/01/05/dst-take-5/
[unsized-asslice]: https://github.com/rust-lang/rust/pull/18638
[slice_shift_char]: https://github.com/rust-lang/rust/pull/18911
[cloned]: https://github.com/rust-lang/rust/pull/18914
[rt]: https://github.com/rust-lang/rust/pull/18967
[gates]: https://github.com/rust-lang/rust/pull/18993
[fmt]: https://github.com/rust-lang/rust/pull/19040
[fmt-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0380-stabilize-std-fmt.md
[column]: https://github.com/rust-lang/rust/pull/19071
[ascii]: https://github.com/rust-lang/rust/pull/19073
[varmatch]: https://github.com/rust-lang/rust/pull/19087
[stdchar]: https://github.com/rust-lang/rust/pull/18603
[borrow]: https://github.com/rust-lang/rust/pull/18910
[borrow-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0235-collections-conventions.md
[raw]: https://github.com/rust-lang/rust/pull/19152

## Other Changes

* Rust now [supports higher-ranked trait bounds][hrtb]. This is
  necessary to make unboxed closures work, but the implications are
  quite complex. Read the [RFC][hrtb-rfc] for details.
* `Vec` [implements `Writer`][vec-writer] and `MemWriter` is deprecated.
* All statics now [support the `#[linkage]` attribute][linkage], which
  is behind the `linkage` feature gate.
* Parts of rustc have been [pulled into a new `rustc_trans`
  crate][rustc_trans] to reduce memory pressure.
* All idents following literals are [tokenized specially][litid] now
  as future proofing. [RFC][litid-rfc].
* [Unboxed closures can be written with the sugared syntax][sugar].

[hrtb]: https://github.com/rust-lang/rust/pull/18993
[hrtb-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0387-higher-ranked-trait-bounds.md
[vec-writer]: https://github.com/rust-lang/rust/pull/18885
[linkage]: https://github.com/rust-lang/rust/pull/18890
[rustc_trans]: https://github.com/rust-lang/rust/pull/19070
[litid]: https://github.com/rust-lang/rust/pull/19103
[litid-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0463-future-proof-literal-suffixes.md
[sugar]: https://github.com/rust-lang/rust/pull/19113

## New Contributors

* Andrew Cann
* Gleb Kozyrev
* Jashank Jeremy
* jmu303
* Joonas Javanainen
* jxv
* Nicholas Bishop
* oli-obk
* sheroze1123
* Simon Wollwage
* Vadim Petrochenkov
* we

# Approved RFC's

* [Higher-ranked trait bounds][rfc387]: Makes the type-system powerful enough to deal with
unboxed closures as well as boxed ones.
* [RFC to restrict placing an identifier after a literal.][rfc463]: Future-proofs syntax for literals
* [Finalizing more naming conventions][rfc430]: snake_case-type stuff and `unwrap` vs `into_inner`
* [Change precedence of `+` in type grammar][rfc438]: Cleans up a some weird parsing interactions
* [cmp and ops reform][rfc439]: DST-ify operators, add multi-dispatch, make them by-value for
flexibility, add IndexSet, unify slice operators with `..` notation sugaring to special types,
kill Equiv
* [Add a thread local storage module, std::tls][rfc461]: Introduces Scoped TLS and Owned TLS in a
new thread_local module to replace the old design. Should have better perf, be more flexible.

[rfc387]: https://github.com/rust-lang/rfcs/pull/387
[rfc463]: https://github.com/rust-lang/rfcs/pull/463
[rfc430]: https://github.com/rust-lang/rfcs/pull/430
[rfc438]: https://github.com/rust-lang/rfcs/pull/438
[rfc439]: https://github.com/rust-lang/rfcs/pull/439
[rfc461]: https://github.com/rust-lang/rfcs/pull/461


# New RFC's

* [Release channels and feature staging][rfc475]: This RFC describes changes to the Rust release
process, primarily the division of Rust's time-based releases into 'release channels', following
the 'release train' model used by e.g. Firefox and Chrome; as well as 'feature staging', which
enables the continued development of experimental language features and libraries APIs while
providing strong stability guarantees in stable releases.
* [path reform][rfc474]: This RFC reforms the design of the std::path module in preparation for API
stabilization. The path API must deal with many competing demands, and the
current design handles many of them, but suffers from some significant problems
given in "Motivation" below. The RFC proposes a redesign modeled loosely on the
current API that addresses these problems while maintaining the advantages of
the current design.
* [placement box with Placer trait for overloading][rfc470]: Add user-defined placement in
expression (more succinctly, "an in expression"), an operator analogous to "placement new"
in C++. This provides a way for a user to specify (1.) how the backing storage for some
datum should be allocated, (2.) that the allocation should be ordered before the evaluation
of the datum, and (3.) that the datum should preferably be stored directly into the backing
storage (rather than allocating temporary storage on the stack and then copying the datum
from the stack into the backing storage).
* [Feature gate box patterns][rfc469]: Move box patterns behind a feature gate.The general idea is
good, but the semantics aren't baked enough for 1.0.
* [Add "function name macro"][rfc466]: This RFC proposes the addition of a function! macro that
expands to the function it's used in. This will greatly help error reporting.

[rfc474]: https://github.com/rust-lang/rfcs/pull/474
[rfc475]: https://github.com/rust-lang/rfcs/pull/475
[rfc470]: https://github.com/rust-lang/rfcs/pull/470
[rfc469]: https://github.com/rust-lang/rfcs/pull/469
[rfc466]: https://github.com/rust-lang/rfcs/pull/466

# Community

Karen Rustad found a wild [rustacean](https://twitter.com/whoisaldeka/status/535679593353854976).

## From the Team

* [Weekly-meetings/2014-11-18][mtg]: cmp/ops; TLS; future-proofing
  literal parsing; ungating tuple indexing, if/while let; naming
  conventions; struct variants matching; for syntax for higher-order
  lifetimes; macros; type parameter grammar; better shepherding
  [Reddit][mtg-reddit].
* [Cargo: Rust's community crate host][cargo].

[mtg]: https://github.com/rust-lang/meeting-minutes/blob/master/weekly-meetings/2014-11-18.md
[mtg-reddit]: https://www.reddit.com/r/rust/comments/2mwdhn/weekly_meeting_20141118/
[cargo]: http://blog.rust-lang.org/2014/11/20/Cargo.html

## Videos

* [Introduction to programming safe and efficient systems in Rust][vid]. Jakub Bukaj at Øredev.

[vid]: http://vimeo.com/111852387

## Blog Posts

* [Rust, Lifetimes, and Collections][coll]. Alexis Beingessner (aka
  Gankro), who has been driving the current modernization of the
  collections libs, talks about the design of collections in
  Rust. [Reddit][coll-reddit]. [HN][coll-hn].
* [Chasing an EPROTOTYPE Through Rust, Sendto, and the OSX Kernel With
  C-Reduce][erickt]. [Reddit][erickt-reddit].
* [Rust tools][tools]. Nick Cameron has been thinking about the state
  of Rust tooling. [Reddit][tools-reddit].
* [Roguelike Tutorial in Rust: Part 5: Combat! Part III][rogue]. [Reddit][rogue-reddit].

[coll]: http://cglab.ca/~abeinges/blah/rust-lifetimes-and-collections/
[coll-hn]: http://news.ycombinator.com/item?id=8629789
[coll-reddit]: https://www.reddit.com/r/rust/comments/2mqwdm/rust_lifetimes_and_collections/
[erickt]: https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/
[erickt-reddit]: https://www.reddit.com/r/rust/comments/2mslk8/chasing_an_eprototype_through_rust_sendto_and_the/
[tools]: https://gist.github.com/nick29581/a3bbf6dd1b14ce57f18c
[tools-reddit]: https://www.reddit.com/r/rust/comments/2mqkwk/rust_tools/
[rogue]: http://jaredonline.svbtle.com/roguelike-tutorial-in-rust-part-5
[rogue-reddit]: https://www.reddit.com/r/rust/comments/2mlq0h/roguelike_tutorial_in_rust_part_5_combat_part_iii/

## Discussions

* [What are the advantages of Rust over modern C++?][c++]
* [What does 'unwrap' mean in Rust?][unwrap]
* [How would a Rust application be able to properly react to low level failures, like memory allocation failure?][ll]
* [The Race Towards 1.0 and The Standard Library][race].
* [Is Rust recommended for beginners with 0 programming language experience?][newb]. TL;DR it depends.
* [Feedback wanted: improved Rust error handling][err]. More experiments from mitsuhiko.
* [Benchmarks on different Map implementations for uint keys][bench].

[c++]: https://www.reddit.com/r/rust/comments/2mwpie/what_are_the_advantages_of_rust_over_modern_c/
[unwrap]: https://www.reddit.com/r/rust/comments/2mw2ns/what_does_unwrap_mean_in_rust/
[ll]: https://www.reddit.com/r/rust/comments/2mthq2/how_would_a_rust_application_be_able_to_properly/
[race]: https://www.reddit.com/r/rust/comments/2mo0zb/the_race_towards_10_and_the_standard_library/
[newb]: https://www.reddit.com/r/rust/comments/2mlq18/is_rust_recommended_for_beginners_with_0/
[err]: https://www.reddit.com/r/rust/comments/2n6mpm/feedback_wanted_improved_rust_error_handling/
[bench]: https://www.reddit.com/r/rust/comments/2n2v3l/benchmarks_on_different_map_implementations_for/

## New Projects

* [rust-eh]. Python-like error tracebacks, from mitsuhiko.
* [rust-incidents]. More error experiments from mitsuhiko.
* `sl`, the classic Unix command, [in Rust][sl].
* [img_hash]. Perceptual hashing of images.
* [raw-rs]. Utilities for manipulation of Rust core types.
* [rust-uchardet]. Encoding detection.
* [Rust-Relay]. IRC client library. Start your bots!
* [cargo-do]. Cargo plugin for running multiple commands at once.
* [dbus-rs]. D-Bus bindings.
* [rusty-abstract-algebra].
* [wire]. An abstraction over TCP and binary serialization.

[rust-eh]: https://www.reddit.com/r/rust/comments/2mjqzi/rusteh_python_like_error_tracebacks_for_rust/
[rust-incidents]: https://www.reddit.com/r/rust/comments/2n6mpm/feedback_wanted_improved_rust_error_handling/
[sl]: https://www.reddit.com/r/rust/comments/2mrep5/sl1_reimplementation_in_rust/
[img_hash]: https://www.reddit.com/r/rust/comments/2mq3dg/img_hash_a_simple_rust_library_for_performing/
[raw-rs]: https://www.reddit.com/r/rust/comments/2mp0il/rawrs_utilities_for_unsafe_manipulation_of_core/
[rust-uchardet]: https://www.reddit.com/r/rust/comments/2mpedc/rustuchardet_encoding_detection_wrapper_using_ffi/
[Rust-Relay]: https://www.reddit.com/r/rust/comments/2miyr2/rustrelay_an_ircv3_client_library_looking_for/
[cargo-do]: https://www.reddit.com/r/rust/comments/2mwzah/cargo_subcommand_plugin_to_run_multiple_commands/
[dbus-rs]: https://www.reddit.com/r/rust/comments/2n5un5/dbus_bindings_for_rust/
[rusty-abstract-algebra]: https://www.reddit.com/r/rust/comments/2n6ixn/abstract_algebra_traits_escaping_the_paramter_hell/
[wire]: https://www.reddit.com/r/rust_gamedev/comments/2n5749/wire_an_abstraction_over_tcp_and_binary/

## Project Updates

* [This Week in Servo 12][twis].
* [Glium's design choices][glium]. Glium is a safe OpenGL wrapper.

[twis]: http://blog.servo.org/2014/11/18/twis-12/
[glium]: https://www.reddit.com/r/rust_gamedev/comments/2mkbs9/gliums_design_choices/