「Rust (プログラミング言語)」の版間の差分

出典: フリー百科事典『ウィキペディア(Wikipedia)』
削除された内容 追加された内容
Version 1.23リリース。
Hinapen (会話 | 投稿記録)
→‎評価: 古い出典つきの記述を除去
(7人の利用者による、間の11版が非表示)
3行目: 3行目:
| logo = [[File:Rust programming language black logo.svg|144px]]
| logo = [[File:Rust programming language black logo.svg|144px]]
| caption =
| caption =
| paradigm = [[並列計算]]、[[関数型]]、[[オブジェクト指向]]、[[命令型プログラミング]]、[[構造化]]、[[静的型付け]]
| paradigm = [[マルチパラダイムプログラミング言語|マルチパラダイム]]、[[コンパイル言語|コンパイル]]、[[命令型プログラミング|命令型]]、[[関数型言語|関数型]]、[[オブジェクト指向プログラミング|オブジェクト指向]]、[[構造化プログラミング|構造化]]、[[ジェネリックプログラミング|ジェネリック]]、[[並行計算]]
| year = [[2010年]]
| year = [[2010年]]
| designer = グレイドン・ホアレ
| designer = グレイドン・ホアレ
10行目: 10行目:
| latest_release_date = {{Start date and age|2018|01|04}}
| latest_release_date = {{Start date and age|2018|01|04}}
| typing = [[静的型付け]]、[[強い型付け]]、[[型推論]]、構造化データ
| typing = [[静的型付け]]、[[強い型付け]]、[[型推論]]、構造化データ
| implementations = <code>rustc</code>
| implementations = rustc
| dialects =
| dialects =
| influenced_by = [[Alef]], [[C++]], [[Camlp4]], [[Common Lisp]], [[Erlang]], [[Haskell]], [[Hermes]], [[Limbo]], Napier, [[Napier88]], [[Newsqueak]], NIL, [[Sather]], [[Standard ML]]
| influenced_by = Alef, [[C++]], [[C#]], Cyclone, [[SML]], [[OCaml]], [[Erlang]], [[Haskell]], [[Limbo]], [[ML (プログラミング言語)|ML]], Newsqueak, [[Scheme]], [[Swift]], Unicode Annex #31<ref name="influenced_by">{{citeweb|title=Appendix: Influences - The Rust Reference|url=https://doc.rust-lang.org/reference/influences.html|accessdate=28 January, 2018}}</ref>
| influenced = [[Swift (プログラミング言語)|Swift]]
| influenced = [[Swift (プログラミング言語)|Swift]]
| operating_system = [[FreeBSD]], [[Linux]], [[macOS]], [[Microsoft Windows|Windows]]
| operating_system = [[FreeBSD]], [[Linux]], [[macOS]], [[Microsoft Windows|Windows]], [[Android]], [[iOS]], [[WebAssembly]]<ref name="rust-platform-support"/>
| license = [[MIT License|MIT]]
| license = [[Apache License|Apache License 2.0]], [[MIT License|MIT]]
| file_ext = <code>.rs</code> <code>.rlib</code>
| file_ext = rs, rlib
| website = [https://www.rust-lang.org/ rust-lang.org]
| website = [https://www.rust-lang.org/ www.rust-lang.org]
}}
}}
'''Rust'''(ラスト)は並列かつマルチパラダイムのプログラミング言語である。[[Mozilla Foundation|Mozilla]]によって開発されている<ref name="lamda">{{cite web|url=http://lambda-the-ultimate.org/node/4009|title=The Rust Language|first=Noel|date=2010-07-08|publisher=Lambda the Ultimate|accessdate=2010-10-30}}</ref>。[[関数型プログラミング]]、[[アクターモデル|並列アクターモデル]]、[[手続き型プログラミング]]、[[オブジェクト指向プログラミング]]をサポートする実用的な言語を目指している。


'''Rust'''(ラスト)は[[Mozilla Foundation|Mozilla]]が支援する<ref name="mozilla-research-rust" /><ref name="lamda">{{cite web|url=http://lambda-the-ultimate.org/node/4009|title=The Rust Language|first=Noel|date=2010-07-08|publisher=Lambda the Ultimate|accessdate=2010-10-30}}</ref>[[オープンソース]]の{{仮リンク|システムプログラミング言語|en|System programming language}}である。
== 概要 ==
主任開発者はグレイドン・ホアレ<ref>{{lang-en-short|Graydon Hoare}}</ref>である。彼は2006年にこの言語の開発に着手し、Mozillaが関わりはじめたのは2009年で<ref name="proj-faq">{{cite web|url=https://github.com/mozilla/rust/wiki/Doc-project-FAQ|title=Project FAQ|date=2010-09-14|accessdate=2012-01-11}}</ref>、2010年のモジラ・サミットで公に姿を表した<ref name="future-tense">{{cite web|url=http://www.slideshare.net/BrendanEich/future-tense-7782010|title=Future Tense|date=2011-04-29|accessdate=2012-02-06|quote={{lang|en|At Mozilla Summit 2010, we launched Rust, a new programming language motivated by safety and concurrency for parallel hardware, the “manycore” future which is upon us.}}}}</ref>。初期のコンパイラーは[[OCaml]]言語で作られていたが、2010年にはコンパイラーをRust言語自身で作る作業が開始された<ref name="rust-in-rust">{{cite web|url=http://blog.mozilla.com/graydon/2010/10/02/rust-progress/|title=Rust Progress|last=Hoare|first=Graydon|date=2010-10-02|accessdate=2010-10-30}}</ref>。翌年には最初の完動品が作成された<ref name="rust-compiles-rust">{{cite web|url=https://mail.mozilla.org/pipermail/rust-dev/2011-April/000330.html|title=rust-dev&#93; stage1/rustc builds|last=Hoare|first=Graydon|date=2011-04-20|accessdate=2011-04-20|quote={{lang|en|After that last change fixing the logging scope context bug, looks like stage1/rustc builds. Just shy of midnight :)}}}}</ref>。このコンパイラーは[[LLVM]]で構築された。


Rust言語は速度、並行性、安全性を言語仕様として保証する[[C言語]]、[[C++]]に代わる{{仮リンク|システムプログラミング|en|System programming}}に適した[[プログラミング言語]]を目指している<ref name="infoq2012" />。2006年の開発初期はグレイドン・ホアレの個人プロジェクトだったが、2009年に[[Mozilla]]が開発に関わり始めてMozilla Researchの公式プロジェクトとなった<ref name="mozilla-research-rust" />。2015年に1.0版がリリースされるまでにいくつもの破壊的な仕様変更があったが、1.0版以降は基本的には[[後方互換]]を保って6週間間隔で定期的にリリースされている。プロジェクトは[[オープンソース]]のコミュニティベース開発で進行しており<ref>{{citeweb|author=Rust Project Developers|url=https://www.rust-lang.org/en-US/community.html|title=The Rust Community &middot; The Rust Programming Language|accessdate=2018-02-04}}</ref>、言語仕様(検討段階含む)、ソースコード、ドキュメントは[[オープンソースライセンス]]で公開されている<ref>{{citeweb|author=Rust Project Developers|url=https://www.rust-lang.org|title=rust-lang/rust: A safe, concurrent, practical language.|publisher=github|accessdate=2018-02-04}}</ref>。
Rustコンパイラーの第0.1版は2012年1月に完成している<ref name="rustc-0.1">{{cite web|url=http://www.reddit.com/r/programming/comments/opgxd/mozilla_and_the_rust_community_release_rust_01_a/|title=Mozilla and the Rust community release Rust 0.1 (a strongly-typed systems programming language with a focus on memory safety and concurrency)|author=catamorphism|date=2012-01-20|accessdate=2012-02-06}}</ref>。Mozillaはこれを新しいモノ好みの人やプログラミング言語愛好家のためのアルファ版と位置づけている。


Rustは[[マルチパラダイムプログラミング言語]]であり、[[手続き型プログラミング]]、[[オブジェクト指向プログラミング]]、[[関数型プログラミング]]などの実装手法をサポートしている。基本的な[[制御フロー]]は[[C言語]]に似ているが、ほぼ全ての命令文が[[式 (プログラミング)|式(expression)]]であるという点においては[[Standard ML|ML言語]]に似ている。コンパイル基盤にMIRと[[LLVM]]を用いており<ref name="MIR" />、実行時速度性能は[[C言語]]と同等程度である<ref name="benchmarksgame-rust" />。強力な型システムとリソース管理の仕組みにより、{{仮リンク|メモリセーフ|en|Memory safety}}な安全性が保証されている。
Mozillaの理念を守り<ref name="moz-manifesto">{{cite web|url=http://www.mozilla.org/about/manifesto.en.html|title=The Mozilla Manifesto|accessdate=2012-04-09}}</ref>、Rust言語は社会に開かれており、開発者たちは利用者からの感想や提言を求めている。


Rustは2016年、2017年の[[Stack Overflow]] Developer Surveyで「最も愛されているプログラミング言語」で一位を獲得している<ref name="stackoverflow-mostloved-2016" /><ref name="stackoverflow-mostloved-2017" />。一方で、Rustは学習難易度が高い言語とも考えられており<ref name="go-vs-rust" />、2017年ロードマップでは学習曲線の改善を目的として挙げていた<ref name="roadmap-2017" />。
Rust 1.0が日本時間の2015年5月16日にリリースされた<ref name="rust-blog">{{cite web|url=http://blog.rust-lang.org/2015/05/15/Rust-1.0.html|title=The Rust Programming Language Blog|accessdate=2015-5-15}}</ref>。


== 歴史 ==
2016年8月2日にリリースされた[[Mozilla Firefox|Firefox 48]]にはRustで書き直されたメディアパーサが組み込まれており、Mozillaが開発している[[ウェブブラウザ|ブラウザ]]のFirefoxにおいてRustで書かれたコードが書き加えられる初例となった<ref name="Media_Parser">{{cite web|url=https://www.mozilla.jp/firefox/48.0/releasenotes/|title=Firefox リリースノート Firefox 48.0
=== 誕生 ===
|publisher=[[Mozilla Foundation]]|date=2016-08-02|accessdate=2016-08-03}}</ref><ref name="First_codes_in_the_Firefox">{{cite web|url=https://dev.mozilla.jp/2016/07/shipping-rust-in-firefox/|title=Firefox に組み込まれた Rust|publisher=[[Mozilla Foundation]]|date=2016-08-02|accessdate=2016-08-03}}</ref>。
2006年、[[Mozilla]]で働いていたグレイドン・ホアレ<ref>{{lang-en-short|Graydon Hoare}}</ref>は現代のインターネット環境で高い並行性と高い安全性が求められる{{仮リンク|システムプログラミング言語|en|System programming language}}として[[C言語]]や[[C++]]に代わりうる[[プログラミング言語]] Rust言語の開発に着手した<ref name="infoq2012">{{cite web|url=http://www.infoq.com/news/2012/08/Interview-Rust|title=Interview on Rust, a Systems Programming Language Developed by Mozilla|last=Avram|first=Abel|date=2012-08-03|accessdate=2013-08-17|publisher=InfoQ|quote='''GH:''' A lot of obvious good ideas, known and loved in other languages, haven't made it into widely used systems languages&nbsp;... There were a lot of good competitors in the late 1970s and early 1980s in that space, and I wanted to revive some of their ideas and give them another go, on the theory that circumstances have changed: the internet is highly concurrent and highly security-conscious, so the design-tradeoffs that always favor C and C++ (for example) have been shifting.}}</ref>。[[Mozilla]]がRustの開発に関わりはじめたのは2009年で<ref name="proj-faq">{{cite web|url=https://github.com/mozilla/rust/wiki/Doc-project-FAQ|title=Project FAQ|date=2010-09-14|accessdate=2012-01-11}}</ref><ref name="mozilla-research-rust">{{citeweb|author=Mozilla Research|url=https://research.mozilla.org/rust/|title=Rust|accessdate=2018-02-04}}</ref>、Rustは2010年のモジラ・サミットで公に姿を表した<ref name="future-tense">{{cite web|url=http://www.slideshare.net/BrendanEich/future-tense-7782010|title=Future Tense|date=2011-04-29|accessdate=2012-02-06|quote={{lang|en|At Mozilla Summit 2010, we launched Rust, a new programming language motivated by safety and concurrency for parallel hardware, the “manycore” future which is upon us.}}}}</ref>。Rust[[ソースコード]]を[[コンパイル]]するRust[[コンパイラ]]は、初期の頃は[[OCaml]]言語で作られたコンパイラ(rustboot)が用いられていたが<ref>{{twitter status2|rustlang|840985601629405185|2017年3月12日|accessdate=2018-02-04}}</ref>、2010年にはRust言語自身でRustコンパイラを作る[[セルフホスティング]]へ移行したコンパイラ(rustc)の開発が始められ<ref name="rust-in-rust">{{cite web|url=http://blog.mozilla.com/graydon/2010/10/02/rust-progress/|title=Rust Progress|last=Hoare|first=Graydon|date=2010-10-02|quote=the second version of the compiler, written in Rust and compiled with the bootstrap compiler|accessdate=2010-10-30|archiveurl=https://web.archive.org/web/20131022063015/https://blog.mozilla.org/graydon/2010/10/02/rust-progress/|archivedate=2013-10-22}}</ref>、翌年には[[ブートストラップ問題]]を解決した最初の完動品が完成した<ref name="rust-compiles-rust">{{cite web|url=https://mail.mozilla.org/pipermail/rust-dev/2011-April/000330.html|title=rust-dev&#93; stage1/rustc builds|last=Hoare|first=Graydon|date=2011-04-20|accessdate=2011-04-20|quote={{lang|en|After that last change fixing the logging scope context bug, looks like stage1/rustc builds. Just shy of midnight :)}}}}</ref>。この時よりRustコンパイラはコンパイル基盤に[[LLVM]]を用いたものとなった<ref>{{citeweb|author=Chris Double|url=https://bluishcoder.co.nz/2011/03/31/a-quick-look-at-the-rust-programming-language.html|title=A Quick Look at the Rust Programming Language|quote=The rustc compiler lives in stage0/rustc. The output of this compiler is LLVM bytecode which must then be compiled using LLVM tools.|date=2011-03-31|accessdate=2018-02-04}}</ref>。


=== 0.x版 ===
2016年9月にRustは[[Fedora|Fedora 24]]の標準コンポーネントに加えられ、[[RPM Package Manager|RPM]]の[[パッケージ管理システム]]を用いてのインストール作業が容易化されている<ref name="Fedora">{{cite web|url=https://fedoramagazine.org/rust-meets-fedora/|title=Rust meets Fedora|publisher=fedoramagazine.org|date=2016-09-21|accessdate=2016-10-06}}</ref>。
プレアルファ(0.1版)と呼ばれる最初のバージョンは2012年1月にリリースされた<ref name="rustc-0.1">{{cite web|url=http://www.reddit.com/r/programming/comments/opgxd/mozilla_and_the_rust_community_release_rust_01_a/|title=Mozilla and the Rust community release Rust 0.1 (a strongly-typed systems programming language with a focus on memory safety and concurrency)|author=catamorphism|date=2012-01-20|accessdate=2012-02-06}}</ref>。Mozillaはこれを新しいモノ好みの人やプログラミング言語愛好家のためのアルファ版と位置づけていた。最初の安定版である1.0版がリリースされるまでの0.x版リリースでは、いくつもの大きな破壊的な仕様変更が言語およびライブラリに加えられた。


変数名や関数名など識別子は、この言語の開発の初期の頃は、[[ASCII]]文字以外の文字を使うことが禁じられていた。言語についてのある質疑応答の中で、現場の非英語圏のプログラマーのほとんどが識別子には[[ASCII]]文字を使っていると述べられていた。しかしその制限は反論を引き出すことになった<ref name="ascii-lexeme-criticism">{{cite web|url=http://broadcast.oreilly.com/2010/08/vale-java-scala-vala-palava.html#comment-3572710|title=Vale Java? Scala Vala palava|last=Jelliffe|first=Rick|date=2010-11-08|accessdate=2012-03-29|quote={{lang|en|… It is just plain ignorant to say that non-English programmers always write with ASCII. (Just as it would be ignorant to say that they never do.) It is that kind of rather blithe dismissal that foreign cultures and languages need to be supported that creates extra unnecessary barriers. That argument ran out of legs in the early 1990s: all platforms have well -established Unicode libraries with serviceable properties for this…}}}}</ref>。それにより、2011年2月に言語に変更が行われ、この制限は削除された<ref name="ascii-lexeme-update">{{cite web|url=https://github.com/mozilla/rust/commit/dabccadd3202513ab0bcb424e2c62c90ab23062d|title=Commit dabccadd3202513ab0bcb424e2c62c90ab23062d|date=2011-02-26|accessdate=2012-01-11}}</ref>。
== 特徴 ==
ネットワークを相手に動作する比較的大きな、サーバやクライアントプログラムを作成するのに都合が良い言語を目指したものである。結果として、安全性、メモリ管理、並列性が、この言語の目立った特徴となっている。性能はC++言語に匹敵するものになるはずである<ref name="cpp-design-goals">{{cite web|url=http://pcwalton.blogspot.com/2010/12/c-design-goals-in-context-of-rust.html|title=C++ Design Goals in the Context of Rust|last=Walton|first=Patrick|date=2010-12-05|accessdate=2011-01-21|quote={{lang|en|… It’s impossible to be “as fast as C” in all cases while remaining safe… C++ allows all sorts of low-level tricks, mostly involving circumventing the type system, that offer practically unlimited avenues for optimization. In practice, though, C++ programmers restrict themselves to a few tools for the vast majority of the code they write, including stack-allocated variables owned by one function and passed by alias, uniquely owned objects (often used with <code>auto_ptr</code> or the C++0x <code>unique_ptr</code>), and reference counting via <code>shared_ptr</code> or COM. One of the goals of Rust’s type system is to support these patterns exactly as C++ does, but to enforce their safe usage. In this way, the goal is to be competitive with the vast majority of idiomatic C++ in performance, while remaining memory-safe…}}}}</ref>。


[[データ型|型]]判定は、0.4版以前の従来の[[静的型付け]]に加えて、型状態システムをサポートしていた。型状態システムは、特別な<code>check</code>文を使用してプログラム文の前後での型決定をモデル化した。C言語やC++コードでのアサーションの場合と同様に、プログラム実行中ではなくコンパイル時に型不一致を検出する。型状態の概念はRust特有のものではなく、{{仮リンク|NIL (プログラミング言語)|en|NIL (programming language)|label=NIL}}で採用されていたものである<ref name="typestate">{{cite journal |last1= Strom |first1= Robert E. |last2 = Yemini |first2= Shaula |url=http://www.cs.cmu.edu/~aldrich/papers/classic/tse12-typestate.pdf|title=Typestate: A Programming Language Concept for Enhancing Software Reliability|year=1986|publisher=IEEE Transactions on Software Engineering|issn=0098-5589|accessdate=2010-11-14}}</ref>。実際にはほとんど使用されていなかったため型状態は削除されたが、ブランディングパターンで同じ機能を実現できる<ref name="branding-patterns">{{cite web|last=Walton |first=Patrick |url=https://pcwalton.github.com/blog/2012/12/26/typestate-is-dead/ |title=Typestate Is Dead, Long Live Typestate! |website=Pcwalton.github.com |date=2012-12-26 |accessdate=2016-11-03}}</ref>。
バージョン1.12より導入されたMIR (Mid-level IR)<ref name="MIR">{{cite web|url=https://blog.rust-lang.org/2016/04/19/MIR.html|title=Introducing MIR|last=Matsakis|first=Niko|date=2016-04-19|accessdate=2016-10-04}}</ref> によって、コンパイルと実行時間の迅速化ならびに型チェックの正確性の実現が図られている。ブロックに中括弧を使うなど、構文は[[C言語]]風である。


[[オブジェクト指向]]のシステムは、0.2版から0.4版にかけて大きく変わっていった。0.2版で初めて[[クラス (コンピュータ)|クラス]](class)が導入され、0.3版で[[ソフトウェアインタフェース|インターフェース]](interface)を通した[[デストラクタ]]と[[多様性]]が追加され、0.4版で[[継承 (プログラミング)|継承]]を提供する手段として[[トレイト]](trait)が追加された。インターフェースはトレイトに一部の機能が統合されて、異なる不要な機能として削除された。クラスもまた削除され、構造体とトレイトを使用した[[Mixin|ミックスイン]]に置き換えられた。
制御構造には <code>if</code>, <code>else</code>, <code>do</code>, <code>while</code>, <code>for</code> などがある。以上のようにC言語風であるが、C言語のキーワードが全てあるわけではなく、一方で多方向分岐の <code>match</code> 文など、あまり馴染みがないキーワードもある<ref>「予約語」と「キーワード」を混同しないこと。詳しくは「[[予約語]]」の記事を参照。</ref>。


コアの{{仮リンク|メモリモデル (プログラミング)|label=メモリモデル|en|Memory model (programming)}}は、0.9版から0.11版の間、2つのビルトインの[[ポインタ (プログラミング)|ポインタ]]型(ヒープメモリ型<code>~</code>とガベージコレクション型<code>@</code>)を機能を単純化するために用意していた。それらは、標準ライブラリの<code>Box</code>型と<code>Gc</code>型で置き換えられ、<code>Gc</code>型は最終的には削除された<ref name="removing-garbage-collection">{{cite web|last=Walton |first=Patrick |url=http://pcwalton.github.io/blog/2013/06/02/removing-garbage-collection-from-the-rust-language/ |title=Removing Garbage Collection From the Rust Language |website=Pcwalton.github.com |date=2013-01-02 |accessdate=2018-02-04}}</ref>。
構文は似ているが、[[プログラム意味論|意味論]](セマンティクス)では大きく異なる部分がある。
このシステムの設計はメモリー・セーフであり、[[ヌルポインタ]]や不正なメモリ域を指すポインターは許容されていない。データの値は決まったフォームのみで初期化され、それらの全ての入力は既に初期化されている必要がある<ref name="lang-faq">{{cite web|url=https://github.com/mozilla/rust/wiki/Doc-language-FAQ|title=Doc language FAQ|date=2010-09-14|accessdate=2012-01-11}}</ref>。


2014年1月、主開発者のアンドリュー・ビンストックは[[Dr. Dobb's Journal]]で[[D言語]]や[[Go (プログラミング言語)|Go言語]]、[[Nim|Nim言語]]と同様に[[C++]]の競争相手になる機会を得たとコメントした。ビンストックによると、Rustは非常にエレガントな言語として広く見られているが、バージョン間で繰り返し大きく変更されたため発表が遅れたとのことである<ref>{{citeweb|author=Andrew Binstock|url=www.drdobbs.com/jvm/the-rise-and-fall-of-languages-in-2013/240165192|title=The Rise And Fall of Languages in 2013|accessdate=2018-01-28}}</ref>。
この言語の型システムでは[[Haskell]]言語に倣い「型クラス」を用いることができる。これはアドホックな多相性を容易にするものであり、可変型宣言により実現されるものである。高類多相性<ref>{{lang-en-short|higher-kinded polymorphism}}</ref>など、Haskell言語にある他の特徴はサポートされていない。


=== 1.x版 ===
Rust言語では予約語「<code>let</code>」で宣言された変数に対して型推論が行われる。これらの変数は型を決定するための値を必要としない。コード中のどこかでそれらの変数への値の代入<ref>{{lang-en-short|assign}}</ref>が失敗した場合にはコンパイル時エラーが発生する<ref name="type-inference">{{cite web|url=http://pcwalton.blogspot.com/2010/10/rust-features-i-type-inference.html|title=Rust Features I: Type Inference|last=Walton|first=Patrick|date=2010-10-01|accessdate=2011-01-21}}</ref>。型が明示された関数の引数に対しては型推論は行われない。
2015年5月16日、安定版となるRust 1.0がリリースされた<ref name="rust-blog">{{cite web|author=The Rust Core Team|url=http://blog.rust-lang.org/2015/05/15/Rust-1.0.html|title=Announcing Rust 1.0 - The Rust Programming Language Blog|date=2015-5-15|accessdate=2018-02-04}}</ref>。1.0版の後、安定版およびベータ版が6週間おきに定期リリースされている<ref>{{citeweb|author=Alex Crichton|url=https://github.com/rust-lang/rfcs/blob/master/text/0507-release-channels.md|title=rfcs/0507-release-channels.md at master · rust-lang/rfcs|date=2014-10-27|accessdate=2018-02-04}}</ref>。また{{仮リンク|デイリービルド|label=ナイトリー|en|Daily build}}版が毎日リリースされている<ref>{{citeweb|author=Aaron Turon|author2=Niko Matsakis|url=https://blog.rust-lang.org/2014/10/30/Stability.html|title=Stability as a Deliverable - The Rust Programming Language Blog|date=2014-10-30|accessdate=2018-02-04}}</ref>。新たな機能は{{仮リンク|デイリービルド|label=ナイトリー|en|Daily build}}版で開発が進められ、ベータ版で動作が検証されている<ref name="Scheduling the Trains">{{cite web |title= Scheduling the Trains| url=https://blog.rust-lang.org/2014/12/12/1.0-Timeline.html| accessdate=2017-01-01}}</ref>。


2016年8月2日にリリースされた[[Mozilla Firefox|Firefox 48]]にはRustで書き直されたメディアパーサが組み込まれており、Mozillaが開発している[[ウェブブラウザ|ブラウザ]]の[[Firefox]]においてRustで書かれたコードが書き加えられる初例となった<ref name="Media_Parser">{{cite web|url=https://www.mozilla.jp/firefox/48.0/releasenotes/|title=Firefox リリースノート Firefox 48.0
<source lang="rust">
|publisher=[[Mozilla Foundation]]|date=2016-08-02|accessdate=2016-08-03}}</ref><ref name="First_codes_in_the_Firefox">{{cite web|url=https://dev.mozilla.jp/2016/07/shipping-rust-in-firefox/|title=Firefox に組み込まれた Rust|publisher=[[Mozilla Foundation]]|date=2016-08-02|accessdate=2016-08-03}}</ref>。
fn fib(n: u32) -> u32 { }
</source>


2016年9月にRustは[[Fedora|Fedora 24]]の標準コンポーネントに加えられ、[[RPM Package Manager|RPM]]の[[パッケージ管理システム]]を用いてのインストール作業が容易化されている<ref name="Fedora">{{cite web|url=https://fedoramagazine.org/rust-meets-fedora/|title=Rust meets Fedora|publisher=fedoramagazine.org|date=2016-09-21|accessdate=2016-10-06}}</ref>。
なおこれを以下のように、型を省いて記述することはできない。


== 開発体系 ==
<source lang="rust">
Rustは[[オープンソース]]のコミュニティベースで開発が進められている。プロジェクトの主管はRust Project Developers(Rust開発チーム)である<ref>{{citeweb|url=https://www.rust-lang.org/en-US/team.html|title=The Rust Team &middot; The Rust Programming Language|publisher=Rust Project Developers|accessdate=2018-02-04}}</ref>。2018年現在、言語発明者のグレイドン・ホアレはプロジェクトチームから外れている。プロジェクトの全ての[[ソースコード]]は[[github]]で一般に公開されており<ref>{{citeweb|url=https://github.com/rust-lang|title=The Rust Programming Language|publisher=github|accessdate=2018-02-04}}</ref>、コミュニティメンバーの協力により改良が進められる。プロジェクトの大部分の[[コミット]]はコミュニティメンバーによるものである<ref>{{citeweb|title=Contributors to rust-lang/rust|url=https://github.com/rust-lang/rust/graphs/contributors|publisher=github|accessdate=28 January, 2018}}</ref>。
fn fib(n) -> { }
</source>


Mozillaの理念<ref name="moz-manifesto">{{cite web|url=http://www.mozilla.org/about/manifesto.en.html|title=The Mozilla Manifesto|accessdate=2012-04-09}}</ref>を守り、Rust言語は社会に開かれており、言語やツールに対する仕様の提案はRFCの形で取りまとめられ<ref>{{citeweb|url=https://github.com/rust-lang/rfcs|title=rust-lang/rfcs: RFCs for changes to Rust|publisher=github|accessdate=2018-02-04}}</ref>、関連するチケットで仕様詳細について利用者から感想や提言を受けている<ref>{{citeweb|url=https://github.com/rust-lang/rfcs|title=rust-lang/rfcs: RFCs for changes to Rust|accessdate=2018-01-28}}</ref><ref>{{citeweb|author=Aaron Turon|url=https://aturon.github.io/blog/2016/07/05/rfc-refinement/|title=Refining Rust's RFCs|accessdate=2018-01-28}}</ref>。
並列性の機構は軽量タスクとして提供される。これと類似の仕組みは[[Erlang]]言語などの[[アクターモデル]]の言語にも見られるものである。それらのシステムにおいて、複数のタスク同士は直接にデータを共有するのではなく、メッセージ・パッシングによってデータのやり取りを行う。性能上の理由から、データのやり取りには固有の箱<ref>{{lang-en-short|unique box}}</ref>を使って行われ、データの複製はされない。それらの箱は所有者が一人であることが保証されたもので、送信タスクから受信タスクに向けて開放することができる。


言語やコアライブラリを開発するRust開発チームは[[Servo]]([[ウェブブラウザ]]用[[レンダリングエンジン|レイアウトエンジン]])やRustコンパイラの実装経験を通して言語を改良している。例えば、[[C言語]]とRustを連携させるコードを自動生成するbindgenは元々は外部開発者が開発していたが<ref>{{citeweb|author=|url=https://docs.rs/crate/bindgen/0.17.0|title=bindgen 0.17.0 - Docs.rs|quote=authors Jyun-Yan You|publisher=Onur Aslan|accessdate=2018-02-04}}</ref>、Mozilla Servo開発チームがServoの開発で利用するために[[C++]]とRustを連携させるコードも自動生成できるよう改良を重ね、現在はServo開発チームと密に連携しているRust開発チームに主管を移行して<ref>{{citeweb|author=Yamakaky|date=2016-07-22|url=https://github.com/rust-lang-nursery/rust-bindgen/issues/21|title=merge into upstream! · Issue #21 · rust-lang-nursery/rust-bindgen|publisher=github|accessdate=2018-02-04}}</ref>Servoの開発と共に改良が続けられている<ref>{{citeweb|url=https://github.com/rust-lang-nursery/rust-bindgen|title=rust-lang-nursery/rust-bindgen Automatically generates Rust FFI bindings to C (and some C++) libraries.|accessdate=2018-02-04}}</ref>。
Rust言語が備えるオブジェクトシステムは、impl(実装)、trait([[トレイト]])、struct([[構造体]])を基本として構成される。implが他の言語におけるクラスに近い役割を果たし、継承と多相性はトレイトによって提供される。トレイトにはメソッドを定義することができ、実装によって[[ミックスイン]]される。structにはフィールドが定義可能で、traitとimplはそれ自身にはフィールドは定義できない。[[菱形継承問題]]を回避するためにtraitのみが継承が可能である。


== プログラム例 ==
== 設計と特徴 ==
[[File:Rust 101.webm|thumb|[[linux.conf.au]]で披露されたRustプログラミングで成功するために必要なキーコンセプトを紹介したプレゼンテーション]]
以下のコードはRust 1.0.0 Alphaにおいて正しいプログラムである。文法や意味論は後の版で改変される可能性がある。


=== [[Hello World]] ===
=== パラダイム ===
言語実装手法においての[[プログラミングパラダイム]]は特定の実装手法に限定されない非純粋な[[マルチパラダイムプログラミング言語]]である。文法の表面的な記述は[[手続き型プログラミング]]、ブロックコードのまとまりの意味論は[[関数型言語|関数型プログラミング]]、型システムを用いたオブジェクト構造は[[オブジェクト指向プログラミング]]のパラダイム特性を持つ。特定の[[プログラミングパラダイム]]のみを使用して[[ソースコード]]を記述することはなく、要所々々の必要な所で必要なパラダイムを使用して[[ソースコード]]を記述することになる。

[[ソースコード]]をターゲットプラットフォームに最適化した[[オブジェクトファイル]]に[[コンパイル]]する[[コンパイル言語]]のパラダイム特性を持つ。多くの[[スクリプト言語]]が持つ[[インタプリタ]]機能や、[[Swift (プログラミング言語)|Swift]]や[[Go (プログラミング言語)|Go]]が提供するような{{仮リンク|REPL|en|Read–eval–print loop}}機能のパラダイム特性は持たない。

その他のパラダイムとして、関数の入出力パラメータに[[ジェネリック型]]を指定する[[ジェネリックプログラミング]]、非同期機能を実現する[[並行計算]]のパラダイム特性を持つ。

=== 基礎文法 ===
Rustの基礎的な文法は[[C言語]]や[[C++]]に似て、[[括弧#波括弧{}|波括弧]]で囲まれたブロックコード<code>{ ... }</code>、<code>if</code>, <code>else</code>, <code>while</code>などの[[制御構造|制御フロー]]キーワードを持つ。
全ての[[C言語]]や[[C++]]のキーワードが実装されているわけではなく、一方で幾つかのRustの制御命令(パターンマッチのための<code>match</code>)はそれらの言語を習得したプログラマにとっては馴染みが少ないものも存在する。Rustの命令文は、表面的な[[C言語]]や[[C++]]との文法の類似性にも関わらず、[[プログラム意味論|意味論]]的には[[ML (プログラミング言語)|ML系言語]]の命令式に近しく、関数本体のほぼ全ての部分は制御フロー演算子でさえ「[[文 (プログラミング)|文(statement)]]」ではなく「[[式 (プログラミング)|式(expression)]]」である<ref name="grammar_expr">{{cite web|url=https://github.com/rust-lang/rust/blob/5b13bff5203c1bdc6ac6dc87f69b5359a9503078/src/grammar/parser-lalr.y#L1309-L1573|title=rust/src/grammar/parser-lalr.y|date=2017-05-23|accessdate=28 January, 2018}}</ref>。例えば普通の<code>if</code>式も[[C言語]]で言う所の[[条件演算子]]であり、<code>if</code>式の結果として返り値を返す。

ブロックコード内の命令文のセパレータにはセミコロン(<code>;</code>)を用いるが、[[C言語]]のそれと異なりRustのセミコロンは直前の命令文がブロックコードで括られる式の途中式であることを宣言するためのものである。セミコロンを末尾に置かない命令文はブロックコードの最終的な評価式として扱われ、その式の結果がブロックコードの外へ戻り値として返される<ref>{{citeweb|url=https://www.rust-lang.org/en-US/faq.html#when-should-i-use-an-implicit-return|title=“Frequently Asked Questions · The Rust Programming Language - When should I use an implicit return?|accessdate=2018-01-28}}</ref>。

==== Hello World ====
「Hello, world!」を[[標準出力]]に出力する[[Hello world]]プログラム。
<source lang="rust">
<source lang="rust">
fn main() {
fn main() {
println!("hello, world");
println!("Hello, world!");
}
}
</source>
</source>


=== 階乗 ===
==== 階乗 ====
階乗を求めるプログラム。再帰呼び出によるものと、繰り返処理によるもの。
[[階乗]]を求めるプログラム。<code>if</code>式の結果とて<code>1</code>しくは<code>n * fac_recursive(n-1)</code>を返し、関数結果として<code>if</code>式結果を返す


<source lang="rust">
<source lang="rust">
/* return 文なしに暗黙に値を返すRust言語の機能を示す例である。
関数型様式のプログラムを作成する際に、この特徴は便利である。
C言語やC++言語とは異なり、Rust言語の if は文ではなく式である。
そのため、返し値を伴わなければならない。 */
fn fac_recursive(n: u32) -> u32 {
fn fac_recursive(n: u32) -> u32 {
if n <= 1 {
if n <= 1 {
89行目: 96行目:
}</source>
}</source>


=== 型と多様性 ===
この言語の型システムでは[[Haskell]]言語に倣い「型クラス」を用いることができる。これはアドホックな[[多相性]]を容易にするものであり、可変型宣言により実現されるものである。高類多相性<ref>{{lang-en-short|higher-kinded polymorphism}}</ref>など、Haskell言語にある他の特徴はサポートされていない。

==== 型システム ====
Rust言語が備える[[型システム]]は、impl(実装)、trait([[トレイト]])、struct([[構造体]])およびenum([[列挙型]])を基本として構成される。implが他の言語における[[クラス (コンピュータ)|クラス]]に近い役割を果たし、[[継承 (プログラミング)|継承]]と[[多様性]]はtraitによって提供される。traitには[[メソッド (計算機科学)|メソッド]]を定義することができ、traitで宣言された[[メソッド (計算機科学)|メソッド]]はimplによってstructへ[[ミックスイン]]される。structには[[インスタンス変数|フィールド]]が定義可能で、traitとimplはそれ自身には[[インスタンス変数|フィールド]]は定義できない。enumには複数種類の型のカテゴリ変数が定義可能で、数値型、文字列型、オブジェクト型などの複数の状態を選択的に持ちうる。[[菱形継承問題]]を回避するためにtraitのみが[[継承 (プログラミング)|継承]]が可能である。
<!--
Rust言語のtrait、struct、implを使った[[ミックスイン]]の実例:
<source lang="rust">
<source lang="rust">
// トレイトToLabelStringの宣言
fn fac_iterative(n: u32) -> u32 {
trait ToLabelString {
// 変数は予約語 mut で宣言することで可変になる。
fn to_label_string(self) -> String;
let mut result = 1;
}
for i in 2..n+1 {

result *= i;
// 構造体Personの宣言
struct Person {
name: String
}

// 構造体Personの実装
impl Person {
fn name(&self) -> &str {
&self.name
}
}
}
return result; // 明示的な return 文。関数型の例と対照的。
}</source>


// 構造体PersonへのトレイトToLabelStringの実装(ミックスイン)
impl ToLabelString for Person {
fn to_label_string(self) -> String {
self.name
}
}
</source>
-->

変数の型を決定する[[型システム]]は[[静的型付け]]かつ[[強い型付け]]である。[[型システム#静的型付けと動的型付け|静的型付けと動的型付け]]の区分においての型付けは、[[コンパイル]]時に全ての変数に対して型を決定する[[静的型付け]]のみをサポートしている。そのため、[[Perl]]、[[Python]]のような[[インタプリタ]]言語で見られるような、実行時に変数の型を動的に上書きすることはできない。[[型システム#強い型付けと弱い型付け|強い型付けと弱い型付け]]の区分においての型付けは、実行時に変数の型を[[型変換]](アップキャスト、ダウンキャスト、クロスキャスト)および[[ボックス化|ボクシング]]をすることを許さない強い型付けのみをサポートしている。[[C言語]]、[[Java]]は実行時に[[型変換]]をすることを許す弱い型付けをサポートしているが、Rust言語ではそのような[[型変換]]は認められていない。これら二点の[[静的型付け]]かつ[[強い型付け]]の特性により、変数の型は宣言時のもので決定的に固定される。

==== 型推論 ====
Rust言語ではキーワード「<code>let</code>」で宣言された[[変数 (プログラミング)|変数]]に対して、左辺を変数、右辺を値とする等号式(<code>var = val</code>)で変数値の代入命令がなされた時に、「左辺の[[変数 (プログラミング)|変数]]の型」は「右辺の値の型」であると[[型推論]]がなされる。[[変数 (プログラミング)|変数]]の宣言には必ずしも型を決定するための初期値を必要としない。[[変数 (プログラミング)|変数]]の宣言時に初期値が与えられた場合は「[[変数 (プログラミング)|変数]]の型」は「初期値の型」であると[[型推論]]がなされるが、初期値が与えられなかった場合は以降のブロックコード中のその変数へ値が初めて代入された時に「左辺の[[変数 (プログラミング)|変数]]の型」は「右辺の代入する値の型」であると[[型推論]]がなされる。変数への値の代入を複数回行う場合はキーワード「<code>mut</code>」を付与して宣言する必要がある。変数への代入が型不一致により失敗した場合にはコンパイル時にエラーを検出する<ref name="type-inference">{{cite web|url=http://pcwalton.blogspot.com/2010/10/rust-features-i-type-inference.html|title=Rust Features I: Type Inference|last=Walton|first=Patrick|date=2010-10-01|accessdate=2011-01-21}}</ref>。
<!--
<source lang="rust">
<source lang="rust">
let mut i;
fn fac_iterator(n: u32) -> u32 {
i = 0u32; // ここで初めて変数iをu32型と決定
(1..n + 1).fold(1, |acc, x| acc * x)
i = 1u64; // ここは型不一致でエラー
}</source>
</source>

型が明示された関数の引数に対しては[[型推論]]は行われない。
<source lang="rust">
fn fib(n: u32) -> u32 { }
</source>

なおこれを以下のように、型を省いて記述することはできない。
<source lang="rust">
fn fib(n) -> { }
</source>
-->

==== 多様性の実現 ====
[[多様性]]を実現するため、[[構造体]]の[[インスタンス変数|フィールド]]および[[サブルーチン|関数]]の入出力値は特定の[[トレイト]]の実装をする[[総称型|ジェネリック型]]を指定することが出来る。そのような定義の中では、[[総称型|ジェネリック型]]で型が宣言された変数および入出力値はその[[トレイト]]の特性のみ使用できる。これはジェネリック関数が定義されるとすぐに型判定ができることを意味している。これは[[C++]]の[[ダック・タイピング]]で具体的な型が[[インスタンス|インスタンス化]]されるまで判定できない[[テンプレート (プログラミング)|テンプレート]]とは対照的である。しかし、Rustのジェネリクスの実装は[[C++]]の[[テンプレート (プログラミング)|テンプレート]]の典型的な実装と似ており、[[インスタンス|インスタンス化]]ごとにコードの個別のコピーが生成される。これは[[ポリモーフィズム|モノモーフィゼーション]]<ref>{{lang-en-short| monomorphization}}</ref>と呼ばれ、[[Java]]や[[Haskell]]で通常使用される型消去方式とは対照的である。モノモーフィゼーションの利点は特定のユースケースごとに最適化されたコードであり、欠点は結果のバイナリのコンパイル時間およびサイズが増加することである。Rustの[[トレイト]]を用いた[[多様性]]の実現は、実行時のオーバーヘッドがない「ゼロコスト抽象化」と表現されている<ref>{{citeweb|author=Aaron Turon|url=https://blog.rust-lang.org/2015/05/11/traits.html|title=Abstraction without overhead: traits in Rust - The Rust Programming Language Blog|date=2015-05-11|accessdate=2018-02-04}}</ref>。

=== リソース管理 ===
Rustはメモリやその他リソースの管理に[[RAII]]を採用しており、リソースの利用区間をコンパイル時に静的に検証するボローチェッカー(borrow checker)という機能で実現されている。[[ガベージコレクション]]や[[参照カウント]]とは異なり、コンパイル時に静的にリソースの利用区間を検証することで、実行時のリソース管理コストを少量に抑えている。

==== ボローチェッカー ====
一つのリソースは一つの所有者(変数やブロック)のみに関連付けされるという制約がRust特有のリソース管理機能として存在する。これは、あるリソースの所有権(ownership)はある所有者(owner)が持っている、のように表現される。同時に、リソースの所有権を複数の変数が持つことは出来ない。これは[[C++]]のスマートポインタの一種である<code>unique_ptr</code>の振る舞いに似ている。ボローチェッカーは所有権の競合および不正利用を検証する。

リソースには参照(<code>&</code>記号)の概念が存在し、これは所有権の概念と並行して扱われる。所有権は一つの所有者しか持てないが、参照は複数の所有者が持ちうる。参照は同一のリソースを複数の箇所で利用するために利用される。ただし、所有権によるリソース管理は有効であり、所有権が解放されたリソースを指す参照は同時に無効化される。ボローチェッカーはこの参照についてもライフタイム(lifetimes)としてリソースの生存期間を検証する。

ボローチェッカーはリソースの所有権とライフタイムの両方を静的に解析することで、[[ヌルポインタ]]や{{仮リンク|ダングリングポインタ|label=不正なメモリ域を指すポインター|en|Dangling_pointer}}、[[競合状態|リソース利用競合]]を制限した{{仮リンク|メモリセーフ|en|Memory safety}}な安全性を実現している。

==== 特異なリソース型 ====
リソースのメモリ確保は基本的にはスタックメモリを利用しており、ヒープメモリを利用したメモリ確保は<code>Box</code>や<code>Vec</code>などの特定の型のみで限定的に利用されている。

コンパイル時に型のサイズが決定できない可変長配列を表すような型はヒープメモリを利用する<code>Box</code>型を使用してリソースを管理する。<code>Box</code>リソース自体はスタックメモリで管理されるが、<code>Box</code>リソースが所有権を持つ実態のリソースはヒープメモリで管理される。標準のヒープメモリ確保には<code>jemalloc</code>を利用するが<ref>{{citeweb|author=Nicholas D. Matsakis|url=http://smallcultfollowing.com/babysteps/blog/2014/11/14/allocators-in-rust/|title=Allocators in Rust|date=2014-11-14|accessdate=2018-02-04}}</ref>、対象プラットフォームやビルド時の指定により他のメモリ確保APIを利用することもある。ヒープメモリはスタックメモリに比べて速度性能が落ちるため、必要時にのみ限定的に利用されている。

=== ライブラリ ===
Rustのライブラリはクレート(crate)という呼称で提供される。多くのクレートは[https://crates.io crates.io]で公開されている。同サイトは参照リンクを登録するだけのサイトであり、ソースコードの実態は[[GitHub]]や[[Bitbucket]]などのソースコードをホスティングするサービスで公開されている。クレートは必ずしもcrates.ioに登録されている必要はなく、[[Webサーバ]]や[[ファイルシステム]]を指す[[Uniform Resource Identifier|URI]]で指定することもできる<ref>{{citeweb|author=Rust Team|url=https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#working-with-an-unpublished-minor-version|title=Working with an unpublished minor version|accessdate=2018-01-28}}</ref>。ライブラリはソースコードプロジェクトで配布されることが一般的だが、コンパイルしたバイナリライブラリファイル(拡張子<code>rlib</code>)で出力することも可能である。

==== コアライブラリ ====
コアライブラリはcoreの名称で提供されている<ref>{{citeweb|author=Rust project developers|url=https://doc.rust-lang.org/core/|title=core- Rust|accessdate=2018-01-28}}</ref>。このライブラリは標準ライブラリに依存しない基幹ライブラリであり、一切の上位ライブラリ、システムライブラリ、libcライブラリにリンクしていない。コアライブラリは最小限であり、ヒープ割り当てを認識せず並行性や入出力も提供していない。それらのことはプラットフォームへの調整が必要であり、このライブラリはプラットフォームに依存しない。

==== 標準ライブラリ ====
標準ライブラリはstdの名称で提供されている<ref>{{citeweb|author=Rust project developers|url=https://doc.rust-lang.org/std/|title=std- Rust|accessdate=2018-01-28}}</ref>。このライブラリは基礎的な型(Vec<T>やOption<T>)、言語の基本の処理、標準のマクロ、入出力(I/O)、マルチスレッドなどの機能を提供する。標準ライブラリは標準でリンクしてソフトウェアがビルドされるが、より根幹的なソフトウェアやリソースの小さい組み込み環境ではリンクを外してソフトウェアをビルドすることができる。

==== 外部ライブラリ ====
Rustは基本的で汎用的な機能を含め標準ライブラリではなく外部ライブラリとして提供している。これはいわゆる「電池が付属しています (&ldquo;Battery Included&rdquo;)」の反対を行くもので、言語と共に更新することで保守的になりがちな標準ライブラリではなく、言語とは独立して更新することで最善を繰り返し探求しうる外部ライブラリとすることで、それらの機能をより良い品質で提供する考えに基づいていたものである<ref>{{citeweb|author=Brian Anderson|url=https://blog.rust-lang.org/2017/05/05/libz-blitz.html|title=The Rust Libz Blitz - The Rust Programming Language Blog|date=2017-05-05|accessdate=2018-02-04}}</ref>。外部ライブラリの利便性と品質の保証のために[https://crates.io crates.io]と[https://rust-lang-nursery.github.io/api-guidelines/ APIガイドライン]を提供している。

言語開発のコミュニティがそれらについて携わっていないわけではなく、基礎的な外部ライブラリはコミュニティ配下で開発が進められている。

* 基礎的なライブラリ
** rand - [[擬似乱数|乱数]]生成<ref>{{citeweb|author=The Rust Project Developers|url=https://crates.io/crates/rand|title=rand - Cargo: packages for Rust|accessdate=2018-01-28}}</ref>
** regex - [[正規表現]]<ref>{{citeweb|author=The Rust Project Developers|url=https://crates.io/crates/regex|title=regex - Cargo: packages for Rust|accessdate=2018-01-28}}</ref>
** chrono - [[時刻]]操作<ref>{{citeweb|author=Kang Seonghoon|url=https://crates.io/crates/chrono|title=chrono - Cargo: packages for Rust|accessdate=2018-01-28}}</ref>
** libc - [[C言語]]インターフェース<ref>{{citeweb|author=The Rust Project Developers|url=https://crates.io/crates/libc|title=libc - Cargo: packages for Rust|accessdate=2018-01-28}}</ref>
** log - [[データログ|ログ]]出力インターフェース<ref>{{citeweb|author=The Rust Project Developers|url=https://crates.io/crates/log|title=log - Cargo: packages for Rust|accessdate=2018-01-28}}</ref>

== 開発ツール ==
Rustの開発ツールは独立したソフトウェアとして提供されている。

=== rustc ===
rustcはRustで記述されたRustソースコードをコンパイルするコンパイラ(処理系)である。コンパイルの成果物として[[中間コード]]、および[[実行ファイル]]、[[静的リンク|静的ライブラリ]]、[[動的リンク|動的ライブラリ]]を出力する<ref>{{citebook|last=Blandy|first=Jim|year=2017|title=Programming Rust|publisher=O'Reilly Media, Inc|page=285|isbn=1491927283}}</ref>。rustcは[[クロスコンパイル]]を可能とし、[[Microsoft Windows|Windows]]、[[Linux]]、[[macOS]]向けの実行ファイル他、[[Android]]や[[iOS]]で動作するライブラリをホストマシンで出力することができる<ref>{{citeweb|author=Brian Anderson|url=https://blog.rust-lang.org/2016/05/13/rustup.html|title=Taking Rust everywhere with rustup|date=2016-05-13|accessdate=2018-01-28}}</ref>。

対象プラットフォームは完成度に合わせて3つのティアに分かれている<ref name="rust-platform-support">{{citeweb|url=https://forge.rust-lang.org/platform-support.html|title=Rust Platform Support &middot; The Rust Programming Language|accessdate=2018-02-04}}</ref>。ティア1はバイナリリリースが提供されており、{{仮リンク|自動ビルド|en|Build automation}}と[[テスト自動化|自動テスト]]が整備され、それらが安定して成功(パス)することが保証されている。
ティア2はバイナリリリースが提供されており、自動ビルドと自動テストは整備されているがテストが成功することは保証されていない。ティア3は[[ソースコード]]としては対応しているが、自動ビルドと自動テストの動作が保証されておらず、公式リリースは提供されていない。

[[Microsoft Windows|Windows]]、[[Linux]]、[[macOS]]向けのRust[[コンパイラ]]はティア1でリリースされている。[[Android]]、[[iOS]]、[[WebAssembly]]向けのRust[[コンパイラ]]はティア2でリリースされている。

Rust 1.12版より導入されたMIR (Mid-level IR)<ref name="MIR">{{cite web|url=https://blog.rust-lang.org/2016/04/19/MIR.html|title=Introducing MIR|last=Matsakis|first=Niko|date=2016-04-19|accessdate=2016-10-04}}</ref> によって、コンパイルと実行時間の迅速化ならびに型チェックの正確性の実現が図られている。

=== cargo ===
cargoはrust製ソフトウェアプロジェクトのCUIのビルドツールである。規定のファイル構成(ディレクトリ、設定ファイル、ソースファイル)のプロジェクトディレクトリで利用される。プロジェクトのビルド(コンパイル)、依存ライブラリのダウンロード、テスト、ドキュメント生成などをサポートする<ref>{{citeweb|author=Yehuda Katz|url=https://blog.rust-lang.org/2016/05/05/cargo-pillars.html|title=Cargo: predictable dependency management - The Rust Programming Language Blog|date=2016-05-05|accessdate=2018-02-04}}</ref>。cargoの依存ライブラリのダウンロード先は[https://crates.io/ crates.io]である<ref>{{citeweb|author=Alex Crichton|url=https://blog.rust-lang.org/2014/11/20/Cargo.html|title=Cargo: Rust's community crate host|date=2014-11-20|accessdate=2018-01-28}}</ref>。
サブコマンドは拡張可能で標準のコマンドの他、README.mdファイルの自動生成コマンド<ref>{{citeweb|author=livioribeiro|url=https://users.rust-lang.org/t/cargo-readme-generate-readme-md-from-doc-comments/3306|title=Cargo-readme: generate README.md from doc comments|date=2015-10-15|accessdate=2018-01-28}}</ref>などの拡張コマンドが存在する。

=== rustup ===
{{Infobox Software
| 名称 = rustup
| 開発元 = Rust Project Developers
| 初版 = {{Start date and age|2016|4|15}}
| 最新版 = 1.10.0
| 最新版発表日 = {{Start date and age|2018|1|25}}
| リポジトリ = https://github.com/rust-lang-nursery/rustup.rs
| プログラミング言語 = Rust
| 対応OS = Windows, Linux, macOS
| 対応プラットフォーム =
| 対応言語 =
| サポート状況 =
| 種別 =
| ライセンス =
| 公式サイト = https://www.rustup.rs
}}

rustupは[[ツールチェーン]]の管理ソフトウェアである。[[ツールチェーン]]のダウンロードとインストール、ソフトウェアバージョンの管理、コンパイルターゲットの切り替えの機能を提供する<ref>{{citeweb|author=|url=http://www.shadercat.com/rustup-aka-how-to-install-rust-the-convenient-way/|title=RustUp aka How to install rust the convenient way|date=2016-06-02|accessdate=2018-02-04}}</ref><ref>{{citeweb|author=Brian Anderson|url=https://blog.rust-lang.org/2016/05/13/rustup.html|title=Taking Rust everywhere with rustup - The Rust Programming Language Blog|date=2016-05-13|accessdate=2018-02-04}}</ref>。

==== 機能 ====
rustupはRustプロジェクトがリリースしている[[コンパイラ]](rustc)、[[ビルドツール]](cargo)などの[[ツールチェーン]]をインターネットを経由してホストマシンにダウンロード、インストールおよびマネージメントする機能を提供する。インストール対象の[[ツールチェーン]]のバージョンは、安定版、ベータ版、{{仮リンク|デイリービルド|label=ナイトリー|en|Daily build}}版の全てを含んでおり、利用者が必要とするバージョンを指定してダウンロードすることができる。また、ターゲットプラットフォームについても全ての種類を含んでおり、ホストマシンと異なるプラットフォーム(例えば、ホストが[[macOS]]であっても[[Microsoft Windows|Windows]]や[[Android]]、[[iOS (アップル)|iOS]])のコンパイラをインストールすることができる。この場合、コンパイラは[[クロスコンパイラ]]として動作してターゲットプラットフォームに合わせたビルドを実施する。

==== 歴史 ====
Rust 1.13版以前は[[シェルスクリプト]]で実装された<code>rustup.sh</code>が公開されていた<ref>{{citeweb|author=vanjacosic|url=https://github.com/rust-lang/rust/blob/1.13.0/src/doc/book/getting-started.md#installing-on-linux-or-mac|title=rust/getting-started.md at 1.13.0 · rust-lang/rust|date=2016-09-27|accessdate=2018-02-04}}</ref>。これと並行してRust言語で実装された同等機能を提供する<code>rustup.rs</code>の開発が進められており、Rust 1.14版で<code>rustup.sh</code>は非推奨となり<ref>{{citeweb|url=https://github.com/rust-lang-deprecated/rustup.sh|title=rust-lang-deprecated/rustup.sh: The rustup.sh script for installing Rust from release channels|accessdate=2018-01-28}}</ref>、Rust 1.14版以降は<code>rustup.rs</code>が公式リリースとして提供されている<ref>{{citeweb|author=vanjacosic|url=https://github.com/rust-lang/rust/blob/1.14.0/src/doc/book/getting-started.md#installing-rust-1|title=rust/getting-started.md at 1.14.0 · rust-lang/rust|date=2016-12-17|accessdate=2018-02-04}}</ref><ref>{{citeweb|url=https://github.com/rust-lang-nursery/rustup.rs|title=rust-lang-nursery/rustup.rs: The Rust toolchain installer|accessdate=2018-01-28}}</ref>。

== 評価 ==
Rustは2016年、2017年の[[Stack Overflow]] Developer Surveyで「最も愛されているプログラミング言語」で一位を獲得し<ref name="stackoverflow-mostloved-2016">{{Cite web|url=https://stackoverflow.com/insights/survey/2016#technology-most-loved-dreaded-and-wanted|title=Stack Overflow Developer Survey 2016 Results|website=Stack Overflow|access-date=2017-03-22}}</ref><ref name="stackoverflow-mostloved-2017">{{Cite web|url=https://stackoverflow.com/insights/survey/2017#most-loved-dreaded-and-wanted|title=Stack Overflow Developer Survey 2017|website=Stack Overflow|access-date=2017-03-22}}</ref>、プログラマの好意的な評価は多い。

一方で、Rustは学習難易度が高い言語とも考えられている<ref>{{citeweb|first=Steve|last=Klabnik|date=2014-10-24|url=https://www.codementor.io/steveklabnik/interview-with-steve-klabnik-how-rust-compares-to-other-languages-and-more-8t5ut6nau|title=Interview with Steve Klabnik: How Rust Compares to Other Languages and More|publisher=codementor|quote=Rust has a significant lack of resources because it’s so new, and so it’s much harder as a first language.|accessdate=2018-02-04}}</ref>。多くのRust初学者のプログラマにおいて、自身が正しいと思って書いたソースコードのコンパイルに対してコンパイラ(ボローチェッカー)がエラーを検出する、「ボローチェッカーとの戦い」(fighting with the borrow checker)が発生しがちである<ref>{{citeweb|url=https://github.com/rust-lang/book/blob/master/first-edition/src/references-and-borrowing.md#meta|title=book/references-and-borrowing.md at master · rust-lang/book|quote=Many new users to Rust experience something we like to call ‘fighting with the borrow checker’|date=2017-05-10|accessdate=2018-02-04}}</ref><ref>{{citeweb|author=Ivan Sagalaev|url=https://news.ycombinator.com/item?id=11093389|title=Why Rust&#39;s ownership/borrowing is hard|date=2016-11-02|accessdate=2018-02-04}}</ref>。小さなアプリケーションの実装について同時期に言語開発されている[[Go (プログラミング言語)|Go言語]]と比較した場合、Rust言語より[[Go (プログラミング言語)|Go言語]]の方が開発効率が良いという評価がある<ref name="go-vs-rust">{{citeweb|author=Matthias Endler|url=https://matthias-endler.de/2017/go-vs-rust/|title=Go vs Rust? Choose Go.|date=2017-09-15|accessdate=2018-01-28}}</ref>。学習難易度の高さは開発チームも認識しており、2017年ロードマップでは学習曲線の改善を目的として挙げていた<ref name="roadmap-2017">{{citeweb|author=Aaron Turon|url=https://blog.rust-lang.org/2017/02/06/roadmap.html|title=Rust's 2017 roadmap|accessdate=2018-01-28}}</ref><ref>{{citeweb|author=Aaron Turon|url=https://github.com/rust-lang/rust-roadmap/issues/3|title=Rust should have a lower learning curve|accessdate=2018-01-28}}</ref>。

Rustの実行時速度性能は同じくコンパイラに[[LLVM]]を利用している場合の[[C言語]]と同等程度であり<ref>{{citeweb|url=http://pcwalton.blogspot.jp/2010/12/c-design-goals-in-context-of-rust.html|title=Miscellany: C++ design goals in the context of Rust|accessdate=2018-01-28}}</ref><ref>{{citeweb|url=https://www.rust-lang.org/en-US/faq.html#how-fast-is-rust|title=Frequently Asked Questions &middot; The Rust Programming Language - How fast is Rust?|accessdate=2018-01-28}}</ref>、一部の処理では[[C言語]]を上回った速度が確認されている<ref name="benchmarksgame-rust">{{citeweb|first=Gouy|last=Isaac|url=https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=rust&lang2=gpp|title=Rust&nbsp;vs&nbsp;C++ g++ (64-bit Ubuntu quad core) | Computer Language Benchmarks Game|accessdate=2018-02-04}}</ref>。

== Rustで実装されたソフトウェア ==
RustコンパイラはRust自身で記述されている<ref name="rust-in-rust"/>。


その他のRustを使って開発されているプロジェクト:
== 言語の発展 ==
* ウェブブラウザ
この言語の開発の初期の頃、変数名や関数名など識別子として[[ASCII]]文字以外の文字を使うことは禁じられていた。言語についてのある質疑応答の中で、現場の非英語圏のプログラマーのほとんどが識別子にはASCII文字を使っていると述べられていた。しかしその制限は反論を引き出すことになった<ref name="ascii-lexeme-criticism">{{cite web|url=http://broadcast.oreilly.com/2010/08/vale-java-scala-vala-palava.html#comment-3572710|title=Vale Java? Scala Vala palava|last=Jelliffe|first=Rick|date=2010-11-08|accessdate=2012-03-29|quote={{lang|en|… It is just plain ignorant to say that non-English programmers always write with ASCII. (Just as it would be ignorant to say that they never do.) It is that kind of rather blithe dismissal that foreign cultures and languages need to be supported that creates extra unnecessary barriers. That argument ran out of legs in the early 1990s: all platforms have well -established Unicode libraries with serviceable properties for this…}}}}</ref>。それで、2011年2月に言語に変更が行われ、この制限は削除された<ref name="ascii-lexeme-update">{{cite web|url=https://github.com/mozilla/rust/commit/dabccadd3202513ab0bcb424e2c62c90ab23062d|title=Commit dabccadd3202513ab0bcb424e2c62c90ab23062d|date=2011-02-26|accessdate=2012-01-11}}</ref>。
** [[Mozilla Firefox]]<ref>{{citeweb|author=Dave Herman|url=https://hacks.mozilla.org/2016/07/shipping-rust-in-firefox/|title=Shipping Rust in Firefox|accessdate=2018-01-28}}</ref>
*** [[Servo]] – [[HTMLレンダリングエンジン]]<ref>{{citeweb|author=Serdar Yegulalp|url=https://www.infoworld.com/article/2905688/applications/mozillas-rust-based-servo-browser-engine-inches-forward.html|title=Mozilla's Rust-based Servo browser engine inches forward|accessdate=2018-01-28}}</ref>
*** Quantum – ウェブエンジン<ref>{{citeweb|author=David Bryant|url=https://medium.com/mozilla-tech/a-quantum-leap-for-the-web-a3b7174b3c12|title=A Quantum Leap for the Web|accessdate=2018-01-28}}</ref>
* ビルドツール
** Cargo – Rustの[[ビルド (ソフトウェア)|ビルドツール]]
** Habitat – {{仮リンク|チェフソフトウェア|en|Chef (software)}}の開発する[[ソフトウェアデプロイメント]]ツール<ref>{{citeweb|author=Salim Alam|url=https://blog.chef.io/2016/09/23/habitat-at-rustconf/|title=Habitat at RustConf|accessdate=2018-01-28}}</ref>
* [[オペレーティングシステム|OS]]
** Magic Pocket – [[Dropbox]]の[[ペタバイト]]を管理する機器の[[ファイルシステム]]<ref>{{citeweb|author=Salim Alam|url=https://www.wired.com/2016/03/epic-story-dropboxs-exodus-amazon-cloud-empire/|title=The Epic Story of Dropbox's Exodus From the Amazon Cloud Empire | WIRED|accessdate=2018-01-28}}</ref>
** [[Redox OS]] – [[マイクロカーネル]][[オペレーティングシステム]]<ref>{{citeweb|author=Serdar Yegulalp|url=https://www.infoworld.com/article/3046100/open-source-tools/rusts-redox-os-could-show-linux-a-few-new-tricks.html|title=The Epic Story of Dropbox's Exodus From the Amazon Cloud Empire | WIRED|accessdate=2018-01-28}}</ref>
** intermezzOS – システムプログラミングの試験的な[[オペレーティングシステム]]<ref>{{citeweb|author=Steve Klabnik|url=https://intermezzos.github.io|title=intermezzOS: a little OS|accessdate=2018-01-28}}</ref>
** Stratis – [[Fedora]] 28で予定される[[ファイルシステム]] <ref>{{cite web| url=https://www.marksei.com/red-hat-deprecates-btrfs-stratis/|title=Red Hat deprecates BTRFS, is Stratis the new ZFS-like hope? | work = Marksei, Weekly sysadmin pills|accessdate=2018-01-28}}</ref>
** Railcar – [[オラクル (企業)|Oracle]]の[[仮想化]]マシン<ref name="railcar">{{cite news|title=Building a Container Runtime in Rust|url=https://blogs.oracle.com/developers/building-a-container-runtime-in-rust|accessdate=8 July 2017|date=29 June 2017|quote=Why Rust? (…) Rust sits at a perfect intersection of [C and Go]: it has memory safety and higher-level primitives, but doesn't sacrifice low level control over threading and therefore can handle namespaces properly.}}</ref>
* その他
** Exonum – [[ブロックチェーン]]のオープンソースフレームワーク<ref>{{citeweb|author=Valery Vavilov|url=https://medium.com/@valeryvavilov/as-blockchain-changes-the-world-bitfurys-new-platform-exonum-is-about-to-change-blockchain-cc13963f8501|title=As Blockchain Changes The World, Bitfury’s New Platform Exonum is About to Change Blockchain|accessdate=2018-01-28}}</ref>
** [[OpenDNS]] – ソリューションの内の2つのコンポーネント<ref>{{cite book|last1=Balbaert|first1=Ivo|title=Rust Essentials|publisher=Packt Publishing|isbn=1785285769|page=6|url=https://books.google.com/books?id=TeiuCQAAQBAJ&pg=PA6&lpg=PA6&dq=OpenDNS+Rust&source=bl&ots=UL5thAAi8w&sig=Wf-Z5xSRYU-IXyGiyIl2FVEQWEc&hl=en&sa=X&ved=0ahUKEwizzdSk59LLAhVpnoMKHWdbDrQQ6AEINzAF#v=onepage&q=OpenDNS%20Rust&f=false|accessdate=21 March 2016}}</ref><ref>{{cite web|last1=Frank|first1=Denis|title=Using HyperLogLog to Detect Malware Faster Than Ever|url=https://labs.opendns.com/2013/12/05/hyperloglog-and-malware-detection/|website=OpenDNS Security Labs|accessdate=19 March 2016}}</ref><ref>{{cite web|last1=Denis|first1=Frank|title=ZeroMQ: Helping us Block Malicious Domains in Real Time |url=https://labs.opendns.com/2013/10/04/zeromq-helping-us-block-malicious-domains/|website=OpenDNS Security Labs|accessdate=19 March 2016}}</ref>
** Piston – [[ゲームエンジン]]<ref>{{cite web |title=Piston A modular game engine written in Rust |url=http://www.piston.rs/ |work=Piston.rs |accessdate=2017-08-01}}</ref>
** rustls – [[Transport Layer Security|TLS]]のRust実装<ref>{{citeweb|author=Joseph Birr-Pixton|url=https://github.com/ctz/rustls|title=ctz/rustls: A modern TLS library in Rust|accessdate=2018-02-04}}</ref>
** REmacs – [[Emacs]]のRust実装 <ref>{{cite web|last1=Larabel|first1=Michael|url=https://www.phoronix.com/scan.php?page=news_item&px=Remacs-Rust-Emacs |title=Remacs:Re-Implementing Emacs In Rust|website=phoronix.com|date=2017-01-11|accessdate=2017-01-19}}</ref>
** Pijul – [[Darcs]]を参考にした[[バージョン管理システム]]<ref>{{cite web|title=Pijul|url=https://pijul.org/|website=pijul.org|accessdate=8 July 2017}}</ref>
** Xi – [[Google Open Source]]で開発されている[[テキストエディタ]]<ref>{{citeweb|author=Google|url=https://opensource.google.com/projects/xi-editor|title=xi-editor|accessdate=2018-01-28}}</ref>
** ripgrep – [[grep]]に相当する高速なテキスト検索ツール<ref>{{citeweb|author=Andrew Gallant|url=https://blog.burntsushi.net/ripgrep/|title=ripgrep is faster than {grep, ag, git grep, ucg, pt, sift}|date=2016-09-23|accessdate=2018-01-28}}</ref>


== 脚注 ==
== 出典 ==
{{Reflist|30em}}
{{Reflist|30em}}


== 外部リンク ==
== 外部リンク ==
* [https://www.rust-lang.org/ Rust 公式サイト]
* [https://www.rust-lang.org/ Rust 公式サイト]
* [https://github.com/mozilla/rust/wiki Rust Language Wiki]
* [https://crates.io crates.io Rust Package Registry]
* [https://mail.mozilla.org/pipermail/rust-dev/ The Rust-dev Archives (electronic mailing list)]
* [https://mail.mozilla.org/pipermail/rust-dev/ The Rust-dev Archives (electronic mailing list)]
* [https://github.com/mozilla/rust Primary source code repository and bug tracker]
* [https://github.com/rust-lang/rust Primary source code repository and bug tracker]


{{プログラミング言語一覧}}
{{プログラミング言語一覧}}

2018年2月26日 (月) 04:50時点における版

Rust
Rustのロゴ
パラダイム マルチパラダイムコンパイル命令型関数型オブジェクト指向構造化ジェネリック並行計算
登場時期 2010年
設計者 グレイドン・ホアレ
開発者 Rust Project Developers
最新リリース 1.23[1]/ 2018年1月4日 (6年前) (2018-01-04)
型付け 静的型付け強い型付け型推論、構造化データ
主な処理系 rustc
影響を受けた言語 Alef, C++, C#, Cyclone, SML, OCaml, Erlang, Haskell, Limbo, ML, Newsqueak, Scheme, Swift, Unicode Annex #31[2]
影響を与えた言語 Swift
プラットフォーム FreeBSD, Linux, macOS, Windows, Android, iOS, WebAssembly[3]
ライセンス Apache License 2.0, MIT
ウェブサイト www.rust-lang.org
拡張子 rs, rlib
テンプレートを表示

Rust(ラスト)はMozillaが支援する[4][5]オープンソースシステムプログラミング言語である。

Rust言語は速度、並行性、安全性を言語仕様として保証するC言語C++に代わるシステムプログラミング英語版に適したプログラミング言語を目指している[6]。2006年の開発初期はグレイドン・ホアレの個人プロジェクトだったが、2009年にMozillaが開発に関わり始めてMozilla Researchの公式プロジェクトとなった[4]。2015年に1.0版がリリースされるまでにいくつもの破壊的な仕様変更があったが、1.0版以降は基本的には後方互換を保って6週間間隔で定期的にリリースされている。プロジェクトはオープンソースのコミュニティベース開発で進行しており[7]、言語仕様(検討段階含む)、ソースコード、ドキュメントはオープンソースライセンスで公開されている[8]

Rustはマルチパラダイムプログラミング言語であり、手続き型プログラミングオブジェクト指向プログラミング関数型プログラミングなどの実装手法をサポートしている。基本的な制御フローC言語に似ているが、ほぼ全ての命令文が式(expression)であるという点においてはML言語に似ている。コンパイル基盤にMIRとLLVMを用いており[9]、実行時速度性能はC言語と同等程度である[10]。強力な型システムとリソース管理の仕組みにより、メモリセーフ英語版な安全性が保証されている。

Rustは2016年、2017年のStack Overflow Developer Surveyで「最も愛されているプログラミング言語」で一位を獲得している[11][12]。一方で、Rustは学習難易度が高い言語とも考えられており[13]、2017年ロードマップでは学習曲線の改善を目的として挙げていた[14]

歴史

誕生

2006年、Mozillaで働いていたグレイドン・ホアレ[15]は現代のインターネット環境で高い並行性と高い安全性が求められるシステムプログラミング言語としてC言語C++に代わりうるプログラミング言語 Rust言語の開発に着手した[6]MozillaがRustの開発に関わりはじめたのは2009年で[16][4]、Rustは2010年のモジラ・サミットで公に姿を表した[17]。RustソースコードコンパイルするRustコンパイラは、初期の頃はOCaml言語で作られたコンパイラ(rustboot)が用いられていたが[18]、2010年にはRust言語自身でRustコンパイラを作るセルフホスティングへ移行したコンパイラ(rustc)の開発が始められ[19]、翌年にはブートストラップ問題を解決した最初の完動品が完成した[20]。この時よりRustコンパイラはコンパイル基盤にLLVMを用いたものとなった[21]

0.x版

プレアルファ(0.1版)と呼ばれる最初のバージョンは2012年1月にリリースされた[22]。Mozillaはこれを新しいモノ好みの人やプログラミング言語愛好家のためのアルファ版と位置づけていた。最初の安定版である1.0版がリリースされるまでの0.x版リリースでは、いくつもの大きな破壊的な仕様変更が言語およびライブラリに加えられた。

変数名や関数名など識別子は、この言語の開発の初期の頃は、ASCII文字以外の文字を使うことが禁じられていた。言語についてのある質疑応答の中で、現場の非英語圏のプログラマーのほとんどが識別子にはASCII文字を使っていると述べられていた。しかしその制限は反論を引き出すことになった[23]。それにより、2011年2月に言語に変更が行われ、この制限は削除された[24]

判定は、0.4版以前の従来の静的型付けに加えて、型状態システムをサポートしていた。型状態システムは、特別なcheck文を使用してプログラム文の前後での型決定をモデル化した。C言語やC++コードでのアサーションの場合と同様に、プログラム実行中ではなくコンパイル時に型不一致を検出する。型状態の概念はRust特有のものではなく、NILで採用されていたものである[25]。実際にはほとんど使用されていなかったため型状態は削除されたが、ブランディングパターンで同じ機能を実現できる[26]

オブジェクト指向のシステムは、0.2版から0.4版にかけて大きく変わっていった。0.2版で初めてクラス(class)が導入され、0.3版でインターフェース(interface)を通したデストラクタ多様性が追加され、0.4版で継承を提供する手段としてトレイト(trait)が追加された。インターフェースはトレイトに一部の機能が統合されて、異なる不要な機能として削除された。クラスもまた削除され、構造体とトレイトを使用したミックスインに置き換えられた。

コアのメモリモデルは、0.9版から0.11版の間、2つのビルトインのポインタ型(ヒープメモリ型~とガベージコレクション型@)を機能を単純化するために用意していた。それらは、標準ライブラリのBox型とGc型で置き換えられ、Gc型は最終的には削除された[27]

2014年1月、主開発者のアンドリュー・ビンストックはDr. Dobb's JournalD言語Go言語Nim言語と同様にC++の競争相手になる機会を得たとコメントした。ビンストックによると、Rustは非常にエレガントな言語として広く見られているが、バージョン間で繰り返し大きく変更されたため発表が遅れたとのことである[28]

1.x版

2015年5月16日、安定版となるRust 1.0がリリースされた[29]。1.0版の後、安定版およびベータ版が6週間おきに定期リリースされている[30]。またナイトリー版が毎日リリースされている[31]。新たな機能はナイトリー版で開発が進められ、ベータ版で動作が検証されている[32]

2016年8月2日にリリースされたFirefox 48にはRustで書き直されたメディアパーサが組み込まれており、Mozillaが開発しているブラウザFirefoxにおいてRustで書かれたコードが書き加えられる初例となった[33][34]

2016年9月にRustはFedora 24の標準コンポーネントに加えられ、RPMパッケージ管理システムを用いてのインストール作業が容易化されている[35]

開発体系

Rustはオープンソースのコミュニティベースで開発が進められている。プロジェクトの主管はRust Project Developers(Rust開発チーム)である[36]。2018年現在、言語発明者のグレイドン・ホアレはプロジェクトチームから外れている。プロジェクトの全てのソースコードgithubで一般に公開されており[37]、コミュニティメンバーの協力により改良が進められる。プロジェクトの大部分のコミットはコミュニティメンバーによるものである[38]

Mozillaの理念[39]を守り、Rust言語は社会に開かれており、言語やツールに対する仕様の提案はRFCの形で取りまとめられ[40]、関連するチケットで仕様詳細について利用者から感想や提言を受けている[41][42]

言語やコアライブラリを開発するRust開発チームはServoウェブブラウザレイアウトエンジン)やRustコンパイラの実装経験を通して言語を改良している。例えば、C言語とRustを連携させるコードを自動生成するbindgenは元々は外部開発者が開発していたが[43]、Mozilla Servo開発チームがServoの開発で利用するためにC++とRustを連携させるコードも自動生成できるよう改良を重ね、現在はServo開発チームと密に連携しているRust開発チームに主管を移行して[44]Servoの開発と共に改良が続けられている[45]

設計と特徴

linux.conf.auで披露されたRustプログラミングで成功するために必要なキーコンセプトを紹介したプレゼンテーション

パラダイム

言語実装手法においてのプログラミングパラダイムは特定の実装手法に限定されない非純粋なマルチパラダイムプログラミング言語である。文法の表面的な記述は手続き型プログラミング、ブロックコードのまとまりの意味論は関数型プログラミング、型システムを用いたオブジェクト構造はオブジェクト指向プログラミングのパラダイム特性を持つ。特定のプログラミングパラダイムのみを使用してソースコードを記述することはなく、要所々々の必要な所で必要なパラダイムを使用してソースコードを記述することになる。

ソースコードをターゲットプラットフォームに最適化したオブジェクトファイルコンパイルするコンパイル言語のパラダイム特性を持つ。多くのスクリプト言語が持つインタプリタ機能や、SwiftGoが提供するようなREPL機能のパラダイム特性は持たない。

その他のパラダイムとして、関数の入出力パラメータにジェネリック型を指定するジェネリックプログラミング、非同期機能を実現する並行計算のパラダイム特性を持つ。

基礎文法

Rustの基礎的な文法はC言語C++に似て、波括弧で囲まれたブロックコード{ ... }if, else, whileなどの制御フローキーワードを持つ。 全てのC言語C++のキーワードが実装されているわけではなく、一方で幾つかのRustの制御命令(パターンマッチのためのmatch)はそれらの言語を習得したプログラマにとっては馴染みが少ないものも存在する。Rustの命令文は、表面的なC言語C++との文法の類似性にも関わらず、意味論的にはML系言語の命令式に近しく、関数本体のほぼ全ての部分は制御フロー演算子でさえ「文(statement)」ではなく「式(expression)」である[46]。例えば普通のif式もC言語で言う所の条件演算子であり、if式の結果として返り値を返す。

ブロックコード内の命令文のセパレータにはセミコロン(;)を用いるが、C言語のそれと異なりRustのセミコロンは直前の命令文がブロックコードで括られる式の途中式であることを宣言するためのものである。セミコロンを末尾に置かない命令文はブロックコードの最終的な評価式として扱われ、その式の結果がブロックコードの外へ戻り値として返される[47]

Hello World

「Hello, world!」を標準出力に出力するHello worldプログラム。

fn main() {
    println!("Hello, world!");
}

階乗

階乗を求めるプログラム。if式の結果として1もしくはn * fac_recursive(n-1)を返し、関数の結果としてif式の結果を返す。

fn fac_recursive(n: u32) -> u32 {
    if n <= 1 {
        1
    } else {
        n * fac_recursive(n-1)
    }
}

型と多様性

この言語の型システムではHaskell言語に倣い「型クラス」を用いることができる。これはアドホックな多相性を容易にするものであり、可変型宣言により実現されるものである。高類多相性[48]など、Haskell言語にある他の特徴はサポートされていない。

型システム

Rust言語が備える型システムは、impl(実装)、trait(トレイト)、struct(構造体)およびenum(列挙型)を基本として構成される。implが他の言語におけるクラスに近い役割を果たし、継承多様性はtraitによって提供される。traitにはメソッドを定義することができ、traitで宣言されたメソッドはimplによってstructへミックスインされる。structにはフィールドが定義可能で、traitとimplはそれ自身にはフィールドは定義できない。enumには複数種類の型のカテゴリ変数が定義可能で、数値型、文字列型、オブジェクト型などの複数の状態を選択的に持ちうる。菱形継承問題を回避するためにtraitのみが継承が可能である。

変数の型を決定する型システム静的型付けかつ強い型付けである。静的型付けと動的型付けの区分においての型付けは、コンパイル時に全ての変数に対して型を決定する静的型付けのみをサポートしている。そのため、PerlPythonのようなインタプリタ言語で見られるような、実行時に変数の型を動的に上書きすることはできない。強い型付けと弱い型付けの区分においての型付けは、実行時に変数の型を型変換(アップキャスト、ダウンキャスト、クロスキャスト)およびボクシングをすることを許さない強い型付けのみをサポートしている。C言語Javaは実行時に型変換をすることを許す弱い型付けをサポートしているが、Rust言語ではそのような型変換は認められていない。これら二点の静的型付けかつ強い型付けの特性により、変数の型は宣言時のもので決定的に固定される。

型推論

Rust言語ではキーワード「let」で宣言された変数に対して、左辺を変数、右辺を値とする等号式(var = val)で変数値の代入命令がなされた時に、「左辺の変数の型」は「右辺の値の型」であると型推論がなされる。変数の宣言には必ずしも型を決定するための初期値を必要としない。変数の宣言時に初期値が与えられた場合は「変数の型」は「初期値の型」であると型推論がなされるが、初期値が与えられなかった場合は以降のブロックコード中のその変数へ値が初めて代入された時に「左辺の変数の型」は「右辺の代入する値の型」であると型推論がなされる。変数への値の代入を複数回行う場合はキーワード「mut」を付与して宣言する必要がある。変数への代入が型不一致により失敗した場合にはコンパイル時にエラーを検出する[49]

多様性の実現

多様性を実現するため、構造体フィールドおよび関数の入出力値は特定のトレイトの実装をするジェネリック型を指定することが出来る。そのような定義の中では、ジェネリック型で型が宣言された変数および入出力値はそのトレイトの特性のみ使用できる。これはジェネリック関数が定義されるとすぐに型判定ができることを意味している。これはC++ダック・タイピングで具体的な型がインスタンス化されるまで判定できないテンプレートとは対照的である。しかし、Rustのジェネリクスの実装はC++テンプレートの典型的な実装と似ており、インスタンス化ごとにコードの個別のコピーが生成される。これはモノモーフィゼーション[50]と呼ばれ、JavaHaskellで通常使用される型消去方式とは対照的である。モノモーフィゼーションの利点は特定のユースケースごとに最適化されたコードであり、欠点は結果のバイナリのコンパイル時間およびサイズが増加することである。Rustのトレイトを用いた多様性の実現は、実行時のオーバーヘッドがない「ゼロコスト抽象化」と表現されている[51]

リソース管理

Rustはメモリやその他リソースの管理にRAIIを採用しており、リソースの利用区間をコンパイル時に静的に検証するボローチェッカー(borrow checker)という機能で実現されている。ガベージコレクション参照カウントとは異なり、コンパイル時に静的にリソースの利用区間を検証することで、実行時のリソース管理コストを少量に抑えている。

ボローチェッカー

一つのリソースは一つの所有者(変数やブロック)のみに関連付けされるという制約がRust特有のリソース管理機能として存在する。これは、あるリソースの所有権(ownership)はある所有者(owner)が持っている、のように表現される。同時に、リソースの所有権を複数の変数が持つことは出来ない。これはC++のスマートポインタの一種であるunique_ptrの振る舞いに似ている。ボローチェッカーは所有権の競合および不正利用を検証する。

リソースには参照(&記号)の概念が存在し、これは所有権の概念と並行して扱われる。所有権は一つの所有者しか持てないが、参照は複数の所有者が持ちうる。参照は同一のリソースを複数の箇所で利用するために利用される。ただし、所有権によるリソース管理は有効であり、所有権が解放されたリソースを指す参照は同時に無効化される。ボローチェッカーはこの参照についてもライフタイム(lifetimes)としてリソースの生存期間を検証する。

ボローチェッカーはリソースの所有権とライフタイムの両方を静的に解析することで、ヌルポインタ不正なメモリ域を指すポインター英語版リソース利用競合を制限したメモリセーフ英語版な安全性を実現している。

特異なリソース型

リソースのメモリ確保は基本的にはスタックメモリを利用しており、ヒープメモリを利用したメモリ確保はBoxVecなどの特定の型のみで限定的に利用されている。

コンパイル時に型のサイズが決定できない可変長配列を表すような型はヒープメモリを利用するBox型を使用してリソースを管理する。Boxリソース自体はスタックメモリで管理されるが、Boxリソースが所有権を持つ実態のリソースはヒープメモリで管理される。標準のヒープメモリ確保にはjemallocを利用するが[52]、対象プラットフォームやビルド時の指定により他のメモリ確保APIを利用することもある。ヒープメモリはスタックメモリに比べて速度性能が落ちるため、必要時にのみ限定的に利用されている。

ライブラリ

Rustのライブラリはクレート(crate)という呼称で提供される。多くのクレートはcrates.ioで公開されている。同サイトは参照リンクを登録するだけのサイトであり、ソースコードの実態はGitHubBitbucketなどのソースコードをホスティングするサービスで公開されている。クレートは必ずしもcrates.ioに登録されている必要はなく、Webサーバファイルシステムを指すURIで指定することもできる[53]。ライブラリはソースコードプロジェクトで配布されることが一般的だが、コンパイルしたバイナリライブラリファイル(拡張子rlib)で出力することも可能である。

コアライブラリ

コアライブラリはcoreの名称で提供されている[54]。このライブラリは標準ライブラリに依存しない基幹ライブラリであり、一切の上位ライブラリ、システムライブラリ、libcライブラリにリンクしていない。コアライブラリは最小限であり、ヒープ割り当てを認識せず並行性や入出力も提供していない。それらのことはプラットフォームへの調整が必要であり、このライブラリはプラットフォームに依存しない。

標準ライブラリ

標準ライブラリはstdの名称で提供されている[55]。このライブラリは基礎的な型(Vec<T>やOption<T>)、言語の基本の処理、標準のマクロ、入出力(I/O)、マルチスレッドなどの機能を提供する。標準ライブラリは標準でリンクしてソフトウェアがビルドされるが、より根幹的なソフトウェアやリソースの小さい組み込み環境ではリンクを外してソフトウェアをビルドすることができる。

外部ライブラリ

Rustは基本的で汎用的な機能を含め標準ライブラリではなく外部ライブラリとして提供している。これはいわゆる「電池が付属しています (“Battery Included”)」の反対を行くもので、言語と共に更新することで保守的になりがちな標準ライブラリではなく、言語とは独立して更新することで最善を繰り返し探求しうる外部ライブラリとすることで、それらの機能をより良い品質で提供する考えに基づいていたものである[56]。外部ライブラリの利便性と品質の保証のためにcrates.ioAPIガイドラインを提供している。

言語開発のコミュニティがそれらについて携わっていないわけではなく、基礎的な外部ライブラリはコミュニティ配下で開発が進められている。

開発ツール

Rustの開発ツールは独立したソフトウェアとして提供されている。

rustc

rustcはRustで記述されたRustソースコードをコンパイルするコンパイラ(処理系)である。コンパイルの成果物として中間コード、および実行ファイル静的ライブラリ動的ライブラリを出力する[62]。rustcはクロスコンパイルを可能とし、WindowsLinuxmacOS向けの実行ファイル他、AndroidiOSで動作するライブラリをホストマシンで出力することができる[63]

対象プラットフォームは完成度に合わせて3つのティアに分かれている[3]。ティア1はバイナリリリースが提供されており、自動ビルド英語版自動テストが整備され、それらが安定して成功(パス)することが保証されている。 ティア2はバイナリリリースが提供されており、自動ビルドと自動テストは整備されているがテストが成功することは保証されていない。ティア3はソースコードとしては対応しているが、自動ビルドと自動テストの動作が保証されておらず、公式リリースは提供されていない。

WindowsLinuxmacOS向けのRustコンパイラはティア1でリリースされている。AndroidiOSWebAssembly向けのRustコンパイラはティア2でリリースされている。

Rust 1.12版より導入されたMIR (Mid-level IR)[9] によって、コンパイルと実行時間の迅速化ならびに型チェックの正確性の実現が図られている。

cargo

cargoはrust製ソフトウェアプロジェクトのCUIのビルドツールである。規定のファイル構成(ディレクトリ、設定ファイル、ソースファイル)のプロジェクトディレクトリで利用される。プロジェクトのビルド(コンパイル)、依存ライブラリのダウンロード、テスト、ドキュメント生成などをサポートする[64]。cargoの依存ライブラリのダウンロード先はcrates.ioである[65]。 サブコマンドは拡張可能で標準のコマンドの他、README.mdファイルの自動生成コマンド[66]などの拡張コマンドが存在する。

rustup

rustup
開発元 Rust Project Developers
初版 2016年4月15日 (8年前) (2016-04-15)
最新版
1.10.0 / 2018年1月25日 (6年前) (2018-01-25)
リポジトリ https://github.com/rust-lang-nursery/rustup.rs
プログラミング
言語
Rust
対応OS Windows, Linux, macOS
公式サイト https://www.rustup.rs
テンプレートを表示

rustupはツールチェーンの管理ソフトウェアである。ツールチェーンのダウンロードとインストール、ソフトウェアバージョンの管理、コンパイルターゲットの切り替えの機能を提供する[67][68]

機能

rustupはRustプロジェクトがリリースしているコンパイラ(rustc)、ビルドツール(cargo)などのツールチェーンをインターネットを経由してホストマシンにダウンロード、インストールおよびマネージメントする機能を提供する。インストール対象のツールチェーンのバージョンは、安定版、ベータ版、ナイトリー版の全てを含んでおり、利用者が必要とするバージョンを指定してダウンロードすることができる。また、ターゲットプラットフォームについても全ての種類を含んでおり、ホストマシンと異なるプラットフォーム(例えば、ホストがmacOSであってもWindowsAndroidiOS)のコンパイラをインストールすることができる。この場合、コンパイラはクロスコンパイラとして動作してターゲットプラットフォームに合わせたビルドを実施する。

歴史

Rust 1.13版以前はシェルスクリプトで実装されたrustup.shが公開されていた[69]。これと並行してRust言語で実装された同等機能を提供するrustup.rsの開発が進められており、Rust 1.14版でrustup.shは非推奨となり[70]、Rust 1.14版以降はrustup.rsが公式リリースとして提供されている[71][72]

評価

Rustは2016年、2017年のStack Overflow Developer Surveyで「最も愛されているプログラミング言語」で一位を獲得し[11][12]、プログラマの好意的な評価は多い。

一方で、Rustは学習難易度が高い言語とも考えられている[73]。多くのRust初学者のプログラマにおいて、自身が正しいと思って書いたソースコードのコンパイルに対してコンパイラ(ボローチェッカー)がエラーを検出する、「ボローチェッカーとの戦い」(fighting with the borrow checker)が発生しがちである[74][75]。小さなアプリケーションの実装について同時期に言語開発されているGo言語と比較した場合、Rust言語よりGo言語の方が開発効率が良いという評価がある[13]。学習難易度の高さは開発チームも認識しており、2017年ロードマップでは学習曲線の改善を目的として挙げていた[14][76]

Rustの実行時速度性能は同じくコンパイラにLLVMを利用している場合のC言語と同等程度であり[77][78]、一部の処理ではC言語を上回った速度が確認されている[10]

Rustで実装されたソフトウェア

RustコンパイラはRust自身で記述されている[19]

その他のRustを使って開発されているプロジェクト:

出典

  1. ^ Announcing Rust 1.23”. blog.rust-lang.org (2018年1月4日). 2018年1月4日閲覧。
  2. ^ Appendix: Influences - The Rust Reference”. 28 January, 2018閲覧。
  3. ^ a b Rust Platform Support · The Rust Programming Language”. 2018年2月4日閲覧。
  4. ^ a b c Mozilla Research. “Rust”. 2018年2月4日閲覧。
  5. ^ The Rust Language”. Lambda the Ultimate (2010年7月8日). 2010年10月30日閲覧。
  6. ^ a b Avram, Abel (2012年8月3日). “Interview on Rust, a Systems Programming Language Developed by Mozilla”. InfoQ. 2013年8月17日閲覧。 “GH: A lot of obvious good ideas, known and loved in other languages, haven't made it into widely used systems languages ... There were a lot of good competitors in the late 1970s and early 1980s in that space, and I wanted to revive some of their ideas and give them another go, on the theory that circumstances have changed: the internet is highly concurrent and highly security-conscious, so the design-tradeoffs that always favor C and C++ (for example) have been shifting.”
  7. ^ Rust Project Developers. “The Rust Community · The Rust Programming Language”. 2018年2月4日閲覧。
  8. ^ Rust Project Developers. “rust-lang/rust: A safe, concurrent, practical language.”. github. 2018年2月4日閲覧。
  9. ^ a b Matsakis, Niko (2016年4月19日). “Introducing MIR”. 2016年10月4日閲覧。
  10. ^ a b Isaac, Gouy. “Rust vs C++ g++ (64-bit Ubuntu quad core)”. 2018年2月4日閲覧。
  11. ^ a b Stack Overflow Developer Survey 2016 Results”. Stack Overflow. 2017年3月22日閲覧。
  12. ^ a b Stack Overflow Developer Survey 2017”. Stack Overflow. 2017年3月22日閲覧。
  13. ^ a b Matthias Endler (2017年9月15日). “Go vs Rust? Choose Go.”. 2018年1月28日閲覧。
  14. ^ a b Aaron Turon. “Rust's 2017 roadmap”. 2018年1月28日閲覧。
  15. ^ : Graydon Hoare
  16. ^ Project FAQ” (2010年9月14日). 2012年1月11日閲覧。
  17. ^ Future Tense” (2011年4月29日). 2012年2月6日閲覧。 “At Mozilla Summit 2010, we launched Rust, a new programming language motivated by safety and concurrency for parallel hardware, the “manycore” future which is upon us.
  18. ^ rustlangの2017年3月12日のツイート2018年2月4日閲覧。
  19. ^ a b Hoare, Graydon (2010年10月2日). “Rust Progress”. 2013年10月22日時点のオリジナルよりアーカイブ。2010年10月30日閲覧。 “the second version of the compiler, written in Rust and compiled with the bootstrap compiler”
  20. ^ Hoare, Graydon (2011年4月20日). “rust-dev] stage1/rustc builds”. 2011年4月20日閲覧。 “After that last change fixing the logging scope context bug, looks like stage1/rustc builds. Just shy of midnight :)
  21. ^ Chris Double (2011年3月31日). “A Quick Look at the Rust Programming Language”. 2018年2月4日閲覧。 “The rustc compiler lives in stage0/rustc. The output of this compiler is LLVM bytecode which must then be compiled using LLVM tools.”
  22. ^ catamorphism (2012年1月20日). “Mozilla and the Rust community release Rust 0.1 (a strongly-typed systems programming language with a focus on memory safety and concurrency)”. 2012年2月6日閲覧。
  23. ^ Jelliffe, Rick (2010年11月8日). “Vale Java? Scala Vala palava”. 2012年3月29日閲覧。 “… It is just plain ignorant to say that non-English programmers always write with ASCII. (Just as it would be ignorant to say that they never do.) It is that kind of rather blithe dismissal that foreign cultures and languages need to be supported that creates extra unnecessary barriers. That argument ran out of legs in the early 1990s: all platforms have well -established Unicode libraries with serviceable properties for this…
  24. ^ Commit dabccadd3202513ab0bcb424e2c62c90ab23062d” (2011年2月26日). 2012年1月11日閲覧。
  25. ^ Strom, Robert E.; Yemini, Shaula (1986). Typestate: A Programming Language Concept for Enhancing Software Reliability. IEEE Transactions on Software Engineering. ISSN 0098-5589. http://www.cs.cmu.edu/~aldrich/papers/classic/tse12-typestate.pdf 2010年11月14日閲覧。. 
  26. ^ Walton, Patrick (2012年12月26日). “Typestate Is Dead, Long Live Typestate!”. Pcwalton.github.com. 2016年11月3日閲覧。
  27. ^ Walton, Patrick (2013年1月2日). “Removing Garbage Collection From the Rust Language”. Pcwalton.github.com. 2018年2月4日閲覧。
  28. ^ Andrew Binstock. “[www.drdobbs.com/jvm/the-rise-and-fall-of-languages-in-2013/240165192 The Rise And Fall of Languages in 2013]”. 2018年1月28日閲覧。
  29. ^ The Rust Core Team (2015年5月15日). “Announcing Rust 1.0 - The Rust Programming Language Blog”. 2018年2月4日閲覧。
  30. ^ Alex Crichton (2014年10月27日). “rfcs/0507-release-channels.md at master · rust-lang/rfcs”. 2018年2月4日閲覧。
  31. ^ Aaron Turon (2014年10月30日). “Stability as a Deliverable - The Rust Programming Language Blog”. 2018年2月4日閲覧。
  32. ^ Scheduling the Trains”. 2017年1月1日閲覧。
  33. ^ Firefox リリースノート Firefox 48.0”. Mozilla Foundation (2016年8月2日). 2016年8月3日閲覧。
  34. ^ Firefox に組み込まれた Rust”. Mozilla Foundation (2016年8月2日). 2016年8月3日閲覧。
  35. ^ Rust meets Fedora”. fedoramagazine.org (2016年9月21日). 2016年10月6日閲覧。
  36. ^ The Rust Team · The Rust Programming Language”. Rust Project Developers. 2018年2月4日閲覧。
  37. ^ The Rust Programming Language”. github. 2018年2月4日閲覧。
  38. ^ Contributors to rust-lang/rust”. github. 28 January, 2018閲覧。
  39. ^ The Mozilla Manifesto”. 2012年4月9日閲覧。
  40. ^ rust-lang/rfcs: RFCs for changes to Rust”. github. 2018年2月4日閲覧。
  41. ^ rust-lang/rfcs: RFCs for changes to Rust”. 2018年1月28日閲覧。
  42. ^ Aaron Turon. “Refining Rust's RFCs”. 2018年1月28日閲覧。
  43. ^ bindgen 0.17.0 - Docs.rs”. Onur Aslan. 2018年2月4日閲覧。 “authors Jyun-Yan You”
  44. ^ Yamakaky (2016年7月22日). “merge into upstream! · Issue #21 · rust-lang-nursery/rust-bindgen”. github. 2018年2月4日閲覧。
  45. ^ rust-lang-nursery/rust-bindgen Automatically generates Rust FFI bindings to C (and some C++) libraries.”. 2018年2月4日閲覧。
  46. ^ rust/src/grammar/parser-lalr.y” (2017年5月23日). 28 January, 2018閲覧。
  47. ^ “Frequently Asked Questions · The Rust Programming Language - When should I use an implicit return?”. 2018年1月28日閲覧。
  48. ^ : higher-kinded polymorphism
  49. ^ Walton, Patrick (2010年10月1日). “Rust Features I: Type Inference”. 2011年1月21日閲覧。
  50. ^ : monomorphization
  51. ^ Aaron Turon (2015年5月11日). “Abstraction without overhead: traits in Rust - The Rust Programming Language Blog”. 2018年2月4日閲覧。
  52. ^ Nicholas D. Matsakis (2014年11月14日). “Allocators in Rust”. 2018年2月4日閲覧。
  53. ^ Rust Team. “Working with an unpublished minor version”. 2018年1月28日閲覧。
  54. ^ Rust project developers. “core- Rust”. 2018年1月28日閲覧。
  55. ^ Rust project developers. “std- Rust”. 2018年1月28日閲覧。
  56. ^ Brian Anderson (2017年5月5日). “The Rust Libz Blitz - The Rust Programming Language Blog”. 2018年2月4日閲覧。
  57. ^ The Rust Project Developers. “rand - Cargo: packages for Rust”. 2018年1月28日閲覧。
  58. ^ The Rust Project Developers. “regex - Cargo: packages for Rust”. 2018年1月28日閲覧。
  59. ^ Kang Seonghoon. “chrono - Cargo: packages for Rust”. 2018年1月28日閲覧。
  60. ^ The Rust Project Developers. “libc - Cargo: packages for Rust”. 2018年1月28日閲覧。
  61. ^ The Rust Project Developers. “log - Cargo: packages for Rust”. 2018年1月28日閲覧。
  62. ^ Blandy, Jim (2017). Programming Rust. O'Reilly Media, Inc. p. 285. ISBN 1491927283 
  63. ^ Brian Anderson (2016年5月13日). “Taking Rust everywhere with rustup”. 2018年1月28日閲覧。
  64. ^ Yehuda Katz (2016年5月5日). “Cargo: predictable dependency management - The Rust Programming Language Blog”. 2018年2月4日閲覧。
  65. ^ Alex Crichton (2014年11月20日). “Cargo: Rust's community crate host”. 2018年1月28日閲覧。
  66. ^ livioribeiro (2015年10月15日). “Cargo-readme: generate README.md from doc comments”. 2018年1月28日閲覧。
  67. ^ RustUp aka How to install rust the convenient way” (2016年6月2日). 2018年2月4日閲覧。
  68. ^ Brian Anderson (2016年5月13日). “Taking Rust everywhere with rustup - The Rust Programming Language Blog”. 2018年2月4日閲覧。
  69. ^ vanjacosic (2016年9月27日). “rust/getting-started.md at 1.13.0 · rust-lang/rust”. 2018年2月4日閲覧。
  70. ^ rust-lang-deprecated/rustup.sh: The rustup.sh script for installing Rust from release channels”. 2018年1月28日閲覧。
  71. ^ vanjacosic (2016年12月17日). “rust/getting-started.md at 1.14.0 · rust-lang/rust”. 2018年2月4日閲覧。
  72. ^ rust-lang-nursery/rustup.rs: The Rust toolchain installer”. 2018年1月28日閲覧。
  73. ^ Klabnik, Steve (2014年10月24日). “Interview with Steve Klabnik: How Rust Compares to Other Languages and More”. codementor. 2018年2月4日閲覧。 “Rust has a significant lack of resources because it’s so new, and so it’s much harder as a first language.”
  74. ^ book/references-and-borrowing.md at master · rust-lang/book” (2017年5月10日). 2018年2月4日閲覧。 “Many new users to Rust experience something we like to call ‘fighting with the borrow checker’”
  75. ^ Ivan Sagalaev (2016年11月2日). “Why Rust's ownership/borrowing is hard”. 2018年2月4日閲覧。
  76. ^ Aaron Turon. “Rust should have a lower learning curve”. 2018年1月28日閲覧。
  77. ^ Miscellany: C++ design goals in the context of Rust”. 2018年1月28日閲覧。
  78. ^ Frequently Asked Questions · The Rust Programming Language - How fast is Rust?”. 2018年1月28日閲覧。
  79. ^ Dave Herman. “Shipping Rust in Firefox”. 2018年1月28日閲覧。
  80. ^ Serdar Yegulalp. “Mozilla's Rust-based Servo browser engine inches forward”. 2018年1月28日閲覧。
  81. ^ David Bryant. “A Quantum Leap for the Web”. 2018年1月28日閲覧。
  82. ^ Salim Alam. “Habitat at RustConf”. 2018年1月28日閲覧。
  83. ^ Salim Alam. “The Epic Story of Dropbox's Exodus From the Amazon Cloud Empire”. 2018年1月28日閲覧。
  84. ^ Serdar Yegulalp. “The Epic Story of Dropbox's Exodus From the Amazon Cloud Empire”. 2018年1月28日閲覧。
  85. ^ Steve Klabnik. “intermezzOS: a little OS”. 2018年1月28日閲覧。
  86. ^ Red Hat deprecates BTRFS, is Stratis the new ZFS-like hope?”. Marksei, Weekly sysadmin pills. 2018年1月28日閲覧。
  87. ^ “Building a Container Runtime in Rust”. (2017年6月29日). https://blogs.oracle.com/developers/building-a-container-runtime-in-rust 2017年7月8日閲覧. "Why Rust? (…) Rust sits at a perfect intersection of [C and Go]: it has memory safety and higher-level primitives, but doesn't sacrifice low level control over threading and therefore can handle namespaces properly." 
  88. ^ Valery Vavilov. “As Blockchain Changes The World, Bitfury’s New Platform Exonum is About to Change Blockchain”. 2018年1月28日閲覧。
  89. ^ Balbaert, Ivo. Rust Essentials. Packt Publishing. p. 6. ISBN 1785285769. https://books.google.com/books?id=TeiuCQAAQBAJ&pg=PA6&lpg=PA6&dq=OpenDNS+Rust&source=bl&ots=UL5thAAi8w&sig=Wf-Z5xSRYU-IXyGiyIl2FVEQWEc&hl=en&sa=X&ved=0ahUKEwizzdSk59LLAhVpnoMKHWdbDrQQ6AEINzAF#v=onepage&q=OpenDNS%20Rust&f=false 2016年3月21日閲覧。 
  90. ^ Using HyperLogLog to Detect Malware Faster Than Ever”. OpenDNS Security Labs. 2016年3月19日閲覧。
  91. ^ ZeroMQ: Helping us Block Malicious Domains in Real Time”. OpenDNS Security Labs. 2016年3月19日閲覧。
  92. ^ Piston A modular game engine written in Rust”. Piston.rs. 2017年8月1日閲覧。
  93. ^ Joseph Birr-Pixton. “ctz/rustls: A modern TLS library in Rust”. 2018年2月4日閲覧。
  94. ^ Remacs:Re-Implementing Emacs In Rust”. phoronix.com (2017年1月11日). 2017年1月19日閲覧。
  95. ^ Pijul”. pijul.org. 2017年7月8日閲覧。
  96. ^ Google. “xi-editor”. 2018年1月28日閲覧。
  97. ^ Andrew Gallant (2016年9月23日). “ripgrep is faster than {grep, ag, git grep, ucg, pt, sift}”. 2018年1月28日閲覧。

外部リンク