Skip to content

Commit

Permalink
rust: Enable the new_uninit feature for kernel and driver crates
Browse files Browse the repository at this point in the history
The unstable new_uninit feature enables various library APIs to create
uninitialized containers, such as `Box::assume_init()`. This is
necessary to build abstractions that directly initialize memory at the
target location, instead of doing copies through the stack.

Will be used by the DRM scheduler abstraction in the kernel crate, and
by field-wise initialization (e.g. using `place!()` or a future
replacement macro which may itself live in `kernel`) in driver crates.

See [1] [2] [3] for background information.

[1] Rust-for-Linux/linux#879
[2] Rust-for-Linux/linux#2
[3] rust-lang/rust#63291

Signed-off-by: Asahi Lina <lina@asahilina.net>
  • Loading branch information
asahilina authored and fbq committed Apr 4, 2023
1 parent 1ac0a3c commit 81baa70
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions rust/kernel/lib.rs
Expand Up @@ -17,6 +17,7 @@
#![feature(core_ffi_c)]
#![feature(dispatch_from_dyn)]
#![feature(generic_associated_types)]
#![feature(new_uninit)]
#![feature(receiver_trait)]
#![feature(unsize)]

Expand Down
2 changes: 1 addition & 1 deletion scripts/Makefile.build
Expand Up @@ -277,7 +277,7 @@ $(obj)/%.lst: $(src)/%.c FORCE
# Compile Rust sources (.rs)
# ---------------------------------------------------------------------------

rust_allowed_features := core_ffi_c
rust_allowed_features := core_ffi_c,new_uninit

rust_common_cmd = \
RUST_MODFILE=$(modfile) $(RUSTC_OR_CLIPPY) $(rust_flags) \
Expand Down

0 comments on commit 81baa70

Please sign in to comment.