History

Merge tag 'rust-fixes-6.14-3' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux

Pull rust fixes from Miguel Ojeda: "Toolchain and infrastructure: - Disallow BTF generation with Rust + LTO - Improve rust-analyzer support 'kernel' crate: - 'init' module: remove 'Zeroable' implementation for a couple types that should not have it - 'alloc' module: fix macOS failure in host test by satisfying POSIX alignment requirement - Add missing '\n's to 'pr_*!()' calls And a couple other minor cleanups" * tag 'rust-fixes-6.14-3' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux: scripts: generate_rust_analyzer: add uapi crate scripts: generate_rust_analyzer: add missing include_dirs scripts: generate_rust_analyzer: add missing macros deps rust: Disallow BTF generation with Rust + LTO rust: task: fix `SAFETY` comment in `Task::wake_up` rust: workqueue: add missing newline to pr_info! examples rust: sync: add missing newline in locked_by log example rust: init: add missing newline to pr_info! calls rust: error: add missing newline to pr_warn! calls rust: docs: add missing newline to printing macro examples rust: alloc: satisfy POSIX alignment requirement rust: init: fix `Zeroable` implementation for `Option<NonNull<T>>` and `Option<KBox<T>>` rust: remove leftover mentions of the `alloc` crate

Linus Torvalds committed 1 year ago

Commit cd3a56a2 parents eb88e6b a1eb95d13 files · +85 −57Browse files

Showing the changes to scripts (2 of 13 files). Show all

Unified · Split

2 files
  1. scripts/generate_rust_analyzer.py +42 −29
  2. scripts/rustdoc_test_gen.rs +2 −2
scripts/generate_rust_analyzer.py+42−29
@@ -57,14 +57,26 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs): · 56 unmodified lines
57 crates_indexes[display_name] = len(crates)57 crates_indexes[display_name] = len(crates)
58 crates.append(crate)58 crates.append(crate)
59 59
60 # First, the ones in `rust/` since they are a bit special.60 def append_sysroot_crate(
61 append_crate(61 display_name,
62 "core",62 deps,
63 sysroot_src / "core" / "src" / "lib.rs",63 cfg=[],
64 [],64 ):
65 cfg=crates_cfgs.get("core", []),65 append_crate(
66 is_workspace_member=False,66 display_name,
67 )67 sysroot_src / display_name / "src" / "lib.rs",
68 deps,
69 cfg,
70 is_workspace_member=False,
71 )
72
73 # NB: sysroot crates reexport items from one another so setting up our transitive dependencies
74 # here is important for ensuring that rust-analyzer can resolve symbols. The sources of truth
75 # for this dependency graph are `(sysroot_src / crate / "Cargo.toml" for crate in crates)`.
76 append_sysroot_crate("core", [], cfg=crates_cfgs.get("core", []))
77 append_sysroot_crate("alloc", ["core"])
78 append_sysroot_crate("std", ["alloc", "core"])
79 append_sysroot_crate("proc_macro", ["core", "std"])
68 80
69 append_crate(81 append_crate(
70 "compiler_builtins",82 "compiler_builtins",
@@ -75,7 +87,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs): · 4 unmodified lines
75 append_crate(87 append_crate(
76 "macros",88 "macros",
77 srctree / "rust" / "macros" / "lib.rs",89 srctree / "rust" / "macros" / "lib.rs",
78 [],90 ["std", "proc_macro"],
79 is_proc_macro=True,91 is_proc_macro=True,
80 )92 )
81 93
@@ -85,27 +97,28 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs): · 3 unmodified lines
85 ["core", "compiler_builtins"],97 ["core", "compiler_builtins"],
86 )98 )
87 99
88 append_crate(100 def append_crate_with_generated(
89 "bindings",101 display_name,
90 srctree / "rust"/ "bindings" / "lib.rs",102 deps,
91 ["core"],103 ):
92 cfg=cfg,104 append_crate(
93 )105 display_name,
94 crates[-1]["env"]["OBJTREE"] = str(objtree.resolve(True))106 srctree / "rust"/ display_name / "lib.rs",
107 deps,
108 cfg=cfg,
109 )
110 crates[-1]["env"]["OBJTREE"] = str(objtree.resolve(True))
111 crates[-1]["source"] = {
112 "include_dirs": [
113 str(srctree / "rust" / display_name),
114 str(objtree / "rust")
115 ],
116 "exclude_dirs": [],
117 }
95 118
96 append_crate(119 append_crate_with_generated("bindings", ["core"])
97 "kernel",120 append_crate_with_generated("uapi", ["core"])
98 srctree / "rust" / "kernel" / "lib.rs",121 append_crate_with_generated("kernel", ["core", "macros", "build_error", "bindings", "uapi"])
99 ["core", "macros", "build_error", "bindings"],
100 cfg=cfg,
101 )
102 crates[-1]["source"] = {
103 "include_dirs": [
104 str(srctree / "rust" / "kernel"),
105 str(objtree / "rust")
106 ],
107 "exclude_dirs": [],
108 }
109 122
110 def is_root_crate(build_file, target):123 def is_root_crate(build_file, target):
111 try:124 try:
scripts/rustdoc_test_gen.rs+2−2
@@ -15,8 +15,8 @@ · 14 unmodified lines
15//! - Test code should be able to define functions and call them, without having to carry15//! - Test code should be able to define functions and call them, without having to carry
16//! the context.16//! the context.
17//!17//!
18//! - Later on, we may want to be able to test non-kernel code (e.g. `core`, `alloc` or18//! - Later on, we may want to be able to test non-kernel code (e.g. `core` or third-party
19//! third-party crates) which likely use the standard library `assert*!` macros.19//! crates) which likely use the standard library `assert*!` macros.
20//!20//!
21//! For this reason, instead of the passed context, `kunit_get_current_test()` is used instead21//! For this reason, instead of the passed context, `kunit_get_current_test()` is used instead
22//! (i.e. `current->kunit_test`).22//! (i.e. `current->kunit_test`).