|
|
Log in / Subscribe / Register

An update on Rust's project goals

By Daroc Alden
October 8, 2026

Kangrejos

Tomáš Šedovič is a program manager at the Rust Foundation. He co-leads the goals team, which helps organize the Rust project's overall goals, including making sure that the people who have agreed to work on one have the support they need. At Kangrejos 2026, he provided an overview of the Rust project's goal processes aimed at ensuring that the Rust for Linux developers were aware of how the project organizes, tracks, and amends goals. The Rust for Linux project has inspired several current project goals, so he thought that getting an inside view of the process might be helpful.

The Rust project's goals are one of several entry points to making changes in Rust, Šedovič said. If someone wants to make a change and knows how, they can just talk to the relevant team and do it. If someone wants to make a change, but they don't know where to start or who to talk to, that's where the goals team comes in. They will take a proposal, work on it in collaboration with the submitter, bring it to the right people to make the change, and follow up to make sure everything stays on track.

[Tomaš Šedovič]

The initial proposal can be anything: a feature, refactoring in the compiler, test coverage, performance work, etc. Most goals are for specific features, but they don't have to be. Once the proposal is written up, someone needs to commit to doing the actual implementation work. Often, that is the proposal author, but sometimes it's another contributor to the project. Occasionally, getting someone to agree to do the implementation requires being able to fund their time. The goals team has recently started connecting people with proposals that need funding to donors who are interested in seeing that work done.

Proposals, funding, and in-progress goals are all tracked on the Rust goals web site. Some of the goals are also bundled together into "roadmaps", which are collections of related goals. Goals are supposed to be self-contained and take no more than about a year. Roadmaps are longer-term plans, such as enabling the Linux kernel to build with only stable language features. In 2024, the Rust for Linux project introduced a single Rust project goal. Since then, the ambition has expanded, and there are now thirteen listed goals as part of the Rust for Linux roadmap.

Šedovič briefly demonstrated the layout of the goals website, showing the list of goals in search of contributors, the list of goals looking for funding, and the complete list of all goals. Miguel Ojeda compared this last list to the C++ committee's list of papers, for anyone more familiar with the C/C++ development model.

Goal!

Šedovič then shared a brief progress update on all of the current Rust for Linux goals. He started with the field projections goal, which he called a good example of a well-written goal. Each goal is supposed to be assigned to a specific point of contact, in this case Benno Lossin, who is responsible for ongoing updates. Goals can also have a dedicated Zulip channel for discussion, and one assigned "champion" on each of the involved teams. The field projections goal needs changes to the language's definition, the type checker, the compiler itself, the libraries, and the operational semantics of the language; therefore it has an assigned champion from each of those teams.

The actual work on the goal itself has largely been mapping out the possible design space. Lossin promised to discuss it in his later talk, so Šedovič skipped most of the technical details. Tyler Mandry had also described some of the finalized design at RustConf the previous week.

The next goal discussed, arbitrary self types, was a bit less far-reaching. Currently, methods on Rust types can receive a reference to the value that they are called on as a built-in reference or a built-in smart pointer type such as Box or Rc. The arbitrary self types effort, which is being led by Ding Xiang Fei, seeks to extend that capability to arbitrary user-defined smart pointers. In the kernel, that could make it easier to define convenient APIs that access resources while taking a lock or using read-copy-update (RCU) protection.

Another small change is better in-place initialization. Currently, all structures in Rust are allocated on the stack, even if they are then immediately moved into the heap. That is suboptimal, since it can result in stack overflows when allocating large structures, especially in the kernel, which uses a smaller stack. While it is possible to work around in most cases by filling a slice of memory with zeros and type-casting a pointer to it, it would be nice to have built-in language support, as C++ does. Alice Ryhl is working on that goal.

The concept of an immovable type might also be something that Rust can steal from C++. All Rust types can be moved by directly moving their bytes, except for types wrapped in Pin. That wrapping has always been something of a hack, and makes many interfaces dealing with pinned structures more complicated than they have to be. The immovable types and guaranteed destructors goal encompasses the work necessary to implement a new Move auto-trait that can be opted out of to mark a type as not movable.

The const traits, full const generics, and supertrait auto-implementation goals are all intended to improve the flexibility of Rust's type system. They would, respectively, allow for using trait implementations at compile time, a limited form of dependent typing, and easier backward-compatible changes to trait hierarchies. Ojeda said that the kernel would make good use of all of them, since the ability to safely generate specialized code at compile time is generally useful in a kernel context.

The final goal that Šedovič brought up was the one that started the whole set of Rust for Linux goals: stabilizing the unstable compiler features that the kernel's build relies on. Ojeda then directed people to the tracking document where he keeps abreast of these shared goals on the kernel side, and asked Šedovič if he had any idea how long it might take to work through the existing Rust for Linux goals.

Šedovič did not think that it was possible to say for certain, but said that he's "seen a massive amount of progress" since he started working on the goals team. "Field projections, in-place initialization — those are really hard problems, but people have really been getting into it."

But it's promising, he said, that many of these language changes that were originally requested by the Rust for Linux project are now also being requested by the Python contributors who are attempting to bring Rust to CPython. It has been pleasant to be able to say "oh, we're already working on all of these things," Šedovič said. The fact that two big C projects are requesting the same features, and pooling resources to work on them, suggests that Rust will be well adapted to integrating into existing C projects once the current goals are realized, he concluded.

[ Thanks to the Linux Foundation, LWN's travel sponsor, for assistance with traveling to Kangrejos. ]


Index entries for this article
ConferenceKangrejos/2026


to post comments

Current state of in-place initialization

Posted Oct 9, 2026 19:45 UTC (Fri) by NYKevin (subscriber, #129325) [Link] (7 responses)

> While it is possible to work around in most cases by filling a slice of memory with zeros and type-casting a pointer to it, it would be nice to have built-in language support, as C++ does. Alice Ryhl is working on that goal.

To be clear, while this does require the use of unsafe and (the moral equivalent of) raw pointers, it is at least possible to isolate the unsafety to a relatively small set of "obviously correct" helper functions. It is also not necessary to pre-fill the memory with zeros. For example:

use std::mem::MaybeUninit

struct MyType{
/* some fields */
}

impl MyType{

/// Initialize s in place. For convenience, return &mut Self afterwards.
/// Note that this is a safe function. MaybeUninit provides the relevant invariants already.
fn init(s: &mut MaybeUninit<Self>) -> &mut Self {
unsafe {
// SAFETY: Equivalent to MaybeUninit::write(), which is safe.
/* Cast s to raw pointer and initialize its fields.
* Note that we must initialize all fields here or else the SAFETY comment is wrong.
*/

// SAFETY: We just initialized it.
s.assume_init()
}
}

/// Creates a MyType in a Box.
fn new_boxed() -> Box<Self> {
let u: Box<MaybeUninit<MyType>> = Box::new_uninit();
MyType::init(&mut *u);
// SAFETY: We just initialized it.
// We could take apart the box and use the return value from MyType::init() to reconstitute it,
// but that is longer and still requires unsafe, so there's no point.
unsafe { u.assume_init() }
}

// And so on for other common smart pointers.
// Note that Rc<T> and Arc<T> provide {Rc, Arc}::get_mut() so we can still get &mut MaybeUninit<MyType> from them.
fn new_arc() -> Arc<Self> {...}

// Other MyType methods...

}

What they are currently trying to do, as far as I can tell from reading their design,[1] is to eliminate most or all of the unsafe{} blocks by making the compiler smart enough to understand that we have, in fact, initialized all of the fields. A stretch goal would be replacing &mut MaybeUninit<MyType> with something more explicitly suitable for this use case (e.g. &out MyType or syntax vaguely similar to that). But I'm not convinced you can do that without introducing unforgettable/undroppable types, and that's a whole other can of worms.

[1]: https://rust-lang.github.io/beyond-refs/in-place-init.htm...

Current state of in-place initialization

Posted Oct 10, 2026 0:13 UTC (Sat) by tialaramex (subscriber, #21167) [Link] (1 responses)

I don't think these are morally equivalent to raw pointers. The most crucial idea about raw pointers in Rust which is less important but still honoured in C or C++ would be that we don't care if they alias. The second most crucial idea about raw pointers in Rust is that pointers which are not null are not inherently guaranteed to be pointing /at/ something, your code may have guaranteed something about a particular pointer but the Rust language doesn't inherently care - it turns out this is a very useful property on modern hardware which Rust uses left and right - but adding it to C++ is not easy - see Paul McKenney's C++ proposal P2414.

Without those two facts we've got references, albeit references to a relatively weird type named core::mem::MaybeUninit<T>. I guess LWN is by its nature somewhat C focused and C only has raw pointers when you need a reference type but on the other hand C also understands better than most languages what MaybeUninit<T> is -- it's just a union†, it is big enough for a T to fit but might not be a T. We can unsafely assert that it was a T after all, that's the core trick powering this abstraction.

To me, the sign we're in Raw Pointer territory is when people start doing tricks which rely on the knowledge that "pointers" are actually integer addresses in machine code, hiding bit flags in aligned pointers, XOR linked lists, that sort of thing.

† Literally: https://doc.rust-lang.org/stable/core/mem/union.MaybeUnin...

Current state of in-place initialization

Posted Oct 12, 2026 8:03 UTC (Mon) by NYKevin (subscriber, #129325) [Link]

We do use actual raw pointers in MyType::init(), because there is no other reasonable way to initialize the struct. MaybeUninit<T>::write() only lets you write whole T objects at once, which would defeat the point of in-place initialization, so we have to do things "manually" by converting it into a raw pointer and filling in the fields ourselves. You are correct that we can keep this pointer chicanery confined to the init() method and avoid relying on it for new_boxed() and whatnot (even though they do still need unsafe).

Of course, in cases where the only reason that MyType needs to be initialized in-place is because it is self-referential, we could construct an invalid MyType instance whose self-reference points to the MaybeUninit<MyType>, and then MaybeUninit::write() that instance, thus turning it into a valid self-reference. This is only legal if the self-reference is a raw pointer, because we must not create an invalid safe reference into the MaybeUninit, even if it will become valid immediately afterwards.

For Futures, the more common way of dealing with this problem is to give the object a "just created" state in which it has no self-reference, and then mutate the object in-place to introduce the self-reference after it is awaited for the first time. Then you don't need to do in-place initialization at all, because a "just created" Future is entirely safe to move (and then you can hide it behind Pin once it becomes self-referential). This works because Futures naturally have a "just created" state anyway, so it requires no additional complexity to defer the self-reference until it is needed. For other types, this is obnoxious and possibly unacceptable.

Current state of in-place initialization

Posted Oct 10, 2026 7:08 UTC (Sat) by donald.buczek (subscriber, #112892) [Link] (4 responses)

Would it be possible for the compiler to optimize the copy of a new objects bits into an in-place initialization? Doesn't this already happen under some conditions? If so, could that be expanded? Would it be possible that we could have a mechanism to specify the expectation that this optimization applies in the source code making the compiler throw an error if it is unable?

Just thoughts, maybe nonsense....

Current state of in-place initialization

Posted Oct 11, 2026 6:40 UTC (Sun) by matthias (subscriber, #94967) [Link] (3 responses)

The compiler will optimize the move away, whenever it sees the option to do it. But it is not enough to make sure that this optimization has occurred.

We are talking about types that are not allowed to be moved. So the code might be unsound (contain UB) before this optimization. So this optimization has to be performed before any other optimization that might trigger this UB. This optimization would also need to be applied in debug mode where optimizations are turned off.

This might sound plausible. But the biggest issue is: Why do we need in-place initialization in the first place? Usually for self-referential types. So the initialization code will at some point take the address of the struct and write it into the struct. In the unoptimized code this initialization happend before the move. So it is not only necessary to optimize the move, but we must also make sure that the optimized code never sees the address the struct has on the stack. By some compiler magic it would need to initialize the struct with the address that it will get on the heap (or wherever it will end up), from some allocation that might happen after the initialization in program order. And the compiler cannot simply reorder initialization and allocation, as the memory allocator surely involves some memory barriers.

I have to admit that I have no expertise in compiler development. But I am quite sure that you do not want to rely on compiler optimizations to remove UB from your code. The unoptimized code should never have UB in the first place.

Relying on optimizations to remove UB

Posted Oct 11, 2026 9:20 UTC (Sun) by farnz (subscriber, #17727) [Link] (2 responses)

Your final paragraph underplays it, if anything; relying on optimizations to remove UB is a bad idea because of how UB is defined; by definition, the optimizer could choose another route that removes the UB from the final executable, even if it's not what you want, since it can do anything that replaces UB with defined behaviour (even if it's unwanted, like the "nasal demons" traditional quip), but can't add new UB where the language defined the meaning of the program already.

You need the language to define the meaning of your code so that the optimizer has only one allowed route for handling this code, otherwise you risk a future change (even something as "trivial" as rearranging the order of optimization passes to reduce optimizer run time) breaking your output binary.

Relying on optimizations to remove UB

Posted Oct 12, 2026 19:13 UTC (Mon) by NYKevin (subscriber, #129325) [Link] (1 responses)

It may sound strange, but there is precedent for it. Option<T> provides a number of guaranteed niche optimizations that make certain forms of type punning legal. If you have the Some() variant of Option<&U>, it may be soundly cast to and from &U, because Rust guarantees that the discriminant will not be emitted as a separate field in that case (instead, the None variant is represented as a null pointer, which is not a legal value for &U, so there is no ambiguity). See https://doc.rust-lang.org/std/option/index.html#represent... for details.

However, I do agree that this probably shouldn't be stretched to include things like optimizing a move into an in-place initialization. There is just too much potential for things to go wrong.

Relying on optimizations to remove UB

Posted Oct 13, 2026 13:01 UTC (Tue) by farnz (subscriber, #17727) [Link]

Those are, however, behavioural guarantees from the language, and not just "the optimizer happens to get this right". Casting Option<&T> to *const T, and Option<&T>::Some(&value) to &T is defined as sound by the language, rather than being UB that the compiler happens to interpret in an acceptable way.

And that's really the point here - guaranteeing that something that would normally be UB is defined in this particular case is fine (as happens with Option<&T> - this is defined behaviour, even if transmuting Option<T> to T is not always defined behaviour). Relying on the optimizer spotting that this is normally UB, but that you meant something specific, is not fine.

The same would work for in-place initialization; relying on the compiler spotting that you "meant" a move to be an in-place initialization because otherwise you have UB is not OK, but defining something that would otherwise be UB to mean "in-place initialization" is fine. The important bit is that the language specification (informal or formal) says that this is defined behaviour, not just the optimizer picking up something that could be UB and defining it in a way you like today.

Const traits

Posted Oct 10, 2026 0:55 UTC (Sat) by tialaramex (subscriber, #21167) [Link]

I personally have other improvements to Rust which I'd love to see, but I think const traits is something that actually mostly shrinks the complexity budget for learners whereas many things I'd like further increase complexity and so that's an argument against doing them.

For a beginning Rust programmer the biggest thing const traits would give them is that Rust's lovely for-each loops now work in a context where your expression must be constant.

const FOO: u8 = const { let mut x = 0; for k in 1..4 { x += k }; x };

Today this won't compile (in stable Rust), but to explain why you end up needing to explain a lot of details about de-sugaring of for loops. If we have const traits, it "just works" [the code to make this work already exists it just can't be stabilized without const traits] which is zero for a beginner to learn.

This is definitely in that bag of things which aren't especially relevant to the Kernel but are nice to have in bare metal Rust and so you'd expect to see them in Rust-for-Linux eventually. Maybe in 2027 ?


Copyright © 2026, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds