编译型编程语言Rust v1.9.0 发布

jopen 5年前
   <p style="text-align: center;"><img alt="" src="https://simg.open-open.com/show/8f9dac32e915bcc0c014efc839a62544.png" /></p>    <p>Rust是一个由Mozilla主导开发的通用、编译型编程语言。它的设计准则为“安全,并发,实用”,支持函数式,并发式,过程式以及面向对象的编程风格。Rust 的设计目标之一,是要使设计大型的互联网客户端和服务器的任务变得更容易。因此更加强调安全性、内存配置、以及并发处理等方面的特性。在性能上,具有额外安全保证的代码会比 C++ 慢一些,但是如果以 C++ 也手工提供保证的情况下,则两者性能上是相似的。</p>    <h2>更新日志</h2>    <h3>语言</h3>    <ul>     <li>The <code>#[deprecated]</code> attribute when applied to an API will generate warnings when used. The warnings may be suppressed with <code>#[allow(deprecated)]</code>. <a href="/misc/goto?guid=4958990828913895866">RFC 1270</a>.</li>     <li><a href="/misc/goto?guid=4958990829016872687"><code>fn</code> item types are zero sized, and each <code>fn</code> names a unique type</a>. This will break code that transmutes <code>fn</code>s, so calling<code>transmute</code> on a <code>fn</code> type will generate a warning for a few cycles, then will be converted to an error.</li>     <li><a href="/misc/goto?guid=4958990829101871232">Field and method resolution understand visibility, so private fields and methods cannot prevent the proper use of public fields and methods</a>.</li>     <li><a href="/misc/goto?guid=4958990829197239730">The parser considers unicode codepoints in the <code>PATTERN_WHITE_SPACE</code> category to be whitespace</a>.</li>    </ul>    <h3>稳定的APIs</h3>    <ul>     <li><a href="/misc/goto?guid=4958990829290271612"><code>std::panic</code></a></li>     <li><a href="/misc/goto?guid=4958990829384047485"><code>std::panic::catch_unwind</code></a> (renamed from <code>recover</code>)</li>     <li><a href="/misc/goto?guid=4958990829478349839"><code>std::panic::resume_unwind</code></a> (renamed from <code>propagate</code>)</li>     <li><a href="/misc/goto?guid=4958990829563845064"><code>std::panic::AssertUnwindSafe</code></a> (renamed from <code>AssertRecoverSafe</code>)</li>     <li><a href="/misc/goto?guid=4958990829662878268"><code>std::panic::UnwindSafe</code></a> (renamed from <code>RecoverSafe</code>)</li>     <li><a href="/misc/goto?guid=4958990829751542724"><code>str::is_char_boundary</code></a></li>     <li><a href="/misc/goto?guid=4958990829845023514"><code><*const T>::as_ref</code></a></li>     <li><a href="/misc/goto?guid=4958990829845023514"><code><*mut T>::as_ref</code></a></li>     <li><a href="/misc/goto?guid=4958990829944837060"><code><*mut T>::as_mut</code></a></li>     <li><a href="/misc/goto?guid=4958990830048924131"><code>AsciiExt::make_ascii_uppercase</code></a></li>     <li><a href="/misc/goto?guid=4958990830133097362"><code>AsciiExt::make_ascii_lowercase</code></a></li>     <li><a href="/misc/goto?guid=4958990830229975586"><code>char::decode_utf16</code></a></li>     <li><a href="/misc/goto?guid=4958990830322068222"><code>char::DecodeUtf16</code></a></li>     <li><a href="/misc/goto?guid=4958990830411832696"><code>char::DecodeUtf16Error</code></a></li>     <li><a href="/misc/goto?guid=4958990830503321998"><code>char::DecodeUtf16Error::unpaired_surrogate</code></a></li>     <li><a href="/misc/goto?guid=4958990830601298877"><code>BTreeSet::take</code></a></li>     <li><a href="/misc/goto?guid=4958990830701539424"><code>BTreeSet::replace</code></a></li>     <li><a href="/misc/goto?guid=4958990830798264791"><code>BTreeSet::get</code></a></li>     <li><a href="/misc/goto?guid=4958990830894188461"><code>HashSet::take</code></a></li>     <li><a href="/misc/goto?guid=4958990830985716719"><code>HashSet::replace</code></a></li>     <li><a href="/misc/goto?guid=4958990831074377572"><code>HashSet::get</code></a></li>     <li><a href="/misc/goto?guid=4958990831169167322"><code>OsString::with_capacity</code></a></li>     <li><a href="/misc/goto?guid=4958990831264856440"><code>OsString::clear</code></a></li>     <li><a href="/misc/goto?guid=4958990831354272606"><code>OsString::capacity</code></a></li>     <li><a href="/misc/goto?guid=4958990831444664611"><code>OsString::reserve</code></a></li>     <li><a href="/misc/goto?guid=4958990831541249383"><code>OsString::reserve_exact</code></a></li>     <li><a href="/misc/goto?guid=4958990831630300813"><code>OsStr::is_empty</code></a></li>     <li><a href="/misc/goto?guid=4958990831726735259"><code>OsStr::len</code></a></li>     <li><a href="/misc/goto?guid=4958990831818728934"><code>std::os::unix::thread</code></a></li>     <li><a href="/misc/goto?guid=4958990831906396264"><code>RawPthread</code></a></li>     <li><a href="/misc/goto?guid=4958990831999731804"><code>JoinHandleExt</code></a></li>     <li><a href="/misc/goto?guid=4958990832089614236"><code>JoinHandleExt::as_pthread_t</code></a></li>     <li><a href="/misc/goto?guid=4958990832195868477"><code>JoinHandleExt::into_pthread_t</code></a></li>     <li><a href="/misc/goto?guid=4958990832280539993"><code>HashSet::hasher</code></a></li>     <li><a href="/misc/goto?guid=4958990832373105241"><code>HashMap::hasher</code></a></li>     <li><a href="/misc/goto?guid=4958990832469162056"><code>CommandExt::exec</code></a></li>     <li><a href="/misc/goto?guid=4958990832560731849"><code>File::try_clone</code></a></li>     <li><a href="/misc/goto?guid=4958990832652259974"><code>SocketAddr::set_ip</code></a></li>     <li><a href="/misc/goto?guid=4958990832743836106"><code>SocketAddr::set_port</code></a></li>     <li><a href="/misc/goto?guid=4958990832840015457"><code>SocketAddrV4::set_ip</code></a></li>     <li><a href="/misc/goto?guid=4958990832927784761"><code>SocketAddrV4::set_port</code></a></li>     <li><a href="/misc/goto?guid=4958990833030827648"><code>SocketAddrV6::set_ip</code></a></li>     <li><a href="/misc/goto?guid=4958990833123785315"><code>SocketAddrV6::set_port</code></a></li>     <li><a href="/misc/goto?guid=4958990833214496750"><code>SocketAddrV6::set_flowinfo</code></a></li>     <li><a href="/misc/goto?guid=4958990833310628728"><code>SocketAddrV6::set_scope_id</code></a></li>     <li><a href="/misc/goto?guid=4958990833398139410"><code>slice::copy_from_slice</code></a></li>     <li><a href="/misc/goto?guid=4958990833489719999"><code>ptr::read_volatile</code></a></li>     <li><a href="/misc/goto?guid=4958990833582660888"><code>ptr::write_volatile</code></a></li>     <li><a href="/misc/goto?guid=4958990833677373944"><code>OpenOptions::create_new</code></a></li>     <li><a href="/misc/goto?guid=4958990833766682366"><code>TcpStream::set_nodelay</code></a></li>     <li><a href="/misc/goto?guid=4958990833859119308"><code>TcpStream::nodelay</code></a></li>     <li><a href="/misc/goto?guid=4958990833951591978"><code>TcpStream::set_ttl</code></a></li>     <li><a href="/misc/goto?guid=4958990834048995928"><code>TcpStream::ttl</code></a></li>     <li><a href="/misc/goto?guid=4958990834142693269"><code>TcpStream::set_only_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990834235246244"><code>TcpStream::only_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990834338951916"><code>TcpStream::take_error</code></a></li>     <li><a href="/misc/goto?guid=4958990834435293620"><code>TcpStream::set_nonblocking</code></a></li>     <li><a href="/misc/goto?guid=4958990833951591978"><code>TcpListener::set_ttl</code></a></li>     <li><a href="/misc/goto?guid=4958990834048995928"><code>TcpListener::ttl</code></a></li>     <li><a href="/misc/goto?guid=4958990834142693269"><code>TcpListener::set_only_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990834235246244"><code>TcpListener::only_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990834338951916"><code>TcpListener::take_error</code></a></li>     <li><a href="/misc/goto?guid=4958990834435293620"><code>TcpListener::set_nonblocking</code></a></li>     <li><a href="/misc/goto?guid=4958990834580265408"><code>UdpSocket::set_broadcast</code></a></li>     <li><a href="/misc/goto?guid=4958990834688001064"><code>UdpSocket::broadcast</code></a></li>     <li><a href="/misc/goto?guid=4958990834776770451"><code>UdpSocket::set_multicast_loop_v4</code></a></li>     <li><a href="/misc/goto?guid=4958990834872492121"><code>UdpSocket::multicast_loop_v4</code></a></li>     <li><a href="/misc/goto?guid=4958990834966839817"><code>UdpSocket::set_multicast_ttl_v4</code></a></li>     <li><a href="/misc/goto?guid=4958990835059844002"><code>UdpSocket::multicast_ttl_v4</code></a></li>     <li><a href="/misc/goto?guid=4958990835152899808"><code>UdpSocket::set_multicast_loop_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990835247256783"><code>UdpSocket::multicast_loop_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990835347177495"><code>UdpSocket::set_multicast_ttl_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990835437433766"><code>UdpSocket::multicast_ttl_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990835538103560"><code>UdpSocket::set_ttl</code></a></li>     <li><a href="/misc/goto?guid=4958990835628529604"><code>UdpSocket::ttl</code></a></li>     <li><a href="/misc/goto?guid=4958990835725554546"><code>UdpSocket::set_only_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990835816225651"><code>UdpSocket::only_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990835908324583"><code>UdpSocket::join_multicast_v4</code></a></li>     <li><a href="/misc/goto?guid=4958990836003953810"><code>UdpSocket::join_multicast_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990836099770702"><code>UdpSocket::leave_multicast_v4</code></a></li>     <li><a href="/misc/goto?guid=4958990836196355383"><code>UdpSocket::leave_multicast_v6</code></a></li>     <li><a href="/misc/goto?guid=4958990836286383286"><code>UdpSocket::take_error</code></a></li>     <li><a href="/misc/goto?guid=4958990836374434818"><code>UdpSocket::connect</code></a></li>     <li><a href="/misc/goto?guid=4958990836473308739"><code>UdpSocket::send</code></a></li>     <li><a href="/misc/goto?guid=4958990836560426721"><code>UdpSocket::recv</code></a></li>     <li><a href="/misc/goto?guid=4958990836667095887"><code>UdpSocket::set_nonblocking</code></a></li>    </ul>    <h3>库</h3>    <ul>     <li><a href="/misc/goto?guid=4958990836754524548"><code>std::sync::Once</code> is poisoned if its initialization function fails</a>.</li>     <li><a href="/misc/goto?guid=4958990836850344410"><code>cell::Ref</code> and <code>cell::RefMut</code> can contain unsized types</a>.</li>     <li><a href="/misc/goto?guid=4958990836936593734">Most types implement <code>fmt::Debug</code></a>.</li>     <li><a href="/misc/goto?guid=4958990837029949103">The default buffer size used by <code>BufReader</code> and <code>BufWriter</code> was reduced to 8K, from 64K</a>. This is in line with the buffer size used by other languages.</li>     <li><a href="/misc/goto?guid=4958990837128365209"><code>Instant</code>, <code>SystemTime</code> and <code>Duration</code> implement <code>+=</code> and <code>-=</code>. <code>Duration</code> additionally implements <code>*=</code> and <code>/=</code></a>.</li>     <li><a href="/misc/goto?guid=4958990837216883861"><code>Skip</code> is a <code>DoubleEndedIterator</code></a>.</li>     <li><a href="/misc/goto?guid=4958990837311091520"><code>From<[u8; 4]></code> is implemented for <code>Ipv4Addr</code></a>.</li>     <li><a href="/misc/goto?guid=4958990837400942463"><code>Chain</code> implements <code>BufRead</code></a>.</li>     <li><a href="/misc/goto?guid=4958990837492274503"><code>HashMap</code>, <code>HashSet</code> and iterators are covariant</a>.</li>    </ul>    <h3>Cargo</h3>    <ul>     <li><a href="/misc/goto?guid=4958990837586993549">Cargo can now run concurrently</a>.</li>     <li><a href="/misc/goto?guid=4958990837681820416">Top-level overrides allow specific revisions of crates to be overridden through the entire crate graph</a>. This is intended to make upgrades easier for large projects, by allowing crates to be forked temporarily until they've been upgraded and republished.</li>     <li><a href="/misc/goto?guid=4958990837773704651">Cargo exports a <code>CARGO_PKG_AUTHORS</code> environment variable</a>.</li>     <li><a href="/misc/goto?guid=4958990837868762030">Cargo will pass the contents of the <code>RUSTFLAGS</code> variable to <code>rustc</code> on the commandline</a>. <code>rustc</code> arguments can also be specified in the <code>build.rustflags</code> configuration key.</li>    </ul>    <h3>性能</h3>    <ul>     <li><a href="/misc/goto?guid=4958990837973622659">The time complexity of comparing variables for equivalence during type unification is reduced from <em>O</em>(<em>n</em>!) to <em>O</em>(<em>n</em>)</a>. This leads to major compilation time improvement in some scenarios.</li>     <li><a href="/misc/goto?guid=4958990838060850728"><code>ToString</code> is specialized for <code>str</code>, giving it the same performance as <code>to_owned</code></a>.</li>     <li><a href="/misc/goto?guid=4958990838158803095">Spawning processes with <code>Command::output</code> no longer creates extra threads</a>.</li>     <li><a href="/misc/goto?guid=4958990838252651086"><code>#[derive(PartialEq)]</code> and <code>#[derive(PartialOrd)]</code> emit less code for C-like enums</a>.</li>    </ul>    <h3>Misc</h3>    <ul>     <li><a href="/misc/goto?guid=4958990838337442630">Passing the <code>--quiet</code> flag to a test runner will produce much-abbreviated output</a>.</li>     <li>The Rust Project now publishes std binaries for the <code>mips-unknown-linux-musl</code>, <code>mipsel-unknown-linux-musl</code>, and <code>i586-pc-windows-msvc</code> targets.</li>    </ul>    <h3>兼容说明</h3>    <ul>     <li><a href="/misc/goto?guid=4958990836754524548"><code>std::sync::Once</code> is poisoned if its initialization function fails</a>.</li>     <li><a href="/misc/goto?guid=4958990838449033464">It is illegal to define methods with the same name in overlapping inherent <code>impl</code> blocks</a>.</li>     <li><a href="/misc/goto?guid=4958990829016872687"><code>fn</code> item types are zero sized, and each <code>fn</code> names a unique type</a>. This will break code that transmutes <code>fn</code>s, so calling<code>transmute</code> on a <code>fn</code> type will generate a warning for a few cycles, then will be converted to an error.</li>     <li><a href="/misc/goto?guid=4958990838550039786">Improvements to const evaluation may trigger new errors when integer literals are out of range</a>.</li>    </ul>    <h2>下载</h2>    <ul>     <li><a href="/misc/goto?guid=4958990838646666113" rel="nofollow"><strong>Source code</strong> (zip)</a></li>     <li><a href="/misc/goto?guid=4958990838732725233" rel="nofollow"><strong>Source code</strong> (tar.gz)</a></li>     <li>安装下载      <ul>       <li>        <table>         <tbody>          <tr>           <td>Linux (.tar.gz)</td>           <td> <p><a href="/misc/goto?guid=4958990838827605708">64-bit</a></p> </td>           <td> <p><a href="/misc/goto?guid=4958990838920731883">32-bit</a></p> </td>          </tr>          <tr>           <td>Mac (.pkg)</td>           <td> <p><a href="/misc/goto?guid=4958990839013193577">64-bit</a></p> </td>           <td> <p><a href="/misc/goto?guid=4958990839116936299">32-bit</a></p> </td>          </tr>          <tr>           <td>Windows (<a href="/misc/goto?guid=4958990839208782589">GNU ABI <sup>†</sup></a>) (.msi)</td>           <td> <p><a href="/misc/goto?guid=4958990839294330850">64-bit</a></p> </td>           <td> <p><a href="/misc/goto?guid=4958990839390337498">32-bit</a></p> </td>          </tr>          <tr>           <td>Windows (<a href="/misc/goto?guid=4958990839208782589">MSVC ABI <sup>†</sup></a>) (.msi)</td>           <td> <p><a href="/misc/goto?guid=4958990839488894908">64-bit</a></p> </td>           <td> <p><a href="/misc/goto?guid=4958990839581965319">32-bit</a></p> </td>          </tr>         </tbody>        </table> </li>      </ul> </li>    </ul>    <p> </p>