Rust 1.53 tso tawm. Google yuav pab nyiaj ntxiv Rust kev txhawb nqa rau Linux ntsiav

Kev tso tawm ntawm cov kab lus programming Rust 1.53, 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 hais txog kev nyab xeeb ntawm kev nco, muab kev tswj hwm kev nco tsis siv neeg, thiab muab txoj hauv kev kom ua tiav cov haujlwm ua haujlwm siab tsis tas siv cov khoom siv khib nyiab lossis lub sijhawm ua haujlwm (runtime raug txo qis rau kev pib pib thiab kev saib xyuas ntawm lub tsev qiv ntawv txheem).

Rust txoj kev tswj hwm tsis siv neeg lub cim xeeb txuag tus tsim tawm los ntawm kev ua yuam kev thaum tswj cov taw qhia thiab tiv thaiv cov teeb meem uas tshwm sim vim kev tswj hwm kev nco 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.

Main innovations:

  • Rau arrays, qhov kev zoo ntawm IntoIterator tau siv, uas tso cai rau koj los npaj cov iteration ntawm array ntsiab los ntawm qhov tseem ceeb: rau kuv hauv [1, 2, 3] { .. }

    Nws tseem tuaj yeem dhau arrays rau txoj hauv kev uas lees txais iterators, piv txwv li: cia teeb = BTreeSet::from_iter([1, 2, 3]); rau (a, b) hauv some_iterator.chain([1]).zip([1, 2, 3]) { .. }

    Yav dhau los, IntoIterator tsuas yog siv rau array references, i.e. rau iterate tshaj qhov tseem ceeb yuav tsum tau siv cov ntaub ntawv (“&[1, 2, 3]”) lossis “[1, 2, 3].iter()”. Qhov kev siv ntawm IntoIterator rau arrays yog hampered los ntawm compatibility teeb meem tshwm sim los ntawm ib tug ua ntej compiler conversion ntawm array.into_iter() mus rau (&array).into_iter(). Cov teeb meem no tau raug daws nrog kev ua haujlwm - lub compiler yuav txuas ntxiv hloov array.into_iter() mus rau (&array).into_iter() zoo li tsis muaj kev siv ntawm IntoIterator zoo, tab sis tsuas yog thaum hu rau txoj kev siv ".into_iter( )" syntax thiab tsis kov cov hu hauv daim ntawv "hauv [1, 2, 3]", "iter.zip([1, 2, 3]), "IntoIterator::into_iter([1, 2, 3]] )".

  • Nws tuaj yeem hais qhia cov kab lus "|" (kev ua haujlwm lossis kev ua haujlwm) hauv ib feem ntawm tus qauv, piv txwv li, tsis yog “Qee (1) | Some(2)" tam sim no koj tuaj yeem sau "Qee (1 | 2)": match result { Ok(Some(1 | 2)) => {.. } Err(MyError { kind: FileNotFound | PermissionDenied, .. }) => { .. } _ => { .. } }
  • Kev siv cov cim tsis yog ASCII hauv cov cim tau tso cai, suav nrog cov cim hauv tebchaws uas tau teev tseg hauv Unicode UAX 31 specification, tab sis tsis suav cov cim emoji. Yog tias koj siv cov cim sib txawv tab sis zoo sib xws, lub compiler yuav ceeb toom. const BLÅHAJ: &str = "🦈"; struct 人 { 名字: String, } cia α = 1; letsos = 2; ceeb toom: tus cim tus khub suav tias tsis meej pem ntawm 's' thiab 's'
  • Ib feem tshiab ntawm APIs tau raug pauv mus rau qeb ruaj khov, suav nrog cov hauv qab no ruaj khov:
    • array:: los ntawm_ref
    • array::from_mut
    • AtomicBool::fetch_update
    • AtomicPtr::fetch_update
    • BTreeSet::retain
    • BTreeMap ::rov
    • BufReader::seek_relative
    • cmp::min_by ib
    • cmp::min_by_key
    • cmp::max_by ib
    • cmp::max_by_key
    • DebugStruct::finish_non_exhaustive
    • Duration:: ZERO
    • Duration:: MAX
    • Duration:: is_zero
    • Duration:: saturating_add
    • Duration::saturating_sub
    • Duration::saturating_mul
    • f32:: yog
    • f64:: yog
    • IntoIterator rau arrays
    • {integer}::BIT
    • io:: yuam kev::Unsupported
    • NonZero*::leading_zeros
    • NonZero*::trailing_zeros
    • Kev xaiv:: ntxig
    • Ordering::is_eq
    • Ordering::is_ne
    • Ordering::is_lt
    • Ordering::is_gt
    • Order::is_le
    • Ordering::is_ge
    • OsStr::make_ascii_lowercase
    • OsStr::make_ascii_uppercase
    • OsStr::to_ascii_lowercase
    • OsStr::to_ascii_uppercase
    • OsStr::is_ascii
    • OsStr::eq_ignore_ascii_case
    • Peekable::peek_mut
    • Rc::increment_strong_count
    • Rc::decrement_strong_count
    • slice::IterMut::as_slice
    • AsRef<[T]> rau daim::IterMut
    • impl SliceIndex rau (Bound , Txhaum )
    • Vec::extend_from_within
  • Qhov thib peb theem ntawm kev txhawb nqa rau wasm64-tsis paub-tsis paub platform tau ua tiav. Qib thib peb suav nrog kev txhawb nqa yooj yim, tab sis tsis muaj kev sim automated, tshaj tawm kev tsim kho, lossis tshawb xyuas seb qhov chaws puas tuaj yeem tsim.
  • Tus neeg saib xyuas pob khoom tau raug tsiv mus siv lub npe "tseem ceeb" rau lub ntsiab ceg ntawm Git repository (HEAD) los ntawm lub neej ntawd. Dependencies hosted nyob rau hauv repositories uas siv lub npe lub ntsiab es tsis txhob ntawm tus tswv tsis tas yuav tsum tau ceg = "main" rau configured.
  • Nyob rau hauv lub compiler, qhov yuav tsum tau rau qhov tsawg kawg nkaus version ntawm LLVM raug tsa mus rau LLVM 10.

Tsis tas li ntawd, peb tuaj yeem sau tseg txog kev muab nyiaj txiag rau kev txhim kho kev koom ua ke rau hauv Linux ntsiav ntawm cov cuab yeej los tsim cov khoom hauv Rust lus. Kev ua haujlwm yuav raug ua nyob rau hauv lub moj khaum ntawm Prossimo qhov project nyob rau hauv kev txhawb nqa ntawm ISRG lub koom haum (Internet Security Research Group), uas yog tus tsim ntawm Let's Encrypt project thiab txhawb HTTPS thiab kev txhim kho cov thev naus laus zis txhawm rau txhim kho kev ruaj ntseg ntawm cov khoom siv. Internet. Cov nyiaj yuav yog muab los ntawm Google, uas yuav them rau kev ua haujlwm ntawm Miguel Ojeda, tus sau ntawm Rust-for-Linux project. Yav dhau los, ISRG thiab Google twb tau pab nyiaj rau kev tsim lwm HTTP backend rau curl utility thiab kev txhim kho TLS module tshiab rau Apache http server.

Raws li Microsoft thiab Google, kwv yees li 70% ntawm qhov tsis zoo yog tshwm sim los ntawm kev tuav lub cim xeeb tsis zoo. Nws cia siab tias kev siv cov lus Rust los tsim cov khoom xyaw xws li cov cuab yeej tsav tsheb yuav txo qhov kev pheej hmoo ntawm qhov tsis zoo los ntawm kev tuav lub cim xeeb tsis zoo thiab tshem tawm qhov yuam kev xws li nkag mus rau thaj chaw nco tom qab nws tau tso tawm thiab dhau ntawm qhov tsis muaj ciam teb.

Kev tuav pov hwm kev nco yog muab rau hauv Rust ntawm lub sijhawm los ntawm kev siv tshuaj xyuas, ua raws li cov tswv cuab ntawm cov khoom thiab lub neej ntawm cov khoom (scope), nrog rau kev 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 naj npawb overflows, yuav tsum tau pib pib ntawm qhov sib txawv ntawm qhov tseem ceeb ua ntej siv, tuav cov kev ua yuam kev zoo dua hauv cov tsev qiv ntawv tus qauv, siv lub tswv yim ntawm cov ntaub ntawv tsis hloov pauv thiab cov kev hloov pauv los ntawm lub neej ntawd, muaj kev ntaus ntawv zoo li qub kom txo qis cov kev ua yuam kev.

Tau qhov twg los: opennet.ru

Ntxiv ib saib