Skip to content

Commit 7e7280f

Browse files
committed
Auto merge of #150481 - matthiaskrgr:rollup-f5b2wkm, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #150108 (Offload: Build offload as a single Step) - #150262 (slice iter cleanup: replace checked_sub with saturating_sub) - #150427 (add has_offload/needs-offload to the test infra) - #150458 (fix running stdlib doctests in Miri in CI) - #150477 (Fix enum variant suggestion consuming trailing parenthesis) - #150478 (Fix new bors config) r? `@ghost` `@rustbot` modify labels: rollup
2 parents a1bb910 + 3748bde commit 7e7280f

23 files changed

Lines changed: 379 additions & 55 deletions

File tree

bootstrap.example.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@
106106
# Whether to build LLVM with support for it's gpu offload runtime.
107107
#llvm.offload = false
108108

109+
# Absolute path to the directory containing ClangConfig.cmake
110+
#llvm.offload-clang-dir = ""
111+
109112
# When true, link libstdc++ statically into the rustc_llvm.
110113
# This is useful if you don't want to use the dynamic version of that
111114
# library provided by LLVM.

compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,13 +1384,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13841384
&& let hir::Node::Stmt(&hir::Stmt { kind: hir::StmtKind::Semi(parent), .. })
13851385
| hir::Node::Expr(parent) = tcx.parent_hir_node(path_expr.hir_id)
13861386
{
1387-
let replacement_span =
1388-
if let hir::ExprKind::Call(..) | hir::ExprKind::Struct(..) = parent.kind {
1389-
// We want to replace the parts that need to go, like `()` and `{}`.
1387+
// We want to replace the parts that need to go, like `()` and `{}`.
1388+
let replacement_span = match parent.kind {
1389+
hir::ExprKind::Call(callee, _) if callee.hir_id == path_expr.hir_id => {
13901390
span.with_hi(parent.span.hi())
1391-
} else {
1392-
span
1393-
};
1391+
}
1392+
hir::ExprKind::Struct(..) => span.with_hi(parent.span.hi()),
1393+
_ => span,
1394+
};
13941395
match (variant.ctor, parent.kind) {
13951396
(None, hir::ExprKind::Struct(..)) => {
13961397
// We want a struct and we have a struct. We won't suggest changing

library/core/src/mem/maybe_dangling.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ use crate::{mem, ptr};
3636
///
3737
/// To fix this we could use `MaybeDangling`:
3838
///
39-
/// ```rust
39+
// FIXME: remove `no_run` once the semantics are actually implemented
40+
/// ```rust,no_run
4041
/// #![feature(maybe_dangling, box_as_ptr)]
4142
/// # use std::alloc::{dealloc, Layout};
4243
/// # use std::mem::{self, MaybeDangling};

library/core/src/slice/iter.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,19 +2495,13 @@ impl<'a, T> Iterator for RChunksMut<'a, T> {
24952495
&& end < self.v.len()
24962496
{
24972497
let end = self.v.len() - end;
2498-
let start = match end.checked_sub(self.chunk_size) {
2499-
Some(sum) => sum,
2500-
None => 0,
2501-
};
2502-
// SAFETY: This type ensures that self.v is a valid pointer with a correct len.
2503-
// Therefore the bounds check in split_at_mut guarantees the split point is inbounds.
2504-
let (head, tail) = unsafe { self.v.split_at_mut(start) };
2505-
// SAFETY: This type ensures that self.v is a valid pointer with a correct len.
2506-
// Therefore the bounds check in split_at_mut guarantees the split point is inbounds.
2507-
let (nth, _) = unsafe { tail.split_at_mut(end - start) };
2508-
self.v = head;
2498+
// SAFETY: The self.v contract ensures that any split_at_mut is valid.
2499+
let (rest, _) = unsafe { self.v.split_at_mut(end) };
2500+
// SAFETY: The self.v contract ensures that any split_at_mut is valid.
2501+
let (rest, chunk) = unsafe { rest.split_at_mut(end.saturating_sub(self.chunk_size)) };
2502+
self.v = rest;
25092503
// SAFETY: Nothing else points to or will point to the contents of this slice.
2510-
Some(unsafe { &mut *nth })
2504+
Some(unsafe { &mut *chunk })
25112505
} else {
25122506
self.v = &mut [];
25132507
None

rust-bors.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ labels_blocking_approval = [
2929
# If CI runs quicker than this duration, consider it to be a failure
3030
min_ci_time = 600
3131

32+
# Flip this once new bors is used for actual merges on this repository
33+
merge_queue_enabled = false
34+
report_merge_conflicts = true
35+
3236
[labels]
3337
approved = [
3438
"+S-waiting-on-bors",
@@ -60,7 +64,3 @@ auto_build_failed = [
6064
"-S-waiting-on-crater",
6165
"-S-waiting-on-team"
6266
]
63-
64-
# Flip this two once new bors is used for actual merges on this repository
65-
merge_queue_enabled = false
66-
report_merge_conflicts = true

src/bootstrap/configure.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ def v(*args):
120120
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
121121
o("llvm-enzyme", "llvm.enzyme", "build LLVM with enzyme")
122122
o("llvm-offload", "llvm.offload", "build LLVM with gpu offload support")
123+
o(
124+
"llvm-offload-clang-dir",
125+
"llvm.offload-clang-dir",
126+
"pass the absolute directory of ClangConfig.cmake",
127+
)
123128
o("llvm-plugins", "llvm.plugins", "build LLVM with plugin interface")
124129
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")
125130
o(

src/bootstrap/mk/Makefile.in

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,15 @@ check-aux:
5656
# Run standard library tests in Miri.
5757
$(Q)MIRIFLAGS="-Zmiri-strict-provenance" \
5858
$(BOOTSTRAP) miri --stage 2 \
59-
library/coretests \
60-
library/alloctests \
59+
library/core \
6160
library/alloc \
6261
$(BOOTSTRAP_ARGS) \
6362
--no-doc
6463
# Some doctests use file system operations to demonstrate dealing with `Result`,
6564
# so we have to run them with isolation disabled.
6665
$(Q)MIRIFLAGS="-Zmiri-disable-isolation" \
6766
$(BOOTSTRAP) miri --stage 2 \
68-
library/coretests \
69-
library/alloctests \
67+
library/core \
7068
library/alloc \
7169
$(BOOTSTRAP_ARGS) \
7270
--doc

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1430,10 +1430,12 @@ fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelect
14301430
if builder.config.llvm_enzyme {
14311431
cargo.env("LLVM_ENZYME", "1");
14321432
}
1433+
let llvm::LlvmResult { host_llvm_config, .. } = builder.ensure(llvm::Llvm { target });
14331434
if builder.config.llvm_offload {
1435+
builder.ensure(llvm::OmpOffload { target });
14341436
cargo.env("LLVM_OFFLOAD", "1");
14351437
}
1436-
let llvm::LlvmResult { host_llvm_config, .. } = builder.ensure(llvm::Llvm { target });
1438+
14371439
cargo.env("LLVM_CONFIG", &host_llvm_config);
14381440

14391441
// Some LLVM linker flags (-L and -l) may be needed to link `rustc_llvm`. Its build script
@@ -2296,6 +2298,24 @@ impl Step for Assemble {
22962298
}
22972299
}
22982300

2301+
if builder.config.llvm_offload && !builder.config.dry_run() {
2302+
debug!("`llvm_offload` requested");
2303+
let offload_install = builder.ensure(llvm::OmpOffload { target: build_compiler.host });
2304+
if let Some(_llvm_config) = builder.llvm_config(builder.config.host_target) {
2305+
let target_libdir =
2306+
builder.sysroot_target_libdir(target_compiler, target_compiler.host);
2307+
for p in offload_install.offload_paths() {
2308+
let libname = p.file_name().unwrap();
2309+
let dst_lib = target_libdir.join(libname);
2310+
builder.resolve_symlink_and_copy(&p, &dst_lib);
2311+
}
2312+
// FIXME(offload): Add amdgcn-amd-amdhsa and nvptx64-nvidia-cuda folder
2313+
// This one is slightly more tricky, since we have the same file twice, in two
2314+
// subfolders for amdgcn and nvptx64. We'll likely find two more in the future, once
2315+
// Intel and Spir-V support lands in offload.
2316+
}
2317+
}
2318+
22992319
// Build the libraries for this compiler to link to (i.e., the libraries
23002320
// it uses at runtime).
23012321
debug!(

0 commit comments

Comments
 (0)