From 8909a80e3f684fb274a171489c16e8f10c482e83 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Tue, 6 Dec 2022 02:05:19 +0100 Subject: rust: alloc: remove the `borrow` module (`ToOwned`, `Cow`) The `Cow` type [1] requires that its generic parameter type implements the `ToOwned` trait [2], which provides a method to create owned data from borrowed data, usually by cloning. However, it is infallible, and thus in most cases it is not useful for the kernel. [3] Therefore, introduce `cfg(no_borrow)` to remove the `borrow` module (which contains `ToOwned` and `Cow`) from `alloc`. Link: https://doc.rust-lang.org/alloc/borrow/enum.Cow.html [1] Link: https://doc.rust-lang.org/alloc/borrow/trait.ToOwned.html [2] Link: https://lore.kernel.org/rust-for-linux/20221204103153.117675b1@GaryWorkstation/ [3] Cc: Gary Guo Cc: Wedson Almeida Filho Cc: Josh Triplett Signed-off-by: Miguel Ojeda Reviewed-by: Wei Liu Reviewed-by: Finn Behrens --- rust/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'rust/Makefile') diff --git a/rust/Makefile b/rust/Makefile index ff70c4c916f8..d7621fad5b56 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -50,6 +50,7 @@ core-cfgs = \ --cfg no_fp_fmt_parse alloc-cfgs = \ + --cfg no_borrow \ --cfg no_fmt \ --cfg no_global_oom_handling \ --cfg no_macros \ -- cgit v1.2.3