Rust 1.75.0: 54 highlights in 20 minutes

preview_player
Показать описание

Links:

0:00 Intro
0:11 1. async fn and return-position impl Trait in Traits
2:17 2. Pointer byte offset APIs
3:01 3. Code layout optimizations for rustc
3:17 4. Allow function pointer signatures to contain &mut T in const contexts
3:40 5. Match usize/isize exhaustively with half-open ranges
4:57 6. Guarantee char has same size and alignment as u32
5:11 7. Null pointer has the 0 address
5:24 8. Allow partially-moved values in match
6:07 9. Document non-compliant floating-point behavior on 32-bit x86 targets
6:25 10. Stabilize ratified RISC-V target features
6:42 11. Negative coherence properly consider impls that only partly overlap
7:02 12. Deny-by-default coinductive_overlap_in_coherence
7:22 13. Consider alias bounds when computing liveness in NLL
7:36 14. Add V (vector) extension to the riscv64-linux-android target spec.
8:00 15. Automatically enable cross-crate inlining for small functions
8:10 16. Three New Tier 3 Targets
8:56 17. Waker::clone_from avoids unnecessary clones
9:14 18. Implement BufRead for VecDeque{u8}
9:21 19. Implement FusedIterator for DecodeUtf16 when the inner iterator does
9:40 20. impl Not, Bit{And,Or}{,Assign} for IP addresses
10:08 21. Implement Default for ExitCode
10:17 22. Guarantee representation of None in NPO
10:38 23. Document when atomic loads are guaranteed read-only
10:59 24. Better document effects of recursive thread local storage initialization
11:14 25. Support sub-millisecond sleep on Windows 10+
11:25 26. Fix reverse searching after calling str::split_inclusive
11:41 27. Fix exit status on non-Unix cfg(unix) platforms
11:58 Stabilized APIs
12:02 28. Atomic*::from_ptr
12:19 29. File time struct, trait, and methods.
13:00 30. IpAddr::to_canonical & Ipv6Addr::to_canonical
13:20 31. Option::as_slice & Option::as_mut_slice
13:32 Const Stabilized APIs
13:39 32. Ipv6Addr::to_ipv4_mapped
13:54 33. MaybeUninit::assume_init_read & MaybeUninit::zeroed
14:17 34. mem::discriminant
14:27 35. mem::zeroed
14:36 Cargo Changes
14:52 37. Allow version-less manifests
15:13 38. Print the generated docs links
15:22 39. Make browser links out of HTML file paths
15:37 40. Print environment variables for build script executions with -vv
15:48 41. Rustdoc accepts less invalid Rust
16:03 42. Show enum discriminant if it is a C-like variant
16:36 Compatibility Notes
16:40 43. FreeBSD targets now require at least version 12
16:50 44. All MIPS targets dropped to Tier 3 support
17:13 45. invalid_alignment lint promoted to an error
17:21 46. Fix detecting references to packed unsized fields
17:38 47. Compiler plugin support removed
17:47 New Clippy Lints
17:55 48. unused_enumerate_index
18:09 49. unnecessary_fallible_conversions
18:30 50. waker_clone_wake
18:42 51. struct_field_names
19:03 52. into_iter_without_iter
19:20 53. iter_without_into_iter
19:37 54. manual_hash_one
19:55 Outro

Correction:
3:53 I was wrong! See @nadrieril's awesome explanation in the comments for the details. TL;DR: Rust wants 32-bit code to be portable to compatible 64-bit platforms, so covering ranges from MIN to MAX is not sufficient.
Рекомендации по теме
Комментарии
Автор

Rust has very diligent team, they made more than 50 updates on 1.5 month, which that's great.

haliszekeriyaozkok
Автор

Love how comprehensive this video is on all the new features! Fantastic work!

sanjsahayam
Автор

Is it just me, or is the 1.75 build _seriously_ faster than 1.73? It's building at the speed I've come to expect from the latest golang compilers.

davidgillies
Автор

Thanks for the great update overview! subbed

ETBCOR
Автор

RISC-V is becoming more common in the embedded space, of course. The newer Espressif ESP32 chips are RISC-V and have very nice Rust support from Espressif.

meowsqueak
Автор

watched this video and now I'm const-stabilised too

RoamingAdhocrat
Автор

Great video :D Thanks for taking the time to work through this for us every time! Your description of the usize range thing is mistaken however: there are never any numbers bigger than usize::MAX, and an if condition wasn't required. Let me try and explain.

You're correct that `usize::MAX` has different values on different platforms. So the range `0..=4294967295` covers all possible usize values on 32-bits platforms, but not on 64-bits platforms. To make code portable, rustc considers `0..=4294967295` as non-exhaustive even if you're working on a 32-bit platform. That's the reason for usize/isize weirdness.

Now `0..=usize::MAX` morally *should* always match all possible values, but for implementation-specific reasons it's treated more like `0..=4294967295` above so it's not treated as exhaustive either. I wish we could fix that but that seems hard.

The final piece is that on 1.74.0, the range `0..` was desugared to `0..=usize::MAX`, so

match x {
0..=5 => foo(),
6.. => bar(),
}

was treated like

match x {
0..=5 => foo(),
6..usize::MAX => bar(),
}

which errors with "ERROR: non-exhaustive, add a `_` arm". You had to write:

match x {
0..=5 => foo(),
6.. => bar(),
_ => unrechable!(),
}

to make it compile (no if required!). With 1.75.0 the range `0...=usize::MAX` is still weird, but now `0..` behaves as expected! Hope that clarifies things!

nadrieril
Автор

Many people might have encountered RISC-V processors without knowing it: Recent NVidia GPUs have a RISC-V co-processor ("GSP") for some tasks.

decathorpe
Автор

hey look it's my plushies 🦀! (that's what made me click)

also, really good + clear video -- content prep and editing must take ages.
how long do you spend on prep (research, slides + sentences), recording, and editing?

azrielh
Автор

Awesome. Rust is great, though a bit hard to grasp the nuts and bolts. Seems the overall effort is worth.

simonkalu
Автор

Lots of gold here, which is weird, because gold doesn’t rust. 🦀

HyperFocusMarshmallow
Автор

Are you sure you are allowed to use the rust logo next to you?

okoyl
Автор

want to buy your rust course on udemy, can you please provide a discount code? will appreciate.

ShittuMonsuru
Автор

never heard of "care" type :D
CHAR, yes, care, no

RootsterAnon
Автор

Bevy destroyed by 'iter_without_intoiter'

mintx