rust: macros: take string literals in `module!`
authorGary Guo <gary@garyguo.net>
Thu, 10 Nov 2022 16:41:19 +0000 (17:41 +0100)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 4 Dec 2022 00:59:15 +0000 (01:59 +0100)
commitb13c9880f909ca5e406d9b3d061359fd8fb0c514
tree9b59eb45b79a659a8ddc42e84ccbcd1c40e98c9b
parentb44becc5ee808e02bbda0f90ee0584f206693a33
rust: macros: take string literals in `module!`

Instead of taking binary string literals, take string ones instead,
making it easier for users to define a module, i.e. instead of
calling `module!` like:

    module! {
        ...
        name: b"rust_minimal",
        ...
    }

now it is called as:

    module! {
        ...
        name: "rust_minimal",
        ...
    }

Module names, aliases and license strings are restricted to
ASCII only. However, the author and the description allows UTF-8.

For simplicity (avoid parsing), escape sequences and raw string
literals are not yet handled.

Link: https://github.com/Rust-for-Linux/linux/issues/252
Link: https://lore.kernel.org/lkml/YukvvPOOu8uZl7+n@yadro.com/
Signed-off-by: Gary Guo <gary@garyguo.net>
[Reworded, adapted for upstream and applied latest changes]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/macros/helpers.rs
rust/macros/lib.rs
rust/macros/module.rs
samples/rust/rust_minimal.rs
samples/rust/rust_print.rs