Dev News: A New Rust Release and Chrome 114 Updates
The Rust team released Rust 1.70.0 Thursday, and users should see “substantially improved performance” when fetching information from the crate.io index.
That’s because this release makes Cargo’s “sparse” protocol enabled by default for reading the index from crates.io. Previously, using that protocol required configuration.
It comes with a caveat, though — the upgrade changes the path to the crate cache, so dependencies must be downloaded again. The Rust team suggested developers clear out the old registry paths once they’ve fully committed to using the sparse protocol.
Also OnceCell and its thread-safe counterpart OnceLock have been established for one-time initialization of shared data.
“These can be used anywhere that immediate construction is not wanted, and perhaps not even possible like non-const data in global variables,” the team noted. “Crates such as lazy_static and once_cell have filled this need in the past, but now these building blocks are part of the standard library, ported from once_cell’s unsync and sync modules.”
Other changes in this release:
- IsTerminal is also stabilized;
- The Cdebuginfo compiler option now has named levels of debug information, meaning you can now set the debut levels by name: “none” (0), “limited” (1), and “full” (2) as well as two new levels, “line-directives-only” and “line-tables-only.” These naming options aren’t yet available to be used via Cargo.toml, which is expected to be supported in the next release;
- Stable and beta builds of Rust no longer allow unstable test options, making them truly nightly-only as documented;
- A long list of stabilized APIs.
What’s New in Chrome 114
First, in one line, developers can now improve text layouts. Developers don’t necessarily know the final size, font size or even language of a text, which can make it difficult to make headlines and text blocks look … well, balanced. Now, with text-wrap: balance, developers can request the browser to figure out the best balanced line-wrapping solution.
“The balanced text block is more pleasing to the eye of a reader,” Jara wrote. “It grabs attention better and is overall easier to read.”
Second, another new feature, CHIPS (Cookies Having Independent Partitioned State) enables opting-in to third-party cookies being partitioned by a top-level site using the new cookie attribute Partitioned, she explained. Previously, an embedded site could set a cookie on one site and use it from another, which created a cross-site tracking issue.
“While cross-site tracking is an issue, there are valid cross-site cookie needs which can be achieved in a privacy-preserving way with cookie partitioning,” Jara explained. “With CHIPS, when a user visits site A and embedded content from site C sets a cookie with the Partitioned attribute, the cookie is saved in a partitioned jar only for cookies that site C sets when it’s embedded on-site A. The browser would only send that cookie when the top-level site is A.”
Then when the user visits a new site that has embedded the C website, it does not receive the cookie it set when it was embedded in the first site.
Finally, Jara explained how the Popover API makes it easier to build transient user interface elements that are displayed on top of all other web app UI. Examples include user-interactive elements such as action menus, form element suggestions, content pickers, and teaching UI.
“The new popover attribute enables any element to be displayed in the top layer automatically,” Jara explained. “This means no more worrying about positioning, stacking elements, focus or keyboard interactions for the developer.”
TypeScript 5.1 Released
“Since the RC, we’ve iterated slightly on our built-in refactorings to move declarations to existing files; however, we believe the implementation still needs some improvements,” wrote Daniel Rosenwasser, the senior program manager for TypeScript. “As a result, you may not be able to access it in most editors at the moment, and can only opt-in through using a nightly version of TypeScript.”
The plan is either to release a patch or incorporate the refactoring into TypeScript 5.2.
The post includes a summary of what’s new in TypeScript 5.1, including:
- Easier implicit returns for undefined-returning functions.
- Unrelated types for getters and setters.
- Decoupled type-checking between JSX elements and JSX tag types.
- Namespaced JSX attributes.
- typeRoots are consulted in module resolution.
- Linked cursors for JSX Tags.
- Snippet completions for @param JSDoc tags.
- A slew of new optimizations.