Opened 5 weeks ago

Closed 5 weeks ago

#19527 closed enhancement (fixed)

rustc-1.77.0

Reported by: Bruce Dubbs Owned by: Xi Ruoyao
Priority: normal Milestone: 12.2
Component: BOOK Version: git
Severity: normal Keywords:
Cc:

Description

New minor version.

Change History (7)

comment:1 by Xi Ruoyao, 5 weeks ago

What's in 1.77.0 stable

This release is relatively minor, but as always, even incremental improvements lead to a greater whole. A few of those changes are highlighted in this post, and others may yet fill more niche needs.

C-string literals

Rust now supports C-string literals (c"abc") which expand to a nul-byte terminated string in memory of type &'static CStr. This makes it easier to write code interoperating with foreign language interfaces which require nul-terminated strings, with all of the relevant error checking (e.g., lack of interior nul byte) performed at compile time.

Support for recursion in async fn

Async functions previously could not call themselves due to a compiler limitation. In 1.77, that limitation has been lifted, so recursive calls are permitted so long as they use some form of indirection to avoid an infinite size for the state of the function.

This means that code like this now works:

async fn fib(n: u32) -> u32 {
   match n {
       0 | 1 => 1,
       _ => Box::pin(fib(n-1)).await + Box::pin(fib(n-2)).await
   }
}

### offset_of!

1.77.0 stabilizes offset_of! (https://doc.rust-lang.org/stable/std/mem/macro.offset_of.html) for struct fields, which provides access to the byte offset of the relevant public field of a struct. This macro is most useful when the offset of a field is required without an existing instance of a type. Implementing such a macro is already possible on stable, but without an instance of the type the implementation would require tricky unsafe code which makes it easy to accidentally introduce undefined behavior.

Users can now access the offset of a public field with `offset_of!(StructName, field). This expands to a usize` expression with the offset in bytes from the start of the struct.

Enable strip in release profiles by default

Cargo [profiles](https://doc.rust-lang.org/stable/cargo/reference/profiles.html) which do not enable [debuginfo](https://doc.rust-lang.org/stable/cargo/reference/profiles.html#debug) in outputs (e.g., debug = 0) will enable strip = "debuginfo" by default.

This is primarily needed because the (precompiled) standard library ships with debuginfo, which means that statically linked results would include the debuginfo from the standard library even if the local compilations didn't explicitly request debuginfo.

Users which do want debuginfo can explicitly enable it with the [debug](https://doc.rust-lang.org/stable/cargo/reference/profiles.html#debug) flag in the relevant Cargo profile.

### Stabilized APIs

Other changes

Check out everything that changed in [Rust](https://github.com/rust-lang/rust/releases/tag/1.77.0), [Cargo](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-177-2024-03-21), and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-177).

comment:2 by Xi Ruoyao, 5 weeks ago

Owner: changed from blfs-book to Xi Ruoyao
Status: newassigned

It built fine and tested almost fine for me.

Now building librsvg and Mozilla stuffs to see if there's any breakage.

comment:3 by Xi Ruoyao, 5 weeks ago

Spidermonkey and Librsvg work fine.

I still cannot get Snapshot to work.

Will try FF, TB, and SM tomorrow.

comment:4 by Xi Ruoyao, 5 weeks ago

Firefox (115.9.1) fine.

comment:5 by Xi Ruoyao, 5 weeks ago

Thunderbird and SeaMonkey also tested fine.

comment:7 by Xi Ruoyao, 5 weeks ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.