五年锈病

在当今世界上发生的混乱中,很容易忘记,自2015年1.0版发布已经过去了五年!在过去的五年中,Rust发生了很大的变化,因此,我们希望从语言稳定的那一刻起,回顾社区所有成员的工作。


回想一下是否有人忘记了:Rust是一种通用的编程语言,具有构建可靠且高效的软件的手段。Rust可以用于任何领域:从操作系统内核到下一个Web应用程序。该语言由开放的多面社区的参与者(主要是志愿者)完全构建,他们慷慨地分享了他们的时间和知识,以帮助使Rust成为现在的样子。


自1.0版以来的重大更改


2015年


1.2-并行代码生成:减少编译时间一直是每个Rust版本的主要主题,很难想象,在很短的一段时间内Rust根本没有并行代码生成。


1.3 -Rustonomicon:这本奇妙的书“ The Rustonomicon”的第一版,该书探讨了Rust的阴暗面,Unsafe Rust和相关主题。对于任何想学习和理解语言最困难方面的人来说,它已成为极好的信息来源。


1.4-对Windows MSVC级别1的支持:将该平台移至支持级别1,从而通过Microsoft Visual C ++工具包(MSVC)对64位Windows提供了本机支持。在1.4之前,您必须安装MinGW(Windows的GNU环境端口),才能在Rust中使用和编译程序。 Windows支持已成为Rust五年来最大的增强功能之一。直到最近,Microsoft才宣布对Rust WinRT API的官方支持的公开预发布!最后,构建高质量和跨平台的应用程序比以往任何时候都容易得多。


1.5 — Cargo Install: Rust cargo , , . Cargo , , crates.io!


2016


1.6 — Libcore: libcore — , API, . libcore Rust , Rust .


1.10 — C ABI: cdylib C-, Rust , ABI C. Rust — Rust . , -.


1.12 — Cargo Workspaces: Rust lock-. .


1.13Try: ? "Try". . try!, , Result, ?.


try!(try!(expression).method()); // 
expression?.method()?;           // 

1.14 — Rustup 1.0: Rustup — . Rust . , , , "". Linux, macOS, Windows .


2017


1.15 — : , API . Rust serde diesel.


1.17 — Rustbuild: make Cargo. rust-lang/rust .


1.20 — : . 1.20 , , , . API, IP- .


2018


1.24 — : 1.24, , . , , .


1.26impl Trait: impl Trait API
.


1.28 — : , Rust. API , . alloc, , , , Vec String. , -, .


1.31 — 2018 : 2018 1.0, Rust, . , , .


  • (NLL): Rust, .
  • : UX .
  • : Rust .
  • Rustfmt 1.0: , Rust.
  • Clippy 1.0: Rust . Clippy , , .
  • Rustfix: , , . , Rust, cargo fix , .

2019


1.34 — : Rust , . Cargo git-. , , crates.io.


1.39 — Async/Await: async/await Future " " Rust. , .


2020


1.42 — : , .. () , .



, , Rust 1.0. , .


, . , , , , .


()

use std::io::Write;

fn trait_obj(w: &Write) {
    generic(w);
}

fn generic<W: Write>(_w: &W) {}

1.2.0
   Compiling error-messages v0.1.0 (file:///Users/usr/src/rust/error-messages)
src/lib.rs:6:5: 6:12 error: the trait `core::marker::Sized` is not implemented for the type `std::io::Write` [E0277]
src/lib.rs:6     generic(w);
                 ^~~~~~~
src/lib.rs:6:5: 6:12 note: `std::io::Write` does not have a constant size known at compile-time
src/lib.rs:6     generic(w);
                 ^~~~~~~
error: aborting due to previous error
Could not compile `error-messages`.

To learn more, run the command again with --verbose.

1.2.0错误消息的终端屏幕截图。


1.43.0
   Compiling error-messages v0.1.0 (/Users/ep/src/rust/error-messages)
error[E0277]: the size for values of type `dyn std::io::Write` cannot be known at compilation time
 --> src/lib.rs:6:13
  |
6 |     generic(w);
  |             ^ doesn't have a size known at compile-time
...
9 | fn generic<W: Write>(_w: &W) {}
  |    ------- -       - help: consider relaxing the implicit `Sized` restriction: `+  ?Sized`
  |            |
  |            required by this bound in `generic`
  |
  = help: the trait `std::marker::Sized` is not implemented for `dyn std::io::Write`
  = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `error-messages`.

To learn more, run the command again with --verbose.

1.43.0错误消息的终端屏幕截图。


()

fn main() {
    let s = "".to_owned();
    println!("{:?}", s.find("".to_owned()));
}

1.2.0
   Compiling error-messages v0.1.0 (file:///Users/ep/src/rust/error-messages)
src/lib.rs:3:24: 3:43 error: the trait `core::ops::FnMut<(char,)>` is not implemented for the type `collections::string::String` [E0277]
src/lib.rs:3     println!("{:?}", s.find("".to_owned()));
                                    ^~~~~~~~~~~~~~~~~~~
note: in expansion of format_args!
<std macros>:2:25: 2:56 note: expansion site
<std macros>:1:1: 2:62 note: in expansion of print!
<std macros>:3:1: 3:54 note: expansion site
<std macros>:1:1: 3:58 note: in expansion of println!
src/lib.rs:3:5: 3:45 note: expansion site
src/lib.rs:3:24: 3:43 error: the trait `core::ops::FnOnce<(char,)>` is not implemented for the type `collections::string::String` [E0277]
src/lib.rs:3     println!("{:?}", s.find("".to_owned()));
                                    ^~~~~~~~~~~~~~~~~~~
note: in expansion of format_args!
<std macros>:2:25: 2:56 note: expansion site
<std macros>:1:1: 2:62 note: in expansion of print!
<std macros>:3:1: 3:54 note: expansion site
<std macros>:1:1: 3:58 note: in expansion of println!
src/lib.rs:3:5: 3:45 note: expansion site
error: aborting due to 2 previous errors
Could not compile `error-messages`.

To learn more, run the command again with --verbose.

1.2.0错误消息的终端屏幕截图。


1.43.0
   Compiling error-messages v0.1.0 (/Users/ep/src/rust/error-messages)
error[E0277]: expected a `std::ops::FnMut<(char,)>` closure, found `std::string::String`
 --> src/lib.rs:3:29
  |
3 |     println!("{:?}", s.find("".to_owned()));
  |                             ^^^^^^^^^^^^^
  |                             |
  |                             expected an implementor of trait `std::str::pattern::Pattern<'_>`
  |                             help: consider borrowing here: `&"".to_owned()`
  |
  = note: the trait bound `std::string::String: std::str::pattern::Pattern<'_>` is not satisfied
  = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `std::string::String`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `error-messages`.

To learn more, run the command again with --verbose.

1.43.0错误消息的终端屏幕截图。


( )

fn main() {
    let mut x = 7;
    let y = &mut x;

    println!("{} {}", x, y);
}

1.2.0
   Compiling error-messages v0.1.0 (file:///Users/ep/src/rust/error-messages)
src/lib.rs:5:23: 5:24 error: cannot borrow `x` as immutable because it is also borrowed as mutable
src/lib.rs:5     println!("{} {}", x, y);
                                   ^
note: in expansion of format_args!
<std macros>:2:25: 2:56 note: expansion site
<std macros>:1:1: 2:62 note: in expansion of print!
<std macros>:3:1: 3:54 note: expansion site
<std macros>:1:1: 3:58 note: in expansion of println!
src/lib.rs:5:5: 5:29 note: expansion site
src/lib.rs:3:18: 3:19 note: previous borrow of `x` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `x` until the borrow ends
src/lib.rs:3     let y = &mut x;
                              ^
src/lib.rs:6:2: 6:2 note: previous borrow ends here
src/lib.rs:1 fn main() {
src/lib.rs:2     let mut x = 7;
src/lib.rs:3     let y = &mut x;
src/lib.rs:4
src/lib.rs:5     println!("{} {}", x, y);
src/lib.rs:6 }
             ^
error: aborting due to previous error
Could not compile `error-messages`.

To learn more, run the command again with --verbose.

1.2.0错误消息的终端屏幕截图。


1.43.0
   Compiling error-messages v0.1.0 (/Users/ep/src/rust/error-messages)
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
 --> src/lib.rs:5:23
  |
3 |     let y = &mut x;
  |             ------ mutable borrow occurs here
4 |
5 |     println!("{} {}", x, y);
  |                       ^  - mutable borrow later used here
  |                       |
  |                       immutable borrow occurs here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0502`.
error: could not compile `error-messages`.

To learn more, run the command again with --verbose.

1.43.0错误消息的终端屏幕截图。



, . , :


rustdoc :
  • ,
  • ( JSON),
  • "compile_fail, should_panic, allow_fail",
  • .


— Guillaume Gomez (rustdoc)

Rust IDE! , IntelliJ Rust,
RLS rust-analyzer « »
. « Rust»
Vim/Emacs.

— (IDEs and editors)

:
,
Rust ,
.

— Daniel Egger (Embedded WG)

2018 ,
~ 40000 rust-lang/rust -
.
, , ,
(, ,
). , ,

, PR . .

— Mark Rousskov (Release)

3 Miri

,
.
Stacked Borrows,
Rust.
,
Miri, ,
Miri
, ,
Miri, , ,
.

— Ralf Jung (Miri)

, ,
NLL. , ,
Rust, , ,
NLL.
, .
!

— Niko Matsakis (Language)


, . Rust , Rust . , Rust.


  • Rust « » Stack Overflow, , 1.0.
  • 2,25 (1PB = 1000 ) , !
  • 170 1,8 crates.io, .
  • Rust 1.0 , , . , , Apple, Amazon, Dropbox, Facebook, Google Microsoft, Rust .


, Rust, 2015 . Rust? Discourse.


, Rust, , , Rust . , Rust , , Rust !



, - Rust, . ? ? ENTER , … Ctrl+O "" — , MC
, , Rust Book.
, , ( Rust , ) , NLL, , , , , . Rust Intellij Idea.
5 Rust Rust . Rust , , - . Rust-

nlinker (Translation Team)

Rust 2017 .
.
.
.


  • Rust book first edition
  • Rust by example
  • Rustonomicon.


.
.

Rust by example, Rust book second edition, Async book

Rust , 3 5 . .

andreevlex ( rust-lang-ru)



如果您对Rust语言有任何疑问,可以通过俄语电报聊天对新手的类似聊天获得帮助


本文是共同翻译的 AndreevlexFunkill链接器4赫罗洛特Po0lunin布兰杰


All Articles