Rust 1.64 Programming Language Tso tawm

Kev tso tawm ntawm Rust 1.64 cov lus qhia dav dav, tsim los ntawm Mozilla qhov project, tab sis tam sim no tsim los ntawm kev txhawb nqa ntawm lub koom haum ywj pheej tsis muaj txiaj ntsig Rust Foundation, tau tshaj tawm. Cov lus qhia txog kev nyab xeeb ntawm kev nco thiab muab txoj hauv kev kom ua tiav txoj haujlwm siab sib luag thaum tsis txhob siv cov khoom siv khib nyiab thiab lub sijhawm ua haujlwm (runtime raug txo qis rau kev pib pib thiab kev saib xyuas ntawm lub tsev qiv ntawv txheem).

Rust lub cim xeeb tuav txoj kev cawm tus tsim tawm los ntawm kev ua yuam kev thaum tswj cov taw qhia thiab tiv thaiv cov teeb meem uas tshwm sim los ntawm kev ua haujlwm qis qis, xws li nkag mus rau thaj chaw nco tom qab nws tau tso tawm, dereferencing null pointers, tsis overruns, thiab lwm yam. Txhawm rau faib cov tsev qiv ntawv, muab kev tsim kho thiab tswj hwm kev vam khom, qhov project tsim tus thawj tswj hwm pob khoom. Lub crates.io repository yog txaus siab rau hosting cov tsev qiv ntawv.

Kev nyab xeeb nco yog muab rau hauv Rust ntawm lub sijhawm sau los ntawm kev siv tshuaj xyuas, ua raws li cov tswv cuab ntawm cov khoom, khaws cov khoom siv lub neej (scopes), thiab ntsuas qhov tseeb ntawm kev nkag mus rau lub cim xeeb thaum lub sijhawm ua tiav cov lej. Rust kuj tseem muab kev tiv thaiv tus lej ntau dhau, yuav tsum muaj qhov sib txawv kom pib ua ntej siv, ua haujlwm yuam kev zoo dua hauv cov tsev qiv ntawv tus qauv, siv lub tswv yim ntawm cov ntaub ntawv tsis hloov pauv thiab hloov pauv los ntawm lub neej ntawd, thiab muaj kev ntaus ntawv zoo li qub kom txo qis qhov yuam kev.

Main innovations:

  • Qhov yuav tsum tau muaj rau Linux ib puag ncig hauv compiler, Cargo pob tus thawj tswj hwm thiab libstd tus qauv tsev qiv ntawv tau nce ntxiv - qhov tsawg kawg nkaus uas yuav tsum tau muaj rau Glibc tau raug tsa los ntawm version 2.11 txog 2.17, thiab Linux ntsiav los ntawm version 2.6.32 txog 3.2. Cov kev txwv kuj tseem siv rau Rust daim ntawv thov executables ua nrog libstd. Cov khoom siv faib khoom siv RHEL 7, SLES 12-SP5, Debian 8 thiab Ubuntu 14.04 ua tau raws li cov cai tshiab. Kev them nyiaj yug rau RHEL 6, SLES 11-SP4, Debian 7 thiab Ubuntu 12.04 yuav raug txiav tawm. Cov neeg siv uas siv Rust-built executables nyob rau hauv ib puag ncig nrog ib tug laus Linux ntsiav raug txhawb kom hloov kho lawv cov tshuab, nyob twj ywm rau cov laus tso tawm ntawm cov compiler, los yog tuav lawv tus kheej libstd diav rawg nrog cov txheej kom muaj kev sib raug zoo.

    Ntawm cov laj thawj rau kev xaus kev txhawb nqa rau cov laus Linux systems yog txwv cov peev txheej los txuas ntxiv tswj kev sib raug zoo nrog cov chaw qub. Kev them nyiaj yug rau cov cuab yeej cuab tam Glibc yuav tsum tau siv cov cuab yeej qub txeeg qub teg thaum tshawb xyuas hauv kev sib koom ua ke txuas ntxiv, nyob rau hauv lub ntsej muag ntawm kev nce qib hauv LLVM thiab cov khoom siv sib sau ua ke. Qhov nce hauv cov ntsiab lus version yog vim muaj peev xwm siv cov kev hu xov tooj tshiab hauv libstd yam tsis tas yuav tsum muaj cov txheej txheem los xyuas kom muaj kev sib raug zoo nrog cov laus laus.

  • Qhov zoo ntawm IntoFuture tau ruaj khov, uas zoo li IntoIterator, tab sis txawv ntawm qhov tom kawg los ntawm kev siv ".await" es tsis txhob "rau ... hauv ... " loops. Thaum ua ke nrog IntoFuture, lo lus ".ait" tuaj yeem cia siab tias tsis yog lub neej yav tom ntej xwb, tab sis kuj muaj lwm yam uas tuaj yeem hloov mus rau yav tom ntej.
  • Cov khoom siv hluav taws xob xeb-tshuaj ntsuam xyuas tau suav nrog hauv kev sau cov khoom siv hluav taws xob uas muab nrog Rust tso tawm. Cov khoom siv hluav taws xob kuj tseem muaj rau kev teeb tsa siv rustup (rustup tivthaiv ntxiv xeb-analyzer).
  • Tus neeg saib xyuas pob khoom suav nrog qhov chaw ua haujlwm qub txeeg qub teg txhawm rau tshem tawm qhov sib npaug ntawm thaj chaw muaj txiaj ntsig ntawm cov pob khoom, xws li Rust versions thiab repository URLs. Tsis tas li ntawd ntxiv kev txhawb nqa rau lub tsev rau ntau lub hom phiaj platforms ib zaug (koj tuaj yeem tam sim no qhia ntau dua ib qho kev txwv hauv "--lub hom phiaj" kev xaiv).
  • Ib feem tshiab ntawm API tau raug hloov mus rau qeb ntawm qhov ruaj khov, suav nrog cov txheej txheem thiab kev siv ntawm cov yam ntxwv tau ruaj khov:
    • yav tom ntej::IntoFuture
    • num::NonZero*::checked_mul
    • num::NonZero*::checked_pow
    • num::NonZero*::saturating_mul
    • num::NonZero*::saturating_pow
    • num::NonZeroI*::abs
    • num::NonZeroI*::checked_abs
    • num::NonZeroI*::overflowing_abs
    • num::NonZeroI*::saturating_abs
    • num::NonZeroI*::unsigned_abs
    • num::NonZeroI*::wrapping_abs
    • num::NonZeroU*::checked_add
    • num::NonZeroU*::checked_next_power_of_two
    • num::NonZeroU*::saturating_add
    • os::unix::process::CommandExt::process_group
    • os::windows::fs::FileTypeExt::is_symlink_dir
    • os::windows::fs::FileTypeExt::is_symlink_file
  • C-tshaj hom, yav tas los stabilized nyob rau hauv lub std::ffi module, tau ntxiv rau cov tub ntxhais thiab cov tsev qiv ntawv alloc:
    • core::ffi::CStr
    • core::ffi::FromBytesWithNulError
    • alloc::ffi::CSstring
    • alloc::ffi::FromVecWithNulError
    • alloc::ffi::IntoStringError
    • alloc::ffi::NulError
  • C hom yav dhau los stabilized nyob rau hauv std::os::raw module tau ntxiv rau cov tub ntxhais::ffi thiab std::ffi modules (piv txwv li, c_uint thiab c_ulong hom tau thov rau hom uint thiab ulong C):
    • fwv::c_char
    • ffi::c_ob ob
    • ffi::c_float
    • ffi::c_ ib
    • ffi::c_long
    • ffi::c_long
    • ffi::c_schar
    • ffi::c_short
    • ffi::c_ ua
    • ffi::c_ ua
    • ffi::c_ ua
    • ffi::c_ulonglong
    • ffi::c_ushort
  • Cov neeg ua haujlwm qib qis tau ruaj khov rau kev siv nrog lub Poll mechanism (nyob rau yav tom ntej nws tau npaj los muab API yooj yim uas tsis tas yuav siv cov qauv qis xws li rub thiab Pin):

    • yav tom ntej::poll_fn
    • taag:: npaj!
  • Qhov "const" tus cwj pwm, uas txiav txim siab qhov ua tau ntawm kev siv nws hauv txhua lub ntsiab lus tsis yog qhov qub, yog siv rau hauv daim ntawv::from_raw_parts muaj nuj nqi.
  • Txhawm rau kom khaws cov ntaub ntawv ntau dua, lub cim xeeb layout ntawm Ipv4Addr, Ipv6Addr, SocketAddrV4 thiab SocketAddrV6 cov qauv tau hloov. Tej zaum yuav muaj teeb meem kev sib raug zoo nrog ib lub pob crate uas siv std::mem::transmute rau qib qis ntawm cov qauv.
  • Kev tsim ntawm xeb compiler rau lub Windows platform siv PGO optimizations (profile-guided optimization), uas ua rau nws muaj peev xwm ua kom cov lej sib sau ua tau zoo los ntawm 10-20%.
  • Lub compiler tau ua raws li cov lus ceeb toom tshiab txog cov chaw tsis siv nyob rau hauv qee cov qauv.

Tsis tas li ntawd, koj tuaj yeem nco qab cov xwm txheej qhia txog kev txhim kho lwm txoj kev siv ntawm Rust language compiler, npaj los ntawm gccrs project (GCC Rust) thiab pom zoo kom suav nrog hauv GCC. Tom qab kev koom ua ke rau pem hauv ntej, tus qauv GCC cov cuab yeej tuaj yeem siv los sau cov kev pabcuam hauv Rust lus yam tsis tas yuav tsum tau nruab lub rustc compiler, tsim siv LLVM kev txhim kho. Tsuav yog txoj kev loj hlob nyob rau hauv txoj kev, thiab txwv tsis pub muaj teeb meem tsis tau pom dua, Rust frontend yuav raug muab tso rau hauv GCC 13 tso tawm rau lub Tsib Hlis xyoo tom ntej. Kev siv GCC 13 ntawm Rust yuav nyob rau hauv beta xwm txheej, tseem tsis tau qhib los ntawm lub neej ntawd.

Tau qhov twg los: opennet.ru

Ntxiv ib saib