Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bootstrap.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
# Whether to build LLVM with support for it's gpu offload runtime.
#llvm.offload = false

# Absolute path to the directory containing ClangConfig.cmake
#llvm.offload-clang-dir = ""

# When true, link libstdc++ statically into the rustc_llvm.
# This is useful if you don't want to use the dynamic version of that
# library provided by LLVM.
Expand Down
13 changes: 7 additions & 6 deletions compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1384,13 +1384,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
&& let hir::Node::Stmt(&hir::Stmt { kind: hir::StmtKind::Semi(parent), .. })
| hir::Node::Expr(parent) = tcx.parent_hir_node(path_expr.hir_id)
{
let replacement_span =
if let hir::ExprKind::Call(..) | hir::ExprKind::Struct(..) = parent.kind {
// We want to replace the parts that need to go, like `()` and `{}`.
// We want to replace the parts that need to go, like `()` and `{}`.
let replacement_span = match parent.kind {
hir::ExprKind::Call(callee, _) if callee.hir_id == path_expr.hir_id => {
span.with_hi(parent.span.hi())
} else {
span
};
}
hir::ExprKind::Struct(..) => span.with_hi(parent.span.hi()),
_ => span,
};
match (variant.ctor, parent.kind) {
(None, hir::ExprKind::Struct(..)) => {
// We want a struct and we have a struct. We won't suggest changing
Expand Down
3 changes: 2 additions & 1 deletion library/core/src/mem/maybe_dangling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ use crate::{mem, ptr};
///
/// To fix this we could use `MaybeDangling`:
///
/// ```rust
// FIXME: remove `no_run` once the semantics are actually implemented
/// ```rust,no_run
/// #![feature(maybe_dangling, box_as_ptr)]
/// # use std::alloc::{dealloc, Layout};
/// # use std::mem::{self, MaybeDangling};
Expand Down
18 changes: 6 additions & 12 deletions library/core/src/slice/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2495,19 +2495,13 @@ impl<'a, T> Iterator for RChunksMut<'a, T> {
&& end < self.v.len()
{
let end = self.v.len() - end;
let start = match end.checked_sub(self.chunk_size) {
Some(sum) => sum,
None => 0,
};
// SAFETY: This type ensures that self.v is a valid pointer with a correct len.
// Therefore the bounds check in split_at_mut guarantees the split point is inbounds.
let (head, tail) = unsafe { self.v.split_at_mut(start) };
// SAFETY: This type ensures that self.v is a valid pointer with a correct len.
// Therefore the bounds check in split_at_mut guarantees the split point is inbounds.
let (nth, _) = unsafe { tail.split_at_mut(end - start) };
self.v = head;
// SAFETY: The self.v contract ensures that any split_at_mut is valid.
let (rest, _) = unsafe { self.v.split_at_mut(end) };
// SAFETY: The self.v contract ensures that any split_at_mut is valid.
let (rest, chunk) = unsafe { rest.split_at_mut(end.saturating_sub(self.chunk_size)) };
self.v = rest;
// SAFETY: Nothing else points to or will point to the contents of this slice.
Some(unsafe { &mut *nth })
Some(unsafe { &mut *chunk })
} else {
self.v = &mut [];
None
Expand Down
8 changes: 4 additions & 4 deletions rust-bors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ labels_blocking_approval = [
# If CI runs quicker than this duration, consider it to be a failure
min_ci_time = 600

# Flip this once new bors is used for actual merges on this repository
merge_queue_enabled = false
report_merge_conflicts = true

[labels]
approved = [
"+S-waiting-on-bors",
Expand Down Expand Up @@ -60,7 +64,3 @@ auto_build_failed = [
"-S-waiting-on-crater",
"-S-waiting-on-team"
]

# Flip this two once new bors is used for actual merges on this repository
merge_queue_enabled = false
report_merge_conflicts = true
5 changes: 5 additions & 0 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ def v(*args):
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
o("llvm-enzyme", "llvm.enzyme", "build LLVM with enzyme")
o("llvm-offload", "llvm.offload", "build LLVM with gpu offload support")
o(
"llvm-offload-clang-dir",
"llvm.offload-clang-dir",
"pass the absolute directory of ClangConfig.cmake",
)
o("llvm-plugins", "llvm.plugins", "build LLVM with plugin interface")
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")
o(
Expand Down
6 changes: 2 additions & 4 deletions src/bootstrap/mk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,15 @@ check-aux:
# Run standard library tests in Miri.
$(Q)MIRIFLAGS="-Zmiri-strict-provenance" \
$(BOOTSTRAP) miri --stage 2 \
library/coretests \
library/alloctests \
library/core \
library/alloc \
$(BOOTSTRAP_ARGS) \
--no-doc
# Some doctests use file system operations to demonstrate dealing with `Result`,
# so we have to run them with isolation disabled.
$(Q)MIRIFLAGS="-Zmiri-disable-isolation" \
$(BOOTSTRAP) miri --stage 2 \
library/coretests \
library/alloctests \
library/core \
library/alloc \
$(BOOTSTRAP_ARGS) \
--doc
Expand Down
22 changes: 21 additions & 1 deletion src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1430,10 +1430,12 @@ fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelect
if builder.config.llvm_enzyme {
cargo.env("LLVM_ENZYME", "1");
}
let llvm::LlvmResult { host_llvm_config, .. } = builder.ensure(llvm::Llvm { target });
if builder.config.llvm_offload {
builder.ensure(llvm::OmpOffload { target });
cargo.env("LLVM_OFFLOAD", "1");
}
let llvm::LlvmResult { host_llvm_config, .. } = builder.ensure(llvm::Llvm { target });

cargo.env("LLVM_CONFIG", &host_llvm_config);

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

if builder.config.llvm_offload && !builder.config.dry_run() {
debug!("`llvm_offload` requested");
let offload_install = builder.ensure(llvm::OmpOffload { target: build_compiler.host });
if let Some(_llvm_config) = builder.llvm_config(builder.config.host_target) {
let target_libdir =
builder.sysroot_target_libdir(target_compiler, target_compiler.host);
for p in offload_install.offload_paths() {
let libname = p.file_name().unwrap();
let dst_lib = target_libdir.join(libname);
builder.resolve_symlink_and_copy(&p, &dst_lib);
}
// FIXME(offload): Add amdgcn-amd-amdhsa and nvptx64-nvidia-cuda folder
// This one is slightly more tricky, since we have the same file twice, in two
// subfolders for amdgcn and nvptx64. We'll likely find two more in the future, once
// Intel and Spir-V support lands in offload.
}
}

// Build the libraries for this compiler to link to (i.e., the libraries
// it uses at runtime).
debug!(
Expand Down
Loading
Loading