Puo ea Rust programming 1.57 tokollo

Ho lokolloa ha puo ea lenaneo la tsamaiso Rust 1.57, e thehiloeng ke morero oa Mozilla, empa hona joale e ntlafalitsoe ka tlas'a ts'ebetso ea mokhatlo o ikemetseng o sa etseng phaello Rust Foundation, e hatisitsoe. Puo e tsepamisitse maikutlo holim'a ts'ireletso ea mohopolo, e fana ka taolo ea memori ea othomathike, 'me e fana ka mekhoa ea ho fihlela ts'ebetso e phahameng ea ts'ebetso ntle le ho sebelisa pokello ea lithōle kapa nako ea ho sebetsa (nako ea ho sebetsa e fokotsehile ho qala le ho boloka laebrari e tloaelehileng).

Taolo ea memori ea othomathike ea Rust e felisa liphoso ha e tsamaisa lintlha le ho sireletsa khahlanong le mathata a bakoang ke ho qhekella ha memori ea boemo bo tlase, joalo ka ho fihlella sebaka sa memori kamora hore e lokolloe, li-null pointer dereferences, buffer overruns, jj. Ho aba lilaebrari, ho etsa bonnete ba ho kopanya le ho laola ba itšetlehileng ka bona, morero o nts'etsapele mookameli oa thepa ea thepa. Sebaka sa polokelo ea crates.io se tšehetsoa bakeng sa lilaebrari tse amohelang batho.

Litlhahiso tse ka sehloohong:

  • Tšebeliso ea "panic!" macro e tsitsitse. maemong a entsoeng nakong ea pokello, joalo ka liphatlalatso tsa "const fn". Ho phaella moo, ntle le ho sebelisa "ho tšoha!" const declarations lumella tšebeliso ea "assert!" macro. le li-API tse ling tse tloaelehileng tsa laeborari. Ho tsitsisa ha ho so koahele lisebelisoa tsohle tsa sebopeho, ka hona, ka sebopeho sa eona sa hajoale "panic!" macro e ka sebelisoa feela ka likhoele tse tsitsitseng (panic!(“...")) kapa ka boleng bo le bong "&str" ha ho nkeloa sebaka (panic!("{}", a)), e lokelang ho lekanyetsoa feela ho kenya "{ }" ntle le ho fomata litlhare le mefuta e meng. Nakong e tlang, ts'ebeliso ea li-macro maemong a sa feleng e tla atolosoa, empa matla a tsitsitseng a se a ntse a lekane ho etsa tlhahlobo ea boits'oaro boemong ba ho bokella: const _: () = assert!(std::mem::size_of::() == 64); const _: () = tiisetso!(std::mem::size_of::() == 8);
  • Motsamaisi oa sephutheloana sa Cargo o lumella ts'ebeliso ea li-profiles tse nang le mabitso a ikhethileng, a sa felle ho "dev", "release", "test" le "bench". Ka mohlala, ho nolofalletsa ho ntlafatsa sethaleng sa ho hokahanya (LTO) ha feela likopano tsa ho qetela tsa lihlahisoa li hlahisoa, u ka etsa "profile" profil ho Cargo.toml 'me u kenye folakha ea "lto = true" ho eona. Leha ho le joalo, ha u hlalosa boemo ba hau, u tlameha ho hlakisa boemo bo teng ho rua litlhophiso tsa kamehla ho tsoa ho eona. Mohlala o ka tlase o theha profil ea "tlhahiso" e tlatsanang le boemo ba "tokoloho" ka ho kenyelletsa folakha ea "lto = nnete". Profaele ka boeona e kentsoe tšebetsong ka ho letsetsa thepa ka khetho ea "--profile production", 'me li-artifacts tsa kopano li tla beoa bukeng ea "target/production". [profile.production] lefa = "lokolla" lto = nnete
  • Ts'ebeliso ea try_reserve bakeng sa mefuta ea Vec, String, HashMap, HashSet le VecDeque e tsitsitse, e u lumellang ho boloka sebaka esale pele bakeng sa palo e itseng ea likarolo tsa mofuta o fanoeng e le ho fokotsa khafetsa ts'ebetso ea kabo ea memori le ho qoba. ho soahlamana nakong ya tshebetso ka baka la ho hloka mohopolo.
  • E lumelletsoe ho hlakisa li-macros tse nang le lithapo tse kobehileng ka mantsoe a kang "m!{ .. }.method()" le "m!{ .. }?".
  • Ts'ebetso ea File::read_to_end and read_to_string mesebetsi e ntlafalitsoe.
  • Ts'ehetso ea litlhaloso tsa Unicode e ntlafalitsoe hore e be mofuta oa 14.0.
  • Eketsa palo ea mesebetsi e tšoailoeng "#[must_use]" ho fana ka temoso haeba boleng ba ho khutla bo hlokomolohuoa, e leng ho thusang ho tseba liphoso tse bakoang ke ho nka hore mosebetsi o tla fetola boleng ho fapana le ho khutlisa boleng bo bocha.
  • E kentse morao-rao oa liteko bakeng sa tlhahiso ea khoutu ho sebelisoa libgccjit.
  • Karolo e ncha ea API e fetiselitsoe sehlopheng sa ba tsitsitseng, ho kenyelletsa le mekhoa le ts'ebetsong ea mekhoa e tsitsitseng:
    • [T; N]::as_mut_slice
    • [T; N]:: joalo ka_sekotoana
    • likoleke::TryReserveError
    • HashMap::try_reserve
    • HashSet::try_reserve
    • Khoele::try_reserve
    • String::try_reserve_exact
    • Vec::try_reserve
    • Vec::try_reserve_exact
    • VecDeque::try_reserve
    • VecDeque::try_reserve_exact
    • Iterator::map_while
    • iter::MapWhile
    • proc_macro::e_ea fumaneha
    • Taelo::get_program
    • Taelo::get_args
    • Taelo::get_envs
    • Taelo::get_current_dir
    • CommandArgs
    • CommandEnvs
  • Sebopeho sa "const", se etsang qeto ea hore na se ka sebelisoa maemong afe kapa afe ho e-na le li-constants, se sebelisoa molemong oa tlhahiso:: unreachable_unchecked.
  • Boemo ba boraro ba ts'ehetso bo kentsoe ts'ebetsong bakeng sa armv6k-nintendo-3ds, armv7-unknown-linux-uclibceabihf, m68k-unknown-linux-gnu, aarch64-kmc-solid_asp3, armv7a-kmc-solid_asp3-eabi-kmv7a solid_asp3-eabihf platforms. Boemo ba boraro bo kenyelletsa ts'ehetso ea mantlha, empa ntle le tlhahlobo ea boiketsetso, meaho ea semmuso ea phatlalatso, kapa ho hlahloba hore na khoutu e ka hahuoa.

Source: opennet.ru

Eketsa ka tlhaloso