Rust 1.77.0: 70 highlights in 30 minutes

preview_player
Показать описание
New changes Rust 1.77.0!

Links:

0:21 1. C-string literals
1:02 2. Recursive async fn
2:12 3. offset_of!
2:38 4. std debuginfo is now stripped
3:52 5. incompatible_msrv lint
4:56 Other Rust Changes
5:07 6. Exhaustiveness: reveal opaque types properly
5:31 7. Stabilize THIR unsafeck
6:00 8. New static_mut_refs lint
6:20 9. Undeprecate unstable_features lint
6:38 10. coinductive_overlap_in_coherence promoted to hard error
6:54 11. Eliminate type-driven traversal in const-eval interning
7:22 12. Deny braced macro invocations in let-else statements.
8:12 13. soft_unstable lints now shows up in future breakage reports
8:23 14. Make i128 and u128 16-byte aligned on x86-based targets
8:59 15. Diagnostics now emit more information with --verbose
9:16 16. Improve spacing between printed tokens
9:27 17. Merge unused_tuple_struct_fields into dead_code
9:42 18. Error on incorrect implied bounds in well-formedness check
10:16 19. Fix coverage instrumentation/reports for non-ASCll source code.
10:41 20. Internal fixes
11:06 21. Target Promotions
11:19 22. New Tier 3 Targets
11:55 23. Implement From(&[T; N]) for Cow([T])
12:13 24. Remove special-case handling of Vec::split_off(0)
12:45 Stabilized APIs
12:56 25. array::each_ref & array::each_mut
13:12 26. core::net
13:44 27. round_ties_even for f32 & f64
14:09 28. slice chunk methods
15:29 29. Bound::map
16:00 30. File::create_new
16:37 31. Mutex::clear_poison & RwLock::clear_poison
17:12 Rustdoc
17:17 32. Links allowed in markdown headings
17:24 33. Docs search box supports parens-based type expression syntax
17:44 34. New icon to expand files pane in docs source code view
18:04 35. Prevent JS injection from localStorage
18:21 36. Recommend version-sorting in the Style Guide
18:43 37. More weirdness in weird-exprs .rs
21:00 Cargo
21:03 38. Extend build directive syntax with cargo::
21:28 39. Stabilize id format as PackageIDSpec
21:51 40. cargo-util-schemas
22:09 41. Inherit jobserver from env for all kinds of runner
22:30 42. rustc plugin support deprecated in cargo
22:44 43. Add colors to -Zhelp console output
23:05 45. Hold the mutate exclusive lock when vendoring
23:17 46. Set Content-Type: application/json only for requests with a body payload
23:32 47. Set OUT_DIR for all units with build scripts
23:42 48. Fix cargo add selecting the wrong package
23:58 49. cargo fix calls rustc fewer times
24:06 50. Don't inherit workspace if new package is on exclude list
24:17 51. Fix cargo update --precise to accept git branches and tags
24:43 53. Support inserting new lines in cargo fix
24:56 54. Various documentation updates
25:09 Clippy
25:12 55. multiple_crate_versions (feature)
25:34 56. single_call_fn (fix)
25:48 57. unit_arg (fix)
26:02 58. indexing_slicing (fix)
26:24 59. suspicious_open_options
26:44 60. option_as_ref_cloned
26:59 61. thread_local_initializer_can_be_made_const
27:20 62. str_split_at_newline
27:41 63. empty_enum_variants_with_brackets
27:53 64. manual_is_variant_and
28:12 65. pub_underscore_fields
28:34 66. eager_transmute
28:57 67. iter_filter_is_some
29:07 68. iter_filter_is_ok
29:21 69. result_filter_map
29:37 70. unconditional_recursion

Рекомендации по теме
Комментарии
Автор

Recursion is useful for functional-style programming because you can avoid mutable variables. The usual advantages of functional programming apply; being more amenable to tree-like structures and inductive reasoning on them rather than reasoning about state transitions and invariants. The former is often more intuitive and functional code tends to more directly express what is happening at a high level. The usual disadvantages also apply; mainly having to rely on the compiler for performance, which makes it harder to optimize the code.

gamekiller
Автор

*Timestamps*
00:21 1. C-string literals
01:02 2. Recursive async fn
02:12 3. offset_of!
02:38 4. std debuginfo is now stripped
03:52 5. incompatible_msrv lint
*Other Rust Changes*
05:07 6. Exhaustiveness: reveal opaque types properly
05:31 7. Stabilize THIR unsafeck
06:00 8. New static_mut_refs lint
06:20 9. Undeprecate unstable_features lint
06:38 10. promoted to hard error
06:54 11. Eliminate type-driven traversal in const-eval interning
07:22 12. Deny braced macro invocations in let-else statements.
08:12 13. soft_unstable lints now shows up in future breakage reports
08:23 14. Make i128 and u128 16-byte aligned on x86-based targets
08:59 15. Diagnostics now emit more information with --verbose
09:16 16. Improve spacing between printed tokens
09:27 17. Merge unused_tuple_struct_fields into dead_code
09:42 18. Error on incorrect implied bounds in well-formedness check
10:16 19. Fix coverage instrumentation/reports for non-ASCll source code.
10:41 20. Internal fixes
11:06 21. Target Promotions
11:19 22. New Tier 3 Targets
11:55 23. Implement From<&[T; N]> for Cow<[T]>
12:13 24. Remove special-case handling of Vec::split_off(0)
*Stabilized APIs*
12:56 25. array::each_ref & array::each_mut
13:12 26. core::net
13:44 27. round_ties_even for f32 & f64
14:09 28. slice chunk methods
15:29 29. Bound::map
16:00 30. File::create_new
16:37 31. Mutex::clear_poison & RwLock::clear_poison
*Rustdoc*
17:17 32. Links allowed in markdown headings
17:24 33. Docs search box supports parens-based type expression syntax
17:44 34. New icon to expand files pane in docs source code view
18:04 35. Prevent JS injection from localStorage
18:21 36. Recommend version-sorting in the Style Guide
18:43 37. More weirdness in weird-exprs .rs
*Cargo*
21:03 38. Extend build directive syntax with cargo::
21:28 39. Stabilize id format as PackageIDSpec
21:51 40. cargo-util-schemas
22:09 41. Inherit jobserver from env for all kinds of runner
22:30 42. rustc plugin support deprecated in cargo
22:44 43. Add colors to -Zhelp console output
22:53 44. Add rustc style errors for Cargo.toml parsing
23:05 45. Hold the mutate exclusive lock when vendoring
23:17 46. Set Content-Type: application/json only for requests with a body payload
23:32 47. Set OUT_DIR for all units with build scripts
23:42 48. Fix cargo add selecting the wrong package
23:58 49. cargo fix calls rustc fewer times
24:06 50. Don't inherit workspace if new package is on exclude list
24:17 51. Fix cargo update --precise to accept git branches and tags
24:31 52. Warn about unused keys in the [lints] section of Cargo.toml
24:43 53. Support inserting new lines in cargo fix
24:56 54. Various documentation updates
*Clippy*
25:12 55. multiple_crate_versions (feature)
25:34 56. single_call_fn (fix)
25:48 57. unit_arg (fix)
26:02 58. indexing_slicing (fix)
26:24 59. suspicious_open_options
26:44 60. option_as_ref_cloned
26:59 61.
27:20 62. str_split_at_newline
27:41 63.
27:53 64. manual_is_variant_and
28:12 65. pub_underscore_fields
28:34 66. eager_transmute
28:57 67. iter_filter_is_some
29:07 68. iter_filter_is_ok
29:21 69. result_filter_map
29:37 70. unconditional_recursion

Im_Ninooo
Автор

Thank you very much for the effort you put into making these videos, every time a new version of Rust is released I look forward to your videos.
I am impatiently awaiting the video on the 1.78.🙏

RxDiscovery
Автор

Thank you for making these Nathan. I very much appreciate the time you put into them - very informative and useful. Do you have a donation link? Would love to buy you a coffee(s) for your hard work.

RobertWHurst
Автор

Oh boy recursive `async fn` is huge!

One use case for recursive fn is when you are talking to another stateful service and needs to 'redirect' the request to another upstream server

Автор

recursion is very nice for certain parsing techniques, makes the code much easier to read and write

fiona
Автор

A quite simple and practical example of why you would use recursive async functions would be to delete a large folder with multiple threads. If you were to do it in a loop you would need to set up a queue and collectors and write logic to determining what files can be deleted when. With a recursive delete you simply iterate over every child of a folder and call delte recursively then finally delete the folder. All of the logic and scheduling is done by recursion implicitly.

lapissea
Автор

About the recursion vs iteration: There is a whole class of algorithms that are impossible to implement without recursion. Famous example is Ackerman's function, Computerphile has a few great videos about that with prof. Brailsford. Also there are algorithms that are simply easier to implement recursively than iteratively, for example graph/tree exploration.

Edit: I have been corrected, apparently all recursion can be implement with loops. But the second part is correct, some of them are so complicated it is way easier and more practical to do them recursively.

thornuridbahir
Автор

Informative and concise. Useful especially for us maintainers.
Subscribed!

Автор

3:23 it seems strip removes debuginfo and symbols. So stack traces won’t have line numbers or function names.

metaltyphoon
Автор

Another great video, thank you as always. Awesome to see Josh's great work featured again with a pic this time too - I've been playing around with his cool crate io-mux lately

kelownatechkid
Автор

Regarding recursion: NURBS curves and surfaces (massively used in industry) are defined by recursive basis functions, so to evaluate them, it can be useful to do so recursively.

rolandburgstaller
Автор

6:43 Isn't that breaking backwards-compatibility?

VivekYadav-dsoz
Автор

If you're depth-first traversing any kind of branched structure, recursion might be a lot simpler to code, because it handles all the backtracking for you correctly, you will at most need to manually code how to undo a single step. No off-by-one errors on how far to step back, no fear of mixing things up when backtracking many messy steps, easier to remember to go down all paths.

MasterHigure
Автор

10:08 Anyone else feel uncomfortable by this? If it was an exception for warnings, that would've seemed reasonable. But errors protect the parse and semantic rules of a language. So we're literally breaking the language for a project? It's pragmatic sure, but it feels... wrong and unfair. Should've just not introduced the error till Bevy got patched.

VivekYadav-dsoz
Автор

One really important use for recursive calls is compilers.

tserica
Автор

Good stuff, makes some features easier to understand. Thanks

haystackdmilith
Автор

Hey Nathan, I love your changelog videos, but could you bring back the changelog sneak peek back into the preview image of the video? I thought it was kinda cool and it made the preview image more exciting

IIlIlIIIllII
Автор

Well recursion makes the code simpler in many cases.

Автор

Isn’t Cow clone on write? Not copy. Oops @12 or so min 12:00

JohnPywtorak