From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA66C33DA for ; Mon, 27 Feb 2023 13:15:22 +0000 (UTC) Received: by mail-ed1-f42.google.com with SMTP id s26so25482180edw.11 for ; Mon, 27 Feb 2023 05:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=metaspace-dk.20210112.gappssmtp.com; s=20210112; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=NLfg3slGYetUnZNwFE0KVvrcLp3byIgQkx8HPtOniwk=; b=iMQNw+JEZaNx0S4Fy1ik2UI9b/AUDcHI5d0btzcJo7CnjWUsuvBc75cc6zYpTUpdjC kEvCOOgLckJVWNCpRgBaJFkUuZ9JIbAGJ0byjOHXwKdjBynLzwbDssi5vXYU2coP5Z3+ J/TpdJ3lVGMUWpe3fjS5U6JbCdOxOXuhYP5Ey7g6nu/I/SPSKjBgKtTyaIGlPmrgctP9 xTFKfvtDr1z+wTmS7d+vprlvx/u1Kg9BJZFho7XsAFuTGOIyQEG3/GDRYwnlZzGOsce2 dGaVMT4eYv0f0N4ersyJ11a32NitpofrzkerZxeQtD4iU1LHPjbK+nz9D+L2pyPQh2LW TCaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NLfg3slGYetUnZNwFE0KVvrcLp3byIgQkx8HPtOniwk=; b=opiwyOf+tf3Lg4LsbBwHLmel+ugms9yyf4avFyxcRD1EzkNJ3kaeotGzMS/m0D16MI 37wDF1Emq85R5ucAQeTdydrj9XnQW6S1u1WKomB6UrjkNoFf2+AWL6Lhxr5shv6b3/C4 FuGKbB+OwZnpYmPUdbnZpTr82S6nNHjuMlLXUwFWqQfDveL7Yd4c8BSEzi2mcg3JR8t+ rcBw+TRoy1+oS2U+daAfrVhXbBstKbwKVQlK0vlQvNvWwDaWJyI8MAN+/xAK4CB/FrKN k9nCM/mU4Db/48ys8JvXm4i7FPQZqRFn8nQqpXcQd9L/QUfRytQTlmM5RIZQ80pT6y9T xHzA== X-Gm-Message-State: AO0yUKUZUDw1Pf/wiM9mGUnb8S1prSo2h5oBGEnkw9QTgOkU65uf1ZO4 nFzU0jHjlwUckzfDiYzlqE4mZQ== X-Google-Smtp-Source: AK7set+C5GBZkxh9cQ81KCkP9JYoxHpIYbP0Hhu7L+GDszmWgF9kUxmPh/hzISjMRllVNmtL7L9FRw== X-Received: by 2002:a17:907:94c1:b0:8f4:86a9:748d with SMTP id dn1-20020a17090794c100b008f486a9748dmr9706231ejc.12.1677503720810; Mon, 27 Feb 2023 05:15:20 -0800 (PST) Received: from localhost ([194.62.217.2]) by smtp.gmail.com with ESMTPSA id lt20-20020a170906fa9400b008e97fdd6c7csm3183244ejb.129.2023.02.27.05.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 05:15:20 -0800 (PST) References: <20230224-rust-new_uninit-v1-1-c951443d9e26@asahilina.net> User-agent: mu4e 1.9.18; emacs 28.2.50 From: Andreas Hindborg To: Asahi Lina Cc: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, asahi@lists.linux.dev Subject: Re: [PATCH] rust: Enable the new_uninit feature for kernel and driver crates Date: Mon, 27 Feb 2023 14:09:37 +0100 In-reply-to: <20230224-rust-new_uninit-v1-1-c951443d9e26@asahilina.net> Message-ID: <87pm9v9rmg.fsf@metaspace.dk> Precedence: bulk X-Mailing-List: asahi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Asahi Lina writes: > 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] https://github.com/Rust-for-Linux/linux/issues/879 > [2] https://github.com/Rust-for-Linux/linux/issues/2 > [3] https://github.com/rust-lang/rust/issues/63291 > > Signed-off-by: Asahi Lina > --- > rust/kernel/lib.rs | 1 + > scripts/Makefile.build | 2 +- > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs > index 223564f9f0cc..1118cd3e0b5f 100644 > --- a/rust/kernel/lib.rs > +++ b/rust/kernel/lib.rs > @@ -17,6 +17,7 @@ > #![feature(core_ffi_c)] > #![feature(dispatch_from_dyn)] > #![feature(generic_associated_types)] > +#![feature(new_uninit)] > #![feature(receiver_trait)] > #![feature(unsize)] > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index a0d5c6cca76d..0f637e1ca8dc 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -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 What is the purpose of adding the feature here? The kernel crate seems to compile fine without this. BR Andreas